/* /iceberg-chart-maker/ page styles. Built from /assets/polyatic.css tokens only (no new fonts or theme colours).
   The sky, water and ice colours are the chart's own content (the saved picture's colours), set per level by
   iceberg.js as --water, --ice and --ink, so the chart looks the same in both themes, as the PNG will. */
.nojs{margin:1.25rem 0 0;padding:0.875rem 1rem;border:1px solid var(--line);border-left:0.25rem solid var(--accent);border-radius:0.625rem;background:var(--surface);color:var(--ink);font-size:0.9375rem;line-height:1.5}
.ib-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.ib-head .sub{margin-bottom:0.75rem}
@media(max-width:520px){.ib-head h1{font-size:1.625rem;margin-bottom:0.25rem}.ib-head .sub{font-size:0.9375rem;margin-bottom:0.5rem}}

/* phone: add, then the chart, then levels and save; desktop: the chart tall on the left, add / levels / save on the right */
.ib-duo{display:grid;gap:1rem;align-items:start;grid-template-areas:"add" "chart" "more"}
@media(min-width:920px){.ib-duo{grid-template-columns:minmax(0,1fr) minmax(18rem,22rem);grid-template-areas:"chart add" "chart more";gap:1rem 1.5rem}}
.ib-add{grid-area:add}.ib-chartcard{grid-area:chart}.ib-more{grid-area:more}
.ib-add,.ib-chartcard,.ib-more{min-width:0;display:grid;gap:0.75rem;align-content:start}
@media(min-width:920px){.ib-chartcard{grid-row:1 / span 2}}
@media(max-width:520px){.ib-add,.ib-chartcard,.ib-more{padding:0.75rem}}
.ib-add.is-dropping,.ib-chartcard.is-dropping{outline:2px dashed var(--accent);outline-offset:2px}

.ib-chartcard>input{width:100%;min-width:0;font-weight:600}

/* the iceberg: one band per level, the ice clipped from the outline iceberg-core.js computes for this level */
.ib-chart{display:flex;flex-direction:column;min-height:26rem;border-radius:0.5rem;overflow:hidden;border:1px solid var(--line-2)}
@media(min-width:920px){.ib-chart{min-height:max(30rem,calc(100vh - 14rem))}}
.ib-band{position:relative;flex:var(--grow,1) 1 auto;min-height:calc(3.5rem * var(--grow,1));display:flex;flex-direction:column;gap:0.25rem;padding:0.375rem 0.625rem 0.5rem;background:var(--water);color:var(--ink);cursor:default}
.ib-band.is-surface{box-shadow:inset 0 3px 0 var(--wl)}
.ib-band:focus-visible{outline:3px solid var(--accent);outline-offset:-3px}
.ib-ice{position:absolute;inset:0;background:var(--ice);clip-path:var(--clip);pointer-events:none}
.ib-lab,.ib-items{position:relative}
.ib-lab{font-weight:700;font-size:0.875rem;line-height:1.2;overflow-wrap:anywhere}
.ib-items{flex:1;display:flex;flex-wrap:wrap;gap:0.25rem 0.5rem;align-items:center;align-content:center;justify-content:center;min-height:1.5rem}
.ib-chart.is-target .ib-band{cursor:pointer}
.ib-chart.is-target .ib-band:hover,.ib-band.is-over{box-shadow:inset 0 0 0 3px var(--accent)}

/* tiles: items and pictures, in the tray and on the chart */
.ib-tile{flex:none;margin:0;padding:0.25rem 0.5rem;border:1px solid var(--line-2);border-radius:0.375rem;background:var(--surface);color:var(--ink);font:inherit;font-size:0.875rem;line-height:1.25;max-width:100%;overflow-wrap:anywhere;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}
.ib-tile.is-pic{padding:0;width:3.25rem;height:3.25rem;overflow:hidden}
.ib-tile img{display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}
.ib-tile.is-sel,.ib-tile:focus-visible{outline:3px solid var(--accent);outline-offset:1px}
.ib-band .ib-tile{touch-action:auto;border:0;background:transparent;color:var(--ink);padding:0.0625rem 0.25rem;font-weight:600}
.ib-band .ib-tile.is-pic{width:2.75rem;height:2.75rem;border-radius:0.25rem}
.ib-band .ib-tile.is-sel{outline-color:currentColor}
.ib-ghost{position:fixed;z-index:20;pointer-events:none;opacity:.85;transform:translate(-50%,-50%)}

.ib-tray{display:flex;flex-wrap:wrap;gap:0.375rem;min-height:3rem;padding:0.375rem;border:1px dashed var(--line-2);border-radius:0.5rem;background:var(--surface-2)}
.ib-tray:empty::before{content:"Empty: everything is on the chart";align-self:center;padding:0 0.25rem;font-size:0.8125rem;color:var(--muted)}
.ib-tray.is-over{background:var(--accent-soft)}

.ib-add textarea{width:100%;min-height:4.5rem;font-family:var(--sans);font-size:0.9375rem}
.ib-row{display:flex;flex-wrap:wrap;gap:0.5rem;margin-top:0.5rem;align-items:center}
.ib-row .btn{flex:1 1 0;display:inline-flex;align-items:center;justify-content:center}
.ib-row select{flex:0 0 6.5rem}
.ib-filebtn{cursor:pointer}
#picfile:focus-visible+.ib-filebtn{outline:2px solid var(--accent);outline-offset:2px}
.ib-help{margin:0.375rem 0 0;font-size:0.8125rem;line-height:1.5;color:var(--muted)}
.ib-help:empty{display:none}
.ib-help code{font-family:var(--mono);font-size:0.75rem}
.ib-chartcard .ib-help{margin:0}
.ib-selrow{display:flex;flex-wrap:wrap;gap:0.375rem}
.ib-selrow[hidden]{display:none}

.ib-count{margin-top:0}
.ib-count .chip{min-width:2.25rem;justify-content:center}
.ib-count #lvl-reset{margin-left:auto}
.ib-levels{display:grid;gap:0.375rem;margin-top:0.5rem}
.ib-lvlrow{display:flex;gap:0.5rem;align-items:center}
.ib-num{flex:none;width:1.5rem;text-align:right;font-family:var(--mono);font-size:0.8125rem;color:var(--muted)}
.ib-lvlrow input{flex:1;min-width:0}
.ib-clear{margin-top:0.625rem}
@media(prefers-reduced-motion:reduce){.ib-ghost{transition:none}}
