:root {
  --paper: #f3f0e9;
  --paper-light: #fffdf8;
  --ink: #263447;
  --ink-soft: #536276;
  --muted: #7c8796;
  --coral: #d36d5b;
  --coral-dark: #b85647;
  --sky: #78a7c5;
  --mint: #78a993;
  --line: rgba(38, 52, 71, .14);
  --glass: rgba(255, 255, 255, .54);
  --glass-strong: rgba(255, 255, 255, .72);
  --glass-shadow: 0 18px 52px rgba(38, 52, 71, .13), inset 0 1px 0 rgba(255, 255, 255, .72);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.22, .8, .25, 1);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  background:
    radial-gradient(circle at 14% -10%, rgba(120, 167, 197, .23), transparent 32rem),
    radial-gradient(circle at 100% 22%, rgba(211, 109, 91, .13), transparent 28rem),
    linear-gradient(135deg, #f7f4ed 0%, var(--paper) 52%, #ebe8e1 100%);
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: .24;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.14'/%3E%3C/svg%3E");
}
body.is-playing { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
input, textarea, [contenteditable="true"] { -webkit-touch-callout: default; -webkit-user-select: text; user-select: text; }
img, svg, button, a { -webkit-user-drag: none; user-drag: none; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(211, 109, 91, .66); outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 9px 13px;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100dvh; }
body.is-playing .app-shell { height: 100dvh; overflow: hidden; }
body.is-playing main { height: 100%; overflow: hidden; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  padding: 14px 4px;
  background: rgba(243, 240, 233, .67);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 13px);
  gap: 3px;
  width: 29px;
  height: 29px;
  padding: 3px;
  border-radius: 9px;
  background: var(--ink);
  box-shadow: 0 6px 12px rgba(38, 52, 71, .17);
  transform: rotate(-5deg);
}
.brand-mark i { display: block; border-radius: 3px; background: var(--paper-light); }
.brand-mark i:nth-child(2) { background: var(--coral); }
.brand-mark i:nth-child(3) { background: var(--sky); }
.brand-mark i:nth-child(4) { background: #f5cc7b; }
.brand b, .brand small { display: block; }
.brand b { font-size: 12px; letter-spacing: .16em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.sync-pill, .quiet-button, .icon-button, .progress-code-button, .timer, .tool-button, .bottom-tabs, .hero-card, .progress-strip, .board-frame, .result-dialog, .confirm-dialog, .pause-dialog, .progress-code-dialog, .privacy-consent-dialog, .privacy-exit-card {
  border: 1px solid rgba(255, 255, 255, .76);
  box-shadow: var(--glass-shadow);
}
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .38);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
}
.status-dot, .tip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(120, 169, 147, .16); }
.status-dot.is-loading { background: var(--coral); animation: pulse 1s infinite; }
.status-dot.is-offline { background: #d7a35a; box-shadow: 0 0 0 4px rgba(215, 163, 90, .18); }
#sync-label-short { display: none; }
.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, .48);
  border-radius: 50%;
  transition: transform .2s var(--ease), background .2s ease;
}
.icon-button:hover { background: rgba(255, 255, 255, .78); transform: translateY(-2px) rotate(20deg); }
.icon-button span { font-size: 22px; line-height: 1; }
.progress-code-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: rgba(255,255,255,.42);
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
  transition: transform .2s var(--ease), background .2s ease;
}
.progress-code-button:hover { background: rgba(255,255,255,.78); transform: translateY(-2px); }
.progress-code-button > span:first-child { display: grid; place-items: center; width: 17px; height: 17px; color: var(--coral-dark); border: 1px solid currentColor; border-radius: 50%; font-size: 15px; line-height: 1; }

