/* Sumthing: shared tile, board and rule-chip art (phone, TV, daily hub,
   game over, tutorial). Imported by phone.css and display.css. */

:root {
  --sumthing-accent: #D648C4;
  /* Magenta as text fails on the light sheet (3.6:1); text takes a deeper
     shade there and a lighter one on the dark table. */
  --sumthing-accent-text: #A3238F;
  --sumthing-deny: #D9472B;
  /* Rounded digits where the platform has one (Apple's SF Rounded), else
     the system sans at heavy weight. */
  --st-num-font: ui-rounded, 'SF Pro Rounded', 'Segoe UI', system-ui, sans-serif;
}

html[data-theme='dark'] { --sumthing-accent-text: #EC8ADF; }

/* ── Board ─────────────────────────────────────────────── */

.st-board {
  --st-cs: 48px;
  --st-gap: calc(var(--st-cs) * 0.07);
  position: relative;
  width: calc(var(--cols) * var(--st-cs));
  height: calc(var(--rows) * var(--st-cs));
  box-sizing: content-box;
  padding: calc(var(--st-cs) * 0.08);
  border-radius: 10px;
  background: var(--surface, #FAF9F5);
  border: 2px solid var(--border, #D6D2C4);
  box-shadow: var(--card-shadow, 0 4px 10px rgba(40, 36, 28, .16));
  flex: none;
}

/* Lanes: every column is a faint channel; an emptied one keeps a dashed
   outline so the gap reads as open floor, not the board's edge. */
.st-lane {
  position: absolute;
  top: calc(var(--st-cs) * 0.08);
  bottom: calc(var(--st-cs) * 0.08);
  left: calc(var(--st-cs) * 0.08 + var(--c) * var(--st-cs) + var(--st-gap) / 2);
  width: calc(var(--st-cs) - var(--st-gap));
  border-radius: 6px;
  background: color-mix(in srgb, var(--text, #221F1B) 5%, transparent);
}
.st-lane.empty {
  background: transparent;
  border: 2px dashed color-mix(in srgb, var(--text, #221F1B) 16%, transparent);
  box-sizing: border-box;
}

/* ── Tiles ─────────────────────────────────────────────── */
/* One color per shape: plain squares are sand (so the shaped tiles read as
   the special ones), fixed dark ink, a raised bottom edge. Same art on
   every surface. */
.st-tile {
  position: absolute;
  left: calc(var(--st-cs) * 0.08 + var(--c) * var(--st-cs) + var(--st-gap) / 2);
  top: calc(var(--st-cs) * 0.08 + var(--r) * var(--st-cs) + var(--st-gap) / 2);
  width: calc(var(--st-cs) - var(--st-gap));
  height: calc(var(--st-cs) - var(--st-gap));
  box-sizing: border-box;
  border-radius: calc(var(--st-cs) * 0.16);
  background: oklch(0.89 0.05 85);
  box-shadow:
    inset 0 calc(var(--st-cs) * -0.07) 0 oklch(0.74 0.06 75),
    0 calc(var(--st-cs) * 0.03) calc(var(--st-cs) * 0.06) rgba(0, 0, 0, .22);
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: calc(var(--st-cs) * 0.05);
  font-family: var(--st-num-font);
  font-weight: 800;
  font-size: calc(var(--st-cs) * 0.44);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}
.st-tile > span { position: relative; z-index: 1; }
.st-tile > .st-shape { display: none; }

/* Shaped tiles: the tile is only a frame; the fill is its shape. Green
   cross multiplies, orange circle wants an odd partner, blue triangle an
   even one. The drop shadow follows the shape, not the box. */
.st-tile[data-k]:not([data-k="0"]) {
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 calc(var(--st-cs) * 0.05) calc(var(--st-cs) * 0.035) rgba(0, 0, 0, .3));
}
.st-tile[data-k]:not([data-k="0"]) > .st-shape { display: block; position: absolute; inset: 0; background: var(--st-fill); }
.st-tile[data-k="1"] { --st-fill: oklch(0.80 0.16 150); font-size: calc(var(--st-cs) * 0.38); }
.st-tile[data-k="2"] { --st-fill: oklch(0.80 0.15 62); border-radius: 50%; }
.st-tile[data-k="3"] { --st-fill: oklch(0.79 0.11 245); }
.st-tile[data-k="1"] > .st-shape { clip-path: polygon(30% 0, 70% 0, 70% 30%, 100% 30%, 100% 70%, 70% 70%, 70% 100%, 30% 100%, 30% 70%, 0 70%, 0 30%, 30% 30%); }
.st-tile[data-k="2"] > .st-shape { border-radius: 50%; }
.st-tile[data-k="3"] > .st-shape { clip-path: polygon(50% 4%, 98% 94%, 2% 94%); }
.st-tile[data-k="3"] > span { transform: translateY(24%); }
/* A target popping: the tile bursts out and fades. */
@keyframes st-burst { 0% { scale: 1; opacity: 1; } 40% { scale: 1.3; opacity: 1; } 100% { scale: 0.2; opacity: 0; } }
:root:not(.reduce-motion) .st-tile.st-bursting { animation: st-burst 0.3s ease-out forwards; z-index: 5; pointer-events: none; }

/* ── Rule chips ────────────────────────────────────────── */

.st-chips {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  flex-wrap: wrap;
  min-width: 0;
}
.st-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.3em 0.65em 0.3em 0.5em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sumthing-accent) 16%, var(--surface, #FAF9F5));
  border: 2px solid color-mix(in srgb, var(--sumthing-accent) 60%, var(--border, #D6D2C4));
  color: var(--text, #221F1B);
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.15;
}
.st-chip-icon {
  display: inline-flex;
  font-size: 1.2em;
  color: color-mix(in srgb, var(--sumthing-accent) 80%, var(--text, #221F1B));
}
.st-chip-icon svg { display: block; }
.st-join {
  font-weight: 700;
  font-size: 0.85em;
  color: var(--muted, #6B665B);
  text-transform: lowercase;
}
.st-chip-group {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.15em;
  border-radius: 999px;
  border: 2px dashed color-mix(in srgb, var(--sumthing-accent) 55%, var(--border, #D6D2C4));
}

/* Shaped-tile icons in the legend. */
.st-mini { display: inline-block; width: 1em; height: 1em; background: var(--st-fill); }
.st-mini-cross { --st-fill: oklch(0.72 0.17 150); clip-path: polygon(30% 0, 70% 0, 70% 30%, 100% 30%, 100% 70%, 70% 70%, 70% 100%, 30% 100%, 30% 70%, 0 70%, 0 30%, 30% 30%); }
.st-mini-circle { --st-fill: oklch(0.74 0.16 62); border-radius: 50%; }
.st-mini-triangle { --st-fill: oklch(0.7 0.13 245); clip-path: polygon(50% 6%, 98% 94%, 2% 94%); }

/* ── Goal banner ───────────────────────────────────────── */
/* The target. Deliberately unlike a rule chip: solid accent block, square
   corners, big number, no icon, never dims, shakes or deals in. */
.st-goal {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  padding: 0.12em 0.6em 0.18em;
  border-radius: 0.3em;
  background: var(--sumthing-accent);
  color: #fff;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 0.12em 0 color-mix(in srgb, var(--sumthing-accent) 70%, #000);
}
.st-goal-make { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.92; }
.st-goal-num { font-family: var(--st-num-font); font-size: 1.5em; font-variant-numeric: tabular-nums; }
.st-chips > .st-goal { margin-right: 0.35em; }

/* Icon-only chips (the daily hub's tier buttons): the label rides in the
   button's title and aria-label instead. */
.st-chips-icons { gap: 0.2em; font-size: 12px; flex-wrap: nowrap; }
.st-chips-icons .st-goal { padding: 0.15em 0.4em; margin-right: 0.1em; }
.st-chips-icons.st-chips-3 { font-size: 10px; gap: 0.12em; }
.st-chips-icons.st-chips-3 .st-chip { padding: 0.2em 0.25em; border-width: 1.5px; }
.st-chips-icons .st-goal-make { display: none; }
.st-chips-icons .st-goal-num { font-size: 1.15em; }
.st-chips-icons .st-chip { padding: 0.25em 0.4em; gap: 0; }
.st-chips-icons .st-chip-label { display: none; }
.st-chips-icons .st-join { font-size: 0.9em; }
.dz-tier-rules { display: flex; justify-content: center; margin-top: 3px; max-width: 100%; overflow: hidden; }

/* ── Game-over replay (replay.js) ──────────────────────── */

.st-replay {
  --sr-accent: var(--sumthing-accent);
  display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%;
}
.st-replay-stage { width: 100%; display: flex; justify-content: center; }
.st-replay .st-tile.st-moving { z-index: 3; }
@keyframes st-replay-pop { 0% { scale: 1; } 45% { scale: 1.18; } 100% { scale: 1; } }
:root:not(.reduce-motion) .st-replay .st-tile.st-pop { animation: st-replay-pop 0.26s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes st-replay-undo { 0% { box-shadow: 0 0 0 3px var(--sumthing-deny); } 100% { box-shadow: 0 0 0 3px transparent; } }
.st-replay-board.st-replay-undo { animation: st-replay-undo 0.5s ease-out; }