.screen { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 calc(124px + env(safe-area-inset-bottom)); }
.home-intro, .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: var(--coral-dark); font-size: 11px; font-weight: 850; letter-spacing: .16em; }
.eyebrow b { color: var(--ink); }
h1, h2, p { margin-top: 0; }
h1 { max-width: 700px; margin-bottom: 10px; font-size: clamp(31px, 5vw, 58px); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 8px; font-size: clamp(25px, 3vw, 36px); line-height: 1.05; letter-spacing: -.045em; }
.lede { max-width: 560px; margin-bottom: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.7; }
.quiet-button, .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 45px;
  padding: 0 17px;
  cursor: pointer;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  transition: transform .2s var(--ease), box-shadow .2s ease, background .2s ease;
}
.quiet-button { background: rgba(255, 255, 255, .36); }
.quiet-button:hover { background: rgba(255, 255, 255, .72); transform: translateY(-2px); }
.primary-button { color: #fff; background: linear-gradient(135deg, var(--coral) 0%, #c55c4f 100%); border: 1px solid rgba(255,255,255,.3); box-shadow: 0 9px 22px rgba(185, 82, 69, .25), inset 0 1px 0 rgba(255,255,255,.28); }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 13px 26px rgba(185, 82, 69, .3), inset 0 1px 0 rgba(255,255,255,.35); }
.primary-button:disabled, .quiet-button:disabled, .tool-button:disabled, .pause-button:disabled { cursor: not-allowed; opacity: .5; transform: none; }

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(280px, .9fr);
  gap: clamp(24px, 5vw, 68px);
  align-items: center;
  overflow: hidden;
  padding: clamp(18px, 3.2vw, 34px);
  background: linear-gradient(125deg, rgba(255,255,255,.68), rgba(255,255,255,.34));
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
}
.hero-card::before, .result-dialog::before, .confirm-dialog::before, .pause-dialog::before, .tool-button::before {
  position: absolute;
  inset: 1px;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  background: linear-gradient(125deg, rgba(255,255,255,.52), transparent 32%, transparent 70%, rgba(120,167,197,.12));
  opacity: .75;
}
.hero-art-wrap { position: relative; width: min(100%, 470px); margin: 0 auto; }
.hero-art, .album-art { position: relative; overflow: hidden; background: rgba(226, 231, 238, .64); border-radius: 20px; box-shadow: 0 13px 28px rgba(38,52,71,.17); }
.hero-art { width: 100%; aspect-ratio: 2 / 3; }
.art-stamp { position: absolute; right: 13px; bottom: 12px; padding: 7px 10px; color: #fff; background: rgba(38,52,71,.74); border: 1px solid rgba(255,255,255,.38); border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .12em; backdrop-filter: blur(12px); }
.art-stamp b { color: #f6cf82; }
.hero-copy { position: relative; z-index: 1; }
.level-kicker { display: flex; align-items: center; gap: 9px; margin-bottom: 19px; color: var(--muted); font-size: 12px; font-weight: 800; }
.level-badge { display: grid; place-items: center; width: 33px; height: 33px; color: #fff; background: var(--ink); border-radius: 11px; font-size: 12px; }
.kicker-line { flex: 0 1 76px; height: 1px; margin-left: 4px; background: var(--line); }
.hero-copy h2 { max-width: 340px; font-size: clamp(30px, 4vw, 48px); }
.hero-copy > p { margin-bottom: 26px; color: var(--ink-soft); line-height: 1.6; }
.hero-meta { display: flex; gap: 34px; margin-bottom: 27px; }
.hero-meta span { display: grid; gap: 4px; }
.hero-meta b { font-size: 20px; letter-spacing: -.04em; }
.hero-meta small { color: var(--muted); font-size: 11px; font-weight: 700; }

.puzzle-preview { position: relative; width: 100%; height: 100%; overflow: hidden; display: grid; }
.preview-tile { position: absolute; background-repeat: no-repeat; transition: filter .25s ease; }
.preview-tile::after { position: absolute; inset: 0; content: ""; border: 1px solid rgba(255,255,255,.6); opacity: .48; }
.album-art .puzzle-preview { position: absolute; inset: 0; }
.album-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.progress-strip { display: grid; grid-template-columns: auto minmax(100px, 1fr) auto; align-items: center; gap: 19px; margin-top: 17px; padding: 14px 18px; background: rgba(255,255,255,.34); border-radius: var(--radius-md); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.progress-strip > div:first-child { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.progress-label, .progress-note { color: var(--muted); font-size: 11px; font-weight: 750; }
.progress-strip strong { font-size: 18px; }
.progress-track { height: 8px; overflow: hidden; background: rgba(38,52,71,.1); border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--sky), var(--coral)); border-radius: inherit; transition: width .45s var(--ease); }
.progress-note { text-align: right; }
.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  margin: 0;
  padding: 6px;
  background: rgba(255,255,255,.7);
  border-radius: 999px;
  box-shadow: 0 16px 42px rgba(38,52,71,.18), inset 0 1px 0 rgba(255,255,255,.86);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
  transform: translateX(-50%);
}
body.is-playing .bottom-tabs { display: none; }
.tab-button { display: inline-flex; align-items: center; gap: 8px; min-width: 88px; min-height: 39px; padding: 0 15px; color: var(--muted); background: transparent; border: 0; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 800; transition: .2s ease; }
.tab-button:hover, .tab-button.is-active { color: var(--ink); background: rgba(255,255,255,.74); box-shadow: 0 5px 14px rgba(38,52,71,.1); }
.tab-icon { font-size: 17px; line-height: 1; }

.section-heading { align-items: center; }
.levels-screen { padding-top: 44px; }
.levels-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.level-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 12px; background: rgba(255,255,255,.38); border: 1px solid rgba(255,255,255,.68); border-radius: 22px; box-shadow: 0 13px 33px rgba(38,52,71,.08); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); transition: transform .25s var(--ease), box-shadow .25s ease; }
.level-card:hover { transform: translateY(-5px); box-shadow: 0 20px 38px rgba(38,52,71,.13); }
.level-card.is-current { border-color: rgba(211, 109, 91, .42); box-shadow: 0 14px 32px rgba(185, 82, 69, .12); }
.level-card.is-locked:hover { transform: none; box-shadow: 0 13px 33px rgba(38,52,71,.08); }
.album-art { aspect-ratio: 1 / 1; border-radius: 16px; }
.level-card.is-locked .album-art { background: linear-gradient(160deg, rgba(255,253,248,.92), rgba(226,231,238,.78)); }
.lock-cover { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); background: transparent; }
.lock-mark { display: grid; place-items: center; width: 54px; height: 54px; color: var(--ink-soft); background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.88); border-radius: 18px; box-shadow: 0 10px 24px rgba(38,52,71,.08), inset 0 1px 0 rgba(255,255,255,.92); }
.locked-button { display: inline-flex; align-items: center; justify-content: center; min-height: 35px; padding: 0 13px; color: var(--muted); background: rgba(255,255,255,.34); border: 1px solid rgba(38,52,71,.1); border-radius: 999px; box-shadow: none; font-size: 11px; font-weight: 800; cursor: not-allowed; }
.album-tag { position: absolute; top: 10px; left: 10px; padding: 6px 9px; color: #fff; background: rgba(38,52,71,.78); border-radius: 999px; font-size: 10px; font-weight: 800; backdrop-filter: blur(10px); }
.album-tag.is-done { color: var(--ink); background: rgba(255,255,255,.78); }
.level-card-copy { padding: 15px 5px 4px; }
.level-card-copy h2 { margin-bottom: 6px; font-size: 20px; }
.level-card-copy p { min-height: 22px; margin-bottom: 13px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.level-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.level-card-meta { color: var(--muted); font-size: 11px; font-weight: 750; }
.level-card-action { min-height: 35px; padding: 0 13px; font-size: 11px; }
.empty-card { grid-column: 1 / -1; padding: 52px 22px; text-align: center; color: var(--muted); background: rgba(255,255,255,.38); border: 1px dashed rgba(38,52,71,.2); border-radius: 22px; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 26px auto 4px;
  padding: 6px;
  background: rgba(255,255,255,.52);
  border: 1px solid rgba(255,255,255,.74);
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(38,52,71,.09), inset 0 1px 0 rgba(255,255,255,.84);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.pagination-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: rgba(255,255,255,.42);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s var(--ease);
}
.pagination-button:hover:not(:disabled) { color: var(--coral-dark); background: rgba(255,255,255,.88); border-color: rgba(211,109,91,.22); transform: translateY(-1px); }
.pagination-button:disabled { color: rgba(124,135,150,.45); background: transparent; cursor: not-allowed; }
.pagination-status { min-width: 48px; color: var(--muted); font-size: 11px; font-weight: 800; text-align: center; }
.pagination-status b { color: var(--ink); font-size: 14px; }

.gallery-screen { padding-top: 44px; }
.gallery-count {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  color: var(--ink-soft);
  background: rgba(255,255,255,.44);
  border: 1px solid rgba(255,255,255,.74);
  border-radius: 999px;
  box-shadow: 0 9px 22px rgba(38,52,71,.08);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.gallery-card {
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255,255,255,.58), rgba(255,255,255,.3));
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 22px;
  box-shadow: 0 13px 33px rgba(38,52,71,.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform .25s var(--ease), box-shadow .25s ease;
}
.gallery-card:hover { transform: translateY(-5px); box-shadow: 0 20px 38px rgba(38,52,71,.14); }
.gallery-card-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  padding: 0;
  background: rgba(226,231,238,.66);
  border: 0;
  cursor: zoom-in;
}
.gallery-card-image::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, transparent 46%, rgba(38,52,71,.42) 100%);
  opacity: .8;
}
.gallery-card-image img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s var(--ease), filter .3s ease; }
.gallery-card:hover .gallery-card-image img { transform: scale(1.045); filter: saturate(1.05); }
.gallery-view-label {
  position: absolute;
  right: 12px;
  bottom: 11px;
  z-index: 1;
  padding: 7px 10px;
  color: #fff;
  background: rgba(38,52,71,.66);
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
}
.gallery-card-copy { display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 14px 15px 16px; }
.gallery-card-kicker { color: var(--coral-dark); font-size: 10px; font-weight: 850; letter-spacing: .12em; }
.gallery-card-copy h2 { margin: 5px 0 0; overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.gallery-card-meta { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-weight: 750; text-align: right; white-space: nowrap; }
.gallery-empty { display: grid; justify-items: center; gap: 10px; min-height: 265px; }
.gallery-empty strong { color: var(--ink); font-size: 17px; }
.gallery-empty span:not(.gallery-empty-icon) { max-width: 270px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.gallery-empty .quiet-button { margin-top: 7px; }
.gallery-empty-icon { display: grid; place-items: center; width: 58px; height: 58px; color: var(--coral-dark); background: rgba(211,109,91,.12); border-radius: 19px; font-size: 29px; }
.gallery-viewer {
  position: relative;
  width: min(700px, 100%);
  max-height: min(90dvh, 860px);
  overflow: auto;
  padding: 22px;
  background: linear-gradient(145deg, rgba(255,255,255,.88), rgba(255,255,255,.62));
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(38,52,71,.22), inset 0 1px 0 rgba(255,255,255,.8);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  animation: dialog-in .3s var(--ease) both;
}
.gallery-viewer-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.gallery-viewer-header h2 { margin-bottom: 0; font-size: clamp(24px, 4vw, 34px); }
.gallery-viewer-header .icon-button { position: relative; z-index: 1; flex: 0 0 auto; }
.gallery-viewer-body { margin-top: 17px; }
.gallery-viewer-art { display: grid; place-items: center; min-height: 220px; max-height: min(62dvh, 600px); overflow: hidden; background: rgba(226,231,238,.54); border: 1px solid rgba(255,255,255,.7); border-radius: 19px; }
.gallery-viewer-art img { display: block; width: 100%; height: 100%; max-height: min(62dvh, 600px); object-fit: contain; }
.gallery-viewer-meta { margin: 13px 2px 18px; color: var(--muted); font-size: 11px; font-weight: 750; }
.gallery-viewer .result-actions { justify-content: flex-end; }

.game-screen { width: min(1180px, calc(100% - 28px)); height: 100dvh; min-height: 100dvh; overflow: hidden; padding-top: 20px; padding-bottom: 20px; }
.game-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; min-height: 65px; }
.game-header-actions { display: flex; align-items: center; justify-self: end; gap: 7px; }
.back-button { display: inline-flex; align-items: center; justify-self: start; gap: 9px; min-height: 42px; padding: 0 13px; color: var(--ink-soft); background: rgba(255,255,255,.4); border: 1px solid rgba(255,255,255,.7); border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 800; box-shadow: 0 9px 22px rgba(38,52,71,.08); }
.back-button span:first-child { font-size: 20px; }
.game-title-block { text-align: center; }
.game-title-block .eyebrow { margin-bottom: 4px; }
.game-title-block h1 { margin: 0; font-size: 21px; letter-spacing: -.04em; }
.timer { display: inline-flex; align-items: center; justify-self: end; gap: 8px; min-height: 42px; padding: 0 14px; color: var(--ink); background: rgba(255,255,255,.48); border-radius: 999px; font-size: 17px; font-weight: 850; font-variant-numeric: tabular-nums; backdrop-filter: blur(17px); -webkit-backdrop-filter: blur(17px); }
.timer-icon { color: var(--coral); font-size: 21px; }
.timer.is-danger { color: var(--coral-dark); background: rgba(211,109,91,.17); animation: timer-shake .48s ease both; }
.timer.is-paused { color: var(--ink-soft); background: rgba(120,167,197,.17); }
.pause-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 44px; min-height: 42px; padding: 0 12px; color: var(--ink-soft); background: rgba(255,255,255,.42); border: 1px solid rgba(255,255,255,.7); border-radius: 999px; box-shadow: 0 9px 22px rgba(38,52,71,.08); cursor: pointer; font-size: 11px; font-weight: 850; line-height: 1; white-space: nowrap; transition: transform .2s var(--ease), background .2s ease; }
.pause-button:hover { background: rgba(255,255,255,.76); transform: translateY(-2px); }
.pause-symbol { position: relative; display: inline-block; flex: 0 0 14px; width: 14px; height: 16px; color: var(--coral-dark); font-size: 0; line-height: 0; letter-spacing: 0; transform: none; }
.pause-symbol::before, .pause-symbol::after { position: absolute; top: 1px; width: 4px; height: 14px; content: ""; background: currentColor; border-radius: 3px; }
.pause-symbol::before { left: 1px; }
.pause-symbol::after { right: 1px; }
.pause-button > span:last-child { line-height: 1; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 285px; gap: clamp(22px, 4vw, 58px); align-items: center; min-height: calc(100dvh - 110px); }
.board-column { min-width: 0; }
.board-caption { display: flex; justify-content: space-between; gap: 15px; margin: 0 auto 10px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.move-count { color: var(--muted); }
.move-count b { color: var(--ink); }
.board-frame { position: relative; width: min(72vh, 620px); max-width: 100%; margin: 0 auto; padding: 10px; background: rgba(255,255,255,.35); border-radius: 28px; backdrop-filter: blur(19px) saturate(130%); -webkit-backdrop-filter: blur(19px) saturate(130%); }
.board-surface { position: relative; width: 100%; overflow: hidden; isolation: isolate; touch-action: none; user-select: none; background: rgba(226,231,238,.68); border: 1px solid rgba(255,255,255,.74); border-radius: 19px; box-shadow: inset 0 1px 0 rgba(255,255,255,.45); }
.tile { position: absolute; z-index: 2; overflow: visible; padding: 0; background-repeat: no-repeat; border: 0; outline: 0; cursor: grab; touch-action: none; backface-visibility: hidden; transform: translate3d(0, 0, 0); will-change: transform; transition: transform .18s cubic-bezier(.2, .82, .25, 1), filter .18s ease; }
.tile:active, .tile.is-dragging { cursor: grabbing; }
.tile.is-dragging { z-index: 8; filter: saturate(1.08) brightness(1.04); transition: none; }
.tile.is-rejected { animation: rejected .25s ease both; }
.tile.is-merged { z-index: 3; }
.tile.is-merged.is-dragging { z-index: 20; }
.tile.is-flash { z-index: 5; animation: merge-pop .35s var(--ease) both; }
.tile::after { position: absolute; inset: 0; pointer-events: none; content: ""; background: linear-gradient(135deg, rgba(255,255,255,.13), transparent 36%, rgba(38,52,71,.05)); opacity: .55; }
.tile.is-merged::after { opacity: 0; }
.tile-outline { position: absolute; inset: 0; z-index: 2; box-sizing: border-box; pointer-events: none; border-style: solid; border-width: 0; border-color: rgba(255,255,255,.62); }
.tile-hint { position: absolute; inset: 5px; z-index: 3; pointer-events: none; border: 3px solid #e8b84a; border-radius: 8px; box-shadow: 0 0 18px rgba(232,184,74,.58); animation: hint-pulse .62s ease-in-out infinite alternate; }
.drop-layer, .hint-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.merge-layer { position: absolute; inset: 0; z-index: 12; pointer-events: none; overflow: visible; }
.drop-preview, .hint-target { position: absolute; border-radius: 7px; transition: left .12s ease, top .12s ease; }
.drop-preview { background: rgba(120,169,147,.2); border: 2px solid rgba(120,169,147,.65); }
.hint-target { background: rgba(232,184,74,.17); border: 3px solid rgba(232,184,74,.74); box-shadow: 0 0 18px rgba(232,184,74,.35); animation: hint-pulse .62s ease-in-out infinite alternate; }
.merge-burst { position: absolute; display: grid; place-items: center; border: 3px solid rgba(255,255,255,.92); border-radius: 13px; box-shadow: 0 0 0 5px rgba(211,109,91,.18), 0 0 28px rgba(211,109,91,.48), inset 0 0 20px rgba(255,255,255,.3); animation: merge-burst .58s var(--ease) both; }
.merge-burst::before { position: absolute; inset: -7px; content: ""; border: 2px solid rgba(211,109,91,.72); border-radius: inherit; animation: merge-ring .58s var(--ease) both; }
.merge-burst::after { position: absolute; width: 25%; height: 25%; content: ""; background: rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 0 20px 7px rgba(255,255,255,.6); animation: merge-core .58s var(--ease) both; }
.merge-burst i { position: absolute; width: 7px; height: 7px; background: #f5cc7b; border: 1px solid rgba(255,255,255,.85); border-radius: 50%; box-shadow: 0 0 9px rgba(245,204,123,.85); transform: translate(var(--dx), var(--dy)); animation: merge-spark .58s var(--ease) both; }
.board-tip { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 11px 0 0; color: var(--muted); font-size: 11px; font-weight: 700; }
.game-tools { display: flex; flex-direction: column; gap: 10px; }
.tool-button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 61px; padding: 9px 13px; overflow: hidden; text-align: left; background: rgba(255,255,255,.43); border-radius: 17px; cursor: pointer; backdrop-filter: blur(18px) saturate(125%); -webkit-backdrop-filter: blur(18px) saturate(125%); transition: transform .2s var(--ease), background .2s ease, box-shadow .2s ease; }
.tool-button:hover { background: rgba(255,255,255,.7); transform: translateX(3px); }
.tool-button--accent { background: linear-gradient(135deg, rgba(211,109,91,.86), rgba(196,88,74,.78)); color: #fff; }
.tool-button--accent:hover { background: linear-gradient(135deg, rgba(220,122,103,.94), rgba(196,88,74,.88)); }
.tool-symbol { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; color: var(--coral-dark); background: rgba(255,255,255,.56); border-radius: 11px; font-size: 21px; }
.tool-button--accent .tool-symbol { color: var(--coral-dark); }
.tool-button b, .tool-button small { position: relative; z-index: 1; display: block; }
.tool-button b { margin-bottom: 3px; font-size: 13px; }
.tool-button small { color: var(--muted); font-size: 10px; font-weight: 700; }
.tool-button--accent small { color: rgba(255,255,255,.76); }
.game-tool-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; }
.sound-button { display: inline-flex; align-items: center; gap: 6px; min-height: 33px; padding: 0 10px; color: var(--ink-soft); background: rgba(255,255,255,.36); border: 1px solid rgba(255,255,255,.65); border-radius: 999px; cursor: pointer; font-size: 11px; font-weight: 800; }
.game-header-actions .sound-button { min-height: 42px; padding: 0 11px; color: var(--ink-soft); background: rgba(255,255,255,.42); box-shadow: 0 9px 22px rgba(38,52,71,.08); white-space: nowrap; }
.game-header-actions .sound-button:hover { background: rgba(255,255,255,.76); transform: translateY(-2px); }
.privacy-note { color: var(--muted); font-size: 9px; text-align: right; }
.privacy-entry { margin: 18px 0 0; color: var(--muted); text-align: center; font-size: 10px; }
.privacy-entry a, .privacy-actions a, .privacy-dialog-note a { color: var(--coral-dark); text-decoration: underline; text-decoration-color: rgba(184,86,71,.36); text-underline-offset: 3px; }
.privacy-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 10px; }
.privacy-delete-button { padding: 0; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: 10px; }
.privacy-delete-button:hover { color: var(--coral-dark); text-decoration: underline; text-underline-offset: 3px; }
.privacy-dialog-note { margin-top: 9px !important; font-size: 10px !important; }

.toast { position: fixed; right: 20px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 50; max-width: min(340px, calc(100% - 40px)); padding: 12px 16px; color: #fff; background: rgba(38,52,71,.9); border: 1px solid rgba(255,255,255,.2); border-radius: 14px; box-shadow: 0 12px 30px rgba(38,52,71,.23); font-size: 12px; font-weight: 750; animation: toast-in .25s var(--ease) both; backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); }
body.is-playing .toast { bottom: 22px; }
.dialog-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); background: rgba(38,52,71,.28); overscroll-behavior: contain; backdrop-filter: blur(11px); -webkit-backdrop-filter: blur(11px); }
.result-dialog, .confirm-dialog, .pause-dialog { position: relative; width: min(440px, 100%); padding: 35px 28px 27px; text-align: center; background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(255,255,255,.55)); border-radius: 27px; backdrop-filter: blur(25px) saturate(140%); -webkit-backdrop-filter: blur(25px) saturate(140%); animation: dialog-in .3s var(--ease) both; }
.confirm-dialog { text-align: left; }
.confirm-dialog .result-actions { justify-content: flex-end; }
.result-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 18px; color: #fff; background: linear-gradient(135deg, var(--coral), var(--sky)); border-radius: 20px; box-shadow: 0 12px 22px rgba(211,109,91,.25); font-size: 28px; }
.is-failure .result-icon { background: linear-gradient(135deg, #8b98a8, #667588); }
.result-dialog > :not(.result-dialog::before), .confirm-dialog > :not(.confirm-dialog::before), .pause-dialog > :not(.pause-dialog::before) { position: relative; z-index: 1; }
.result-dialog h2, .confirm-dialog h2, .pause-dialog h2 { font-size: 31px; }
.result-dialog p:not(.eyebrow), .confirm-dialog p:not(.eyebrow), .pause-dialog p:not(.eyebrow) { color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
.pause-icon { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 7px; width: 62px; height: 62px; margin: 0 auto 18px; background: linear-gradient(135deg, var(--sky), #5d8eaf); border-radius: 20px; box-shadow: 0 12px 22px rgba(93,142,175,.25); }
.pause-icon span { width: 7px; height: 25px; background: #fff; border-radius: 999px; box-shadow: inset 0 1px 0 rgba(255,255,255,.55); }
.pause-time { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 24px; padding: 12px 15px; color: var(--ink-soft); background: rgba(255,255,255,.42); border: 1px solid rgba(255,255,255,.7); border-radius: 15px; font-size: 11px; font-weight: 800; }
.pause-time b { color: var(--ink); font-size: 19px; font-variant-numeric: tabular-nums; }
.result-art { width: min(100%, 280px); margin: 0 auto 14px; overflow: hidden; border-radius: 18px; box-shadow: 0 14px 28px rgba(38,52,71,.16); }
.result-art img { display: block; width: 100%; max-height: 38dvh; object-fit: cover; }
.result-save { margin: 0 auto 8px; }
.coach-overlay { position: absolute; z-index: 24; inset: 10px; display: flex; align-items: flex-end; border-radius: 19px; pointer-events: none; }
.coach-bar { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; pointer-events: auto; background: rgba(255,252,246,.94); border: 1px solid rgba(255,255,255,.86); border-radius: 16px; box-shadow: 0 12px 28px rgba(38,52,71,.18); }
.coach-line { flex: 1; min-width: 0; margin: 0; color: var(--ink); font-size: 12px; line-height: 1.35; }
.coach-line span:first-child { display: block; margin-bottom: 2px; color: var(--coral-dark); font-size: 10px; font-weight: 850; letter-spacing: .04em; }
.coach-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.coach-actions .quiet-button, .coach-actions .primary-button { min-height: 34px; padding: 0 12px; font-size: 12px; }
.board-frame.is-coaching .tile { filter: brightness(.58) saturate(.85); }
.board-frame.is-coaching .tile.is-coach-focus { z-index: 7; filter: none; box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(211,109,91,.92); }
body.is-coaching .board-tip { visibility: hidden; }
.result-stats { display: flex; justify-content: center; gap: 42px; margin: 25px 0 27px; }
.result-stats span { display: grid; gap: 3px; }
.result-stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.result-stats small { color: var(--muted); font-size: 10px; font-weight: 750; }
.result-actions { display: flex; align-items: center; justify-content: center; gap: 10px; }
.progress-code-dialog {
  position: relative;
  width: min(410px, 100%);
  max-height: min(640px, calc(100dvh - 24px));
  overflow-y: auto;
  padding: 20px;
  text-align: left;
  background: rgba(250, 248, 243, .94);
  border: 1px solid rgba(255,255,255,.94);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(38,52,71,.22), 0 2px 0 rgba(255,255,255,.75) inset;
  scrollbar-width: thin;
  scrollbar-color: rgba(38,52,71,.2) transparent;
  animation: dialog-in .3s var(--ease) both;
}
.progress-code-dialog > * { position: relative; z-index: 1; }
.progress-code-close { position: absolute; top: 12px; right: 12px; z-index: 2 !important; }
.progress-code-head { display: flex; align-items: center; gap: 11px; padding-right: 34px; }
.progress-code-icon { display: grid; flex: 0 0 auto; place-items: center; width: 44px; height: 44px; color: #fff; background: linear-gradient(135deg, var(--sky), #5d8eaf); border-radius: 14px; box-shadow: 0 9px 18px rgba(93,142,175,.22); font-size: 24px; }
.progress-code-heading .eyebrow { margin: 0 0 4px; font-size: 9px; letter-spacing: .18em; }
.progress-code-dialog h2 { margin: 0; font-size: 24px; line-height: 1.12; }
.progress-code-copy, .progress-code-hint { color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.progress-code-copy { margin: 15px 0 12px; }
.progress-code-display { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 4px; padding: 11px 11px 11px 13px; background: #fff; border: 1px solid rgba(38,52,71,.08); border-radius: 16px; box-shadow: 0 7px 20px rgba(38,52,71,.06); }
.progress-code-value { display: grid; min-width: 0; gap: 4px; }
.progress-code-value > span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.progress-code-display strong { overflow: hidden; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 16px; letter-spacing: .1em; text-overflow: ellipsis; white-space: nowrap; }
.progress-code-display .quiet-button { min-height: 34px; flex: 0 0 auto; gap: 5px; padding: 0 12px; font-size: 11px; }
.progress-code-status { min-height: 15px; margin: 0; color: var(--mint); font-size: 10px; font-weight: 750; text-align: right; }
.progress-code-divider { display: flex; align-items: center; gap: 9px; margin: 14px 0 10px; color: var(--muted); font-size: 10px; font-weight: 800; }
.progress-code-divider::before, .progress-code-divider::after { flex: 1; height: 1px; content: ""; background: var(--line); }
.progress-code-restore-panel { padding: 11px; background: rgba(238,244,246,.76); border: 1px solid rgba(120,167,197,.16); border-radius: 16px; }
.progress-code-input { display: grid; gap: 6px; text-align: left; color: var(--ink-soft); font-size: 10px; font-weight: 800; }
.progress-code-input input { width: 100%; min-height: 42px; padding: 0 12px; color: var(--ink); background: #fff; border: 1px solid rgba(38,52,71,.11); border-radius: 12px; outline: none; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.progress-code-input input:focus { border-color: rgba(211,109,91,.62); box-shadow: 0 0 0 4px rgba(211,109,91,.12); }
.progress-code-restore { width: 100%; min-height: 42px; margin-top: 9px; }
.progress-code-hint { margin: 10px 2px 0; color: var(--muted); font-size: 10px; }
.location-preference { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; padding: 11px 12px; background: rgba(255,255,255,.42); border: 1px solid rgba(120,167,197,.18); border-radius: 15px; }
.location-preference-copy { display: grid; min-width: 0; gap: 3px; }
.location-preference-copy > span { color: var(--coral-dark); font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.location-preference-copy strong { color: var(--ink); font-size: 11px; }
.location-preference-copy small { color: var(--muted); font-size: 9px; }
.location-preference .quiet-button { min-width: 64px; min-height: 36px; flex: 0 0 auto; padding: 0 14px; font-size: 12px; touch-action: manipulation; }
.location-preference-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.location-preference-actions .location-disable-button { color: var(--coral-dark); }
.location-offer { display: block; margin: 15px auto 0; padding: 0; color: var(--coral-dark); background: transparent; border: 0; cursor: pointer; font-size: 10px; font-weight: 800; text-decoration: underline; text-decoration-color: rgba(184,86,71,.34); text-underline-offset: 3px; }
.location-offer:hover { color: var(--ink); }

/* First-entry privacy gate */
body.is-privacy-consent, body.is-privacy-blocked { overflow: hidden; }
.privacy-consent-backdrop { z-index: 110; background: rgba(38,52,71,.34); }
.privacy-consent-dialog { position: relative; width: min(468px, 100%); max-height: calc(100dvh - 28px); overflow: auto; padding: 29px clamp(22px, 5vw, 38px) 25px; background: linear-gradient(145deg, rgba(255,253,248,.94), rgba(255,255,255,.73)); border-radius: 29px; backdrop-filter: blur(28px) saturate(140%); -webkit-backdrop-filter: blur(28px) saturate(140%); animation: dialog-in .32s var(--ease) both; }
.privacy-consent-mark { display: grid; grid-template-columns: repeat(2, 13px); gap: 3px; width: 37px; height: 37px; margin-bottom: 22px; padding: 5px; background: var(--ink); border-radius: 11px; box-shadow: 0 8px 18px rgba(38,52,71,.2); transform: rotate(-6deg); }
.privacy-consent-mark span { border-radius: 3px; background: var(--paper-light); }.privacy-consent-mark span:nth-child(2) { background: var(--coral); }.privacy-consent-mark span:nth-child(3) { background: var(--sky); }.privacy-consent-mark span:nth-child(4) { background: #f5cc7b; }
.privacy-consent-dialog .eyebrow, .privacy-exit-card .eyebrow { margin-bottom: 9px; }
.privacy-consent-dialog h1, .privacy-exit-card h1 { margin: 0 0 13px; font-size: clamp(32px, 7vw, 47px); line-height: .99; letter-spacing: -.06em; }
.privacy-consent-copy, .privacy-exit-card > p:not(.eyebrow) { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.75; }
.privacy-consent-points { display: grid; gap: 8px; margin: 21px 0 17px; }
.privacy-consent-points > div { display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 11px; background: rgba(255,255,255,.47); border: 1px solid rgba(38,52,71,.08); border-radius: 14px; }
.privacy-consent-points > div > span { display: grid; place-items: center; width: 29px; height: 29px; color: var(--coral-dark); background: rgba(211,109,91,.12); border-radius: 9px; font-family: ui-monospace, monospace; font-size: 9px; font-weight: 900; }
.privacy-consent-points p { display: grid; gap: 2px; margin: 0; }
.privacy-consent-points strong { color: var(--ink); font-size: 11px; }
.privacy-consent-points small { color: var(--muted); font-size: 10px; line-height: 1.55; }
.privacy-consent-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.privacy-consent-note a { color: var(--coral-dark); font-weight: 800; text-decoration: underline; text-decoration-color: rgba(184,86,71,.36); text-underline-offset: 3px; }
.privacy-consent-actions, .privacy-exit-actions { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 10px; margin-top: 22px; }
.privacy-consent-actions button, .privacy-exit-actions button { width: 100%; min-height: 46px; border-radius: 13px; }
.privacy-exit-screen { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; min-height: 100dvh; padding: 18px; background: var(--paper); background-image: radial-gradient(circle at 14% -10%, rgba(120,167,197,.23), transparent 32rem), radial-gradient(circle at 100% 22%, rgba(211,109,91,.13), transparent 28rem); }
.privacy-exit-card { width: min(430px, 100%); padding: 30px clamp(22px, 5vw, 36px) 27px; background: linear-gradient(145deg, rgba(255,253,248,.9), rgba(255,255,255,.65)); border-radius: 27px; backdrop-filter: blur(25px) saturate(140%); -webkit-backdrop-filter: blur(25px) saturate(140%); animation: dialog-in .3s var(--ease) both; }
.privacy-exit-card .privacy-consent-mark { margin-bottom: 22px; }
.privacy-exit-actions { margin-top: 24px; }

/* Group entry */
body.is-group-selecting { min-height: 100dvh; overflow: hidden; }
.group-gate { display: grid; min-height: 100dvh; place-items: center; padding: 24px; background: radial-gradient(circle at 12% 12%, rgba(120, 167, 197, .18), transparent 24rem), radial-gradient(circle at 90% 80%, rgba(211, 109, 91, .14), transparent 24rem); }
.group-gate-card { width: min(520px, 100%); padding: clamp(26px, 5vw, 44px); background: rgba(255, 253, 248, .78); border: 1px solid rgba(255, 255, 255, .82); border-radius: var(--radius-lg); box-shadow: var(--glass-shadow), 0 25px 70px rgba(38, 52, 71, .12); backdrop-filter: blur(18px) saturate(125%); -webkit-backdrop-filter: blur(18px) saturate(125%); animation: dialog-in .28s var(--ease); }
.group-gate-mark { display: grid; grid-template-columns: repeat(2, 14px); gap: 4px; width: 40px; height: 40px; margin-bottom: 25px; padding: 5px; background: var(--ink); border-radius: 12px; box-shadow: 0 8px 18px rgba(38, 52, 71, .2); transform: rotate(-6deg); }
.group-gate-mark span { border-radius: 3px; background: var(--paper-light); }.group-gate-mark span:nth-child(2) { background: var(--coral); }.group-gate-mark span:nth-child(3) { background: var(--sky); }.group-gate-mark span:nth-child(4) { background: #f5cc7b; }
.group-gate-card h1 { margin-bottom: 11px; font-size: clamp(32px, 7vw, 48px); }
.group-gate-copy { margin-bottom: 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.group-form { display: grid; gap: 10px; }
.group-code-field { display: grid; gap: 8px; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.group-code-field input { width: 100%; height: 48px; padding: 0 14px; color: var(--ink); background: rgba(255, 255, 255, .8); border: 1px solid var(--line); border-radius: 13px; outline: 0; font-size: 16px; letter-spacing: .12em; }
.group-code-field input:focus { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(211, 109, 91, .12); }
.group-submit { width: 100%; min-height: 48px; border-radius: 13px; }
.group-error { margin: 0; padding: 9px 11px; color: var(--coral-dark); background: rgba(211, 109, 91, .1); border-radius: 10px; font-size: 11px; line-height: 1.45; }
.group-gate-divider { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; color: var(--muted); font-size: 10px; }.group-gate-divider::before, .group-gate-divider::after { flex: 1; height: 1px; content: ''; background: var(--line); }
.group-options { display: grid; gap: 9px; }
.group-option { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; background: rgba(255, 255, 255, .46); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.group-option:hover { background: rgba(255, 255, 255, .82); border-color: rgba(211, 109, 91, .42); transform: translateY(-2px); }
.group-option-code { display: grid; width: 38px; height: 38px; place-items: center; color: #fff; background: linear-gradient(135deg, var(--coral), #e39a6a); border-radius: 11px; font-family: ui-monospace, monospace; font-size: 14px; font-weight: 800; }
.group-option strong, .group-option small { display: block; }.group-option strong { color: var(--ink); font-size: 13px; }.group-option small { overflow: hidden; margin-top: 3px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }.group-option-arrow { color: var(--coral); font-size: 20px; }
.group-switch-button { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 10px; color: var(--ink-soft); background: rgba(255, 255, 255, .42); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 11px; font-weight: 800; }
.group-switch-button:hover { background: rgba(255, 255, 255, .8); border-color: rgba(211, 109, 91, .38); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes rejected { 0%, 100% { transform: translate(0, 0); } 35% { transform: translate(-5px, 0); } 70% { transform: translate(5px, 0); } }
@keyframes merge-pop { 0% { filter: brightness(1); } 45% { filter: brightness(1.22) saturate(1.2); } 100% { filter: brightness(1); } }
@keyframes merge-burst { 0% { opacity: 0; transform: scale(.72); } 34% { opacity: 1; transform: scale(1.04); } 100% { opacity: 0; transform: scale(1.12); } }
@keyframes merge-ring { 0% { opacity: 0; transform: scale(.7); } 32% { opacity: 1; } 100% { opacity: 0; transform: scale(1.16); } }
@keyframes merge-core { 0% { opacity: 0; transform: scale(.2); } 28% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.4); } }
@keyframes merge-spark { 0% { opacity: 0; transform: translate(0,0) scale(.4); } 34% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(var(--dx) * 2.2), calc(var(--dy) * 2.2)) scale(1.1); } }
@keyframes hint-pulse { from { opacity: .5; transform: scale(.98); } to { opacity: 1; transform: scale(1.02); } }
@keyframes timer-shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

@media (max-width: 820px) {
  .hero-card { grid-template-columns: minmax(220px, .92fr) minmax(230px, 1.08fr); gap: 25px; }
  .levels-grid, .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-layout { grid-template-columns: minmax(0, 1fr) 235px; gap: 20px; }
}
@media (max-width: 650px) {
  body.is-app-ready:not(.is-playing) { overflow: hidden; }
  body.is-app-ready:not(.is-playing) .app-shell { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; }
  body.is-app-ready:not(.is-playing) main { min-height: 0; flex: 1 1 auto; overflow: hidden; }
  .site-header { width: calc(100% - 24px); min-height: 62px; padding: 8px 0; gap: 6px; }
  .brand { gap: 8px; min-width: 0; }
  .brand-mark { width: 27px; height: 27px; grid-template-columns: repeat(2, 12px); }
  .brand b { font-size: 10px; letter-spacing: .13em; }
  .brand small { max-width: 115px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .header-actions { gap: 4px; min-width: 0; }
  .group-switch-button { min-height: 31px; max-width: 66px; padding: 0 7px; font-size: 10px; }
  .progress-code-button { width: 34px; min-height: 34px; justify-content: center; padding: 0; }
  .progress-code-button > span:last-child { display: none; }
  .sync-pill { width: 32px; max-width: 32px; min-height: 32px; justify-content: center; padding: 0; }
  .sync-pill #sync-label { display: none; }
  .sync-pill .status-dot { flex: 0 0 auto; }
  .sync-pill[data-state="loading"], .sync-pill[data-state="offline"] { width: auto; max-width: none; gap: 5px; padding: 0 8px; }
  .sync-pill[data-state="loading"] #sync-label-short, .sync-pill[data-state="offline"] #sync-label-short { display: inline; font-size: 10px; font-weight: 800; white-space: nowrap; }
  .icon-button { width: 32px; height: 32px; }
  .icon-button span { font-size: 19px; }
  .screen { display: flex; flex-direction: column; width: calc(100% - 24px); height: 100%; min-height: 0; padding-top: 12px; padding-bottom: calc(76px + env(safe-area-inset-bottom)); overflow: hidden; }
  .home-intro, .section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .home-intro > div, .section-heading > div { min-width: 0; }
  .eyebrow { margin-bottom: 5px; font-size: 9px; letter-spacing: .13em; }
  h1 { margin-bottom: 5px; font-size: 31px; }
  .lede { overflow: hidden; max-width: 100%; font-size: 11px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
  .home-intro .lede { display: -webkit-box; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .home-screen .hero-card { flex: 0 1 auto; align-items: center; grid-template-columns: minmax(0, .5fr) minmax(0, .5fr); gap: 12px; padding: 12px; }
  .home-screen .hero-art-wrap { width: 100%; max-height: none; margin: 0; }
  .home-screen .hero-art { width: 100%; height: auto; max-height: 48dvh; border-radius: 15px; }
  .hero-copy { min-width: 0; padding: 0 2px 0 0; }
  .level-kicker { gap: 6px; margin-bottom: 10px; font-size: 10px; }
  .level-badge { width: 27px; height: 27px; border-radius: 9px; font-size: 10px; }
  .kicker-line { flex-basis: 28px; }
  .hero-copy h2 { max-width: none; margin-bottom: 7px; font-size: clamp(22px, 7vw, 30px); }
  .hero-copy > p { display: -webkit-box; overflow: hidden; margin-bottom: 12px; font-size: 11px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .hero-meta { gap: 14px; margin-bottom: 14px; }
  .hero-meta b { font-size: 15px; }
  .hero-meta small { font-size: 9px; }
  .hero-copy > .primary-button { width: 100%; min-height: 36px; padding: 0 9px; font-size: 10px; }
  .progress-strip { grid-template-columns: auto minmax(48px, 1fr) auto; gap: 8px; flex: 0 0 auto; margin-top: 10px; padding: 9px 11px; }
  .progress-strip > div:first-child { gap: 5px; }
  .progress-label, .progress-note { font-size: 9px; }
  .progress-strip strong { font-size: 14px; }
  .progress-track { height: 6px; }
  .progress-note { max-width: 84px; line-height: 1.25; white-space: normal; }
  .levels-screen, .gallery-screen { padding-top: 12px; }
  .levels-screen .section-heading, .gallery-screen .section-heading { flex: 0 0 auto; }
  .section-heading .lede { max-width: none; }
  .levels-grid, .gallery-grid { flex: 1 1 auto; min-height: 0; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .levels-screen .lock-mark { width: 44px; height: 44px; border-radius: 15px; }
  .level-card { min-height: 0; padding: 6px; border-radius: 14px; }
  .album-art { min-height: 0; border-radius: 10px; }
  .level-card-copy { min-height: 0; padding: 7px 2px 1px; }
  .level-card-copy h2 { margin-bottom: 3px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
  .level-card-copy p { display: none; }
  .level-card-footer { display: block; }
  .level-card-meta { display: block; margin-bottom: 5px; font-size: 9px; }
  .level-card-action { width: 100%; min-height: 29px; padding: 0 5px; font-size: 9px; }
  .album-tag { top: 6px; left: 6px; padding: 4px 6px; font-size: 8px; }
  .pagination { flex: 0 0 auto; margin: 8px auto 0; padding: 4px; }
  .pagination-button { min-height: 31px; padding: 0 8px; font-size: 9px; }
  .pagination-status { min-width: 39px; font-size: 9px; }
  .pagination-status b { font-size: 12px; }
  .gallery-card { border-radius: 17px; }
  .gallery-card-copy { display: block; padding: 11px 10px 12px; }
  .gallery-card-copy h2 { font-size: 15px; }
  .gallery-card-meta { display: block; margin-top: 8px; text-align: left; }
  .gallery-view-label { right: 8px; bottom: 8px; padding: 6px 8px; font-size: 9px; }
  .gallery-viewer { padding: 16px; border-radius: 22px; }
  .gallery-viewer-art, .gallery-viewer-art img { max-height: 58dvh; }
  .gallery-viewer .result-actions { flex-wrap: wrap; }
  .gallery-viewer .result-actions > * { flex: 1 1 130px; }
  .progress-code-dialog { max-height: calc(100dvh - 20px); padding: 16px; border-radius: 20px; }
  .progress-code-head { gap: 9px; }
  .progress-code-icon { width: 40px; height: 40px; border-radius: 12px; font-size: 22px; }
  .progress-code-heading .eyebrow { font-size: 8px; }
  .progress-code-dialog h2 { font-size: 22px; }
  .progress-code-copy { margin: 12px 0 10px; font-size: 10px; }
  .progress-code-display { padding: 10px; }
  .progress-code-display strong { font-size: 14px; letter-spacing: .08em; }
  .progress-code-restore-panel { padding: 10px; }
  .level-card { padding: 8px; border-radius: 17px; }
  .album-art { border-radius: 12px; }
  .level-card-copy { padding: 11px 3px 3px; }
  .level-card-copy h2 { font-size: 16px; }
  .level-card-copy p { margin-bottom: 9px; font-size: 10px; }
  .level-card-footer { display: block; }
  .level-card-meta { display: block; margin-bottom: 8px; }
  .level-card-action { width: 100%; }
  .bottom-tabs { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 24px); gap: 3px; padding: 4px; }
  .bottom-tabs .tab-button { flex: 1 1 0; justify-content: center; min-width: 0; min-height: 41px; padding: 0 8px; font-size: 11px; }

  body.is-playing .site-header { display: none; }
  .game-screen { display: flex; flex-direction: column; width: 100%; height: 100dvh; min-height: 0; max-height: 100dvh; overflow: hidden; padding: max(12px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom)); }
  .game-header { flex: 0 0 auto; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; min-height: 0; }
  .game-title-block { min-width: 0; }
  .game-title-block .eyebrow, .game-title-block h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .game-header-actions { gap: 5px; }
  .game-header-actions .sound-button { min-height: 37px; padding: 0 8px; font-size: 10px; }
  .pause-button { width: 40px; min-width: 40px; min-height: 40px; padding: 0; gap: 0; border-radius: 50%; font-size: 10px; }
  .pause-button span:last-child { display: none; }
  .back-button { min-height: 37px; padding: 0 9px; font-size: 11px; }
  .back-button span:last-child { display: none; }
  .timer { min-height: 37px; padding: 0 11px; font-size: 15px; }
  .timer-icon { font-size: 18px; }
  .game-layout { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; flex: 1 1 auto; gap: 9px; min-height: 0; }
  .board-column { display: flex; flex-direction: column; align-items: center; width: 100%; flex: 1 1 auto; min-height: 0; }
  .board-caption { flex: 0 0 auto; width: min(100%, 520px); }
  .board-frame { display: flex; align-items: center; justify-content: center; flex: 1 1 auto; width: min(100%, 520px); min-height: 0; max-height: 100%; padding: 7px; overflow: hidden; border-radius: 22px; }
  .board-surface { width: 100%; max-width: 100%; max-height: 100%; height: auto; min-width: 0; min-height: 0; border-radius: 15px; }
  .board-tip { flex: 0 0 auto; width: min(100%, 520px); margin-top: 7px; font-size: 10px; }
  .coach-overlay { inset: 7px; }
  .coach-bar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .coach-actions { width: 100%; }
  .coach-actions .quiet-button, .coach-actions .primary-button { flex: 1; }
  .game-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); flex: 0 0 auto; align-self: center; width: min(100%, 520px); gap: 7px; }
  .tool-button { flex-direction: column; justify-content: center; gap: 4px; min-height: 62px; padding: 6px 2px; text-align: center; border-radius: 15px; }
  .tool-button:hover { transform: translateY(-2px); }
  .tool-symbol { width: 27px; height: 27px; border-radius: 9px; font-size: 17px; }
  .tool-button b { margin: 0; font-size: 10px; }
  .tool-button small { display: none; }
  .game-tool-footer { grid-column: 1 / -1; width: 100%; margin-top: 0; }
  .sound-button { min-height: 28px; font-size: 10px; }
  .privacy-note { font-size: 9px; }
}
@media (max-height: 650px) and (max-width: 650px) {
  .game-layout { gap: 4px; }
  .board-caption { margin-bottom: 4px; }
  .board-tip { display: none; }
  .tool-button { min-height: 50px; }
}

/* Resume choice and independent audio controls */
.resume-dialog { position: relative; width: min(440px, 100%); padding: 35px 28px 27px; text-align: center; background: linear-gradient(135deg, rgba(255,255,255,.86), rgba(255,255,255,.58)); border: 1px solid rgba(255,255,255,.76); border-radius: 27px; box-shadow: var(--glass-shadow); backdrop-filter: blur(25px) saturate(140%); -webkit-backdrop-filter: blur(25px) saturate(140%); animation: dialog-in .3s var(--ease) both; }
.resume-dialog h2 { font-size: 29px; }
.resume-dialog p:not(.eyebrow) { color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
.resume-icon { margin-bottom: 18px; }
.resume-actions { flex-wrap: wrap; }
.resume-actions .primary-button { min-width: 118px; }
.pause-audio-settings { display: grid; gap: 10px; margin: 18px 0 22px; padding: 13px 14px; text-align: left; background: rgba(255,255,255,.38); border: 1px solid rgba(255,255,255,.7); border-radius: 17px; }
.pause-audio-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.pause-audio-row strong, .volume-control strong { display: block; color: var(--ink); font-size: 12px; }
.pause-audio-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.setting-toggle { position: relative; width: 42px; height: 25px; padding: 3px; flex: 0 0 auto; background: rgba(38,52,71,.2); border: 0; border-radius: 999px; cursor: pointer; transition: background .2s ease; }
.setting-toggle span { display: block; width: 19px; height: 19px; background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(38,52,71,.2); transition: transform .2s var(--ease); }
.setting-toggle.is-on { background: var(--coral); }
.setting-toggle.is-on span { transform: translateX(17px); }
.volume-control { display: grid; gap: 8px; padding: 4px 0 3px; }
.volume-control > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.volume-control output { color: var(--coral-dark); font-size: 11px; font-weight: 800; }
.volume-control input { width: 100%; accent-color: var(--coral); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 650px) {
  .group-gate { padding: 14px; }
  .group-gate-card { padding: 27px 20px 22px; border-radius: 22px; }
  .group-gate-card h1 { font-size: 34px; }
  .group-option { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 9px; padding: 9px; }
  .group-option-code { width: 34px; height: 34px; border-radius: 10px; }
  .group-option-arrow { font-size: 18px; }
  .group-switch-button { max-width: 95px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
