:root {
  color-scheme: light;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: #17363a;
  background: #f4f1e9;
  font-synthesis: none;
  --teal: #126e73;
  --teal-dark: #0a4e53;
  --paper: rgba(255, 255, 255, 0.94);
  --line: rgba(18, 71, 76, 0.14);
  --shadow: 0 16px 44px rgba(29, 57, 59, 0.16);
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: fixed;
  z-index: 20;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100% - 32px), 1120px);
  min-height: 72px;
  padding: 12px 14px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transform: translateX(-50%);
  background: var(--paper);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand, .top-actions { display: flex; align-items: center; }
.brand { gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 14px;
  background: radial-gradient(circle at 65% 32%, rgba(255,255,255,.7) 0 8%, transparent 9%), linear-gradient(145deg,#1f9894,#0b5962);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.26);
}
.brand h1, .brand p, .panel-heading h2 { margin: 0; }
.brand h1 { font-size: clamp(1rem,2vw,1.25rem); line-height: 1.25; letter-spacing: .04em; }
.brand p { margin-top: 3px; color: #668085; font-size: .75rem; }
.top-actions { gap: 8px; }

.button {
  min-height: 42px; padding: 0 16px; border: 0; border-radius: 13px;
  cursor: pointer; font-weight: 700; letter-spacing: .04em;
}
.button-primary { color: white; background: var(--teal); box-shadow: 0 8px 18px rgba(18,110,115,.24); }
.button-primary:hover { background: var(--teal-dark); }
.button-share { color: #fff; background: #d16d45; box-shadow: 0 8px 18px rgba(159,73,40,.2); }
.button-share:hover { background: #b85a36; }
.button-quiet { color: var(--teal-dark); background: #e7f2f0; }

.map-shell, #map { width: 100%; height: 100%; }
.map-shell { position: relative; }
#map { position: relative; overflow: hidden; touch-action: none; cursor: grab; background: #f4f1e9; }
#map.is-dragging { cursor: grabbing; }
#map:focus-visible { outline: 3px solid #eb9e57; outline-offset: -3px; }
.svg-stage { width: 100%; height: 100%; padding: 96px 0 18px; display: grid; }
.administrative-map { width: 100%; height: 100%; display: block; }
.administrative-map { user-select: none; -webkit-user-select: none; }
.admin-area { cursor: pointer; transition: filter 100ms ease; }
.admin-area:hover { filter: brightness(1.08) saturate(1.08); }
.administrative-map #layer12,
.administrative-map #layer19,
.administrative-map #layer18,
.administrative-map #layer-town-label-leaders,
.administrative-map #layer-county-labels,
.administrative-map #layer-taiwan-main-island-outline { pointer-events: none; }
.administrative-map .layer-hidden { display: none !important; }
.administrative-map .map-label,
.administrative-map .county-label { transform-box: fill-box; transform-origin: center; }
.administrative-map .label-collision-hidden { display: none; }

.puzzle-discovery {
  position: absolute; z-index: 16; top: 108px; left: 50%;
  padding: 9px 14px 9px 10px; display: flex; align-items: center; gap: 9px;
  pointer-events: none; transform: translateX(-50%);
  color: #17363a; background: rgba(255,255,255,.94); border: 1px solid rgba(255,255,255,.9);
  border-radius: 999px; box-shadow: 0 9px 26px rgba(29,57,59,.13); backdrop-filter: blur(15px);
  white-space: nowrap;
}
.puzzle-discovery-icon {
  width: 32px; height: 32px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg,#d97950,#b85835);
  border-radius: 11px; font-size: .78rem; font-weight: 900;
}
.puzzle-discovery > span:last-child { display: grid; gap: 1px; }
.puzzle-discovery strong { font-size: .78rem; }
.puzzle-discovery small { color: #668085; font-size: .66rem; font-weight: 700; }
.puzzle-mode .puzzle-discovery { display: none; }

.map-message {
  position: absolute; z-index: 12; top: 50%; left: 50%; width: min(calc(100% - 40px),340px);
  padding: 28px; display: grid; justify-items: center; gap: 10px; transform: translate(-50%,-50%);
  text-align: center; background: var(--paper); border: 1px solid white; border-radius: 22px; box-shadow: var(--shadow);
}
.map-message[hidden] { display: none; }
.map-message strong { font-size: 1.1rem; }
.map-message span { color: #668085; font-size: .86rem; line-height: 1.6; }
.spinner { width: 30px; height: 30px; border: 3px solid #d7e8e5; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.layer-panel {
  position: absolute; z-index: 18; top: 104px; right: max(16px,calc((100% - 1120px)/2));
  width: min(calc(100% - 32px),350px); padding: 20px; visibility: hidden; opacity: 0;
  transform: translateY(-8px) scale(.98); transform-origin: top right; transition: 160ms ease;
  background: var(--paper); border: 1px solid white; border-radius: 20px; box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.layer-panel.is-open { visibility: visible; opacity: 1; transform: none; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.eyebrow { display: block; margin-bottom: 5px; color: #778e91; font-size: .68rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.panel-heading h2 { font-size: 1.15rem; }
.icon-button {
  width: 36px; height: 36px; padding: 0; display: grid; place-items: center; color: #536f73;
  background: #edf3f1; border: 0; border-radius: 50%; cursor: pointer; font-size: 1.35rem; line-height: 1;
}
.layer-list { margin-top: 14px; border-top: 1px solid var(--line); }
.layer-row { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.layer-row span { display: grid; gap: 3px; }
.layer-row strong { font-size: .91rem; }
.layer-row small { color: #758c90; font-size: .72rem; }
.layer-row input { width: 42px; height: 24px; appearance: none; flex: 0 0 auto; background: #cbd8d7; border-radius: 999px; cursor: pointer; transition: 160ms ease; }
.layer-row input::after { content: ""; width: 18px; height: 18px; margin: 3px; display: block; background: white; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: 160ms ease; }
.layer-row input:checked { background: var(--teal); }
.layer-row input:checked::after { transform: translateX(18px); }
.layer-row input:focus-visible { outline: 3px solid #eb9e57; outline-offset: 2px; }
.privacy-note { margin: 14px 0 0; color: #7a9093; font-size: .7rem; line-height: 1.5; }

.place-card {
  position: absolute; z-index: 15; left: 50%; bottom: max(24px,env(safe-area-inset-bottom));
  width: min(calc(100% - 32px),360px); padding: 18px 54px 18px 20px; transform: translateX(-50%);
  background: var(--paper); border: 1px solid white; border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.place-card[hidden] { display: none; }
.place-card strong, .place-card > span:not(.eyebrow) { display: block; }
.place-card strong { font-size: 1.08rem; }
.place-card > span:not(.eyebrow) { margin-top: 3px; color: #637d81; }
.place-card .icon-button { position: absolute; top: 14px; right: 14px; }

.install-guide {
  position: absolute; z-index: 17; left: 50%; bottom: max(20px,env(safe-area-inset-bottom));
  width: min(calc(100% - 120px),540px); padding: 19px 54px 18px 20px; transform: translateX(-50%);
  background: var(--paper); border: 1px solid white; border-radius: 20px; box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.install-guide[hidden] { display: none; }
.install-guide > strong { display: block; font-size: 1rem; }
.install-guide p { margin: 6px 0 14px; color: #637d81; font-size: .84rem; line-height: 1.6; }
.install-guide .icon-button { position: absolute; top: 14px; right: 14px; }
.install-guide-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.install-guide-actions .button { min-height: 38px; font-size: .78rem; }

.map-controls {
  position: absolute; z-index: 14; right: max(16px,env(safe-area-inset-right));
  bottom: max(16px,env(safe-area-inset-bottom)); display: grid; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(29,57,59,.14);
}
.map-controls button {
  width: 44px; height: 42px; padding: 0; color: #274c50; background: rgba(255,255,255,.94);
  border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 1.2rem; font-weight: 700;
}
.map-controls button:last-child { border-bottom: 0; font-size: 1rem; }
.map-controls button:hover { background: #eaf3f1; }

.county-tooltip {
  position: fixed; z-index: 30; padding: 7px 10px; pointer-events: none;
  color: white; background: rgba(10,78,83,.94); border-radius: 9px;
  box-shadow: 0 7px 18px rgba(10,78,83,.2); font-size: .78rem; font-weight: 800;
  transform: translate(12px,12px); white-space: nowrap;
}
.county-tooltip[hidden] { display: none; }
.county-hit-target { cursor: pointer; outline: none; }
.county-hit-target path {
  fill: transparent; stroke: transparent; stroke-width: 18px;
  vector-effect: non-scaling-stroke; pointer-events: visiblePainted;
}
.county-hit-target:focus-visible path { fill: rgba(235,158,87,.3); stroke: rgba(235,158,87,.45); }

.puzzle-page {
  position: fixed; z-index: 40; inset: 0; overflow: hidden;
  color: #17363a; background: #f4f1e9;
}
.puzzle-page[hidden], .puzzle-game[hidden], .puzzle-stats[hidden],
.puzzle-intro[hidden], .puzzle-complete[hidden] { display: none; }
.puzzle-header {
  position: relative; z-index: 5; height: 86px; padding: 13px max(18px,calc((100% - 1320px)/2));
  display: grid; grid-template-columns: minmax(180px,1fr) auto minmax(300px,1fr);
  align-items: center; gap: 18px; background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line); box-shadow: 0 8px 30px rgba(29,57,59,.08);
  backdrop-filter: blur(18px);
}
.puzzle-header > .button { justify-self: start; }
.puzzle-heading { min-width: 0; text-align: center; }
.puzzle-heading .eyebrow { margin-bottom: 2px; }
.puzzle-heading h2 { margin: 0; font-size: clamp(1.15rem,2.2vw,1.55rem); white-space: nowrap; }
.puzzle-header-tools { justify-self: end; display: flex; align-items: center; gap: 9px; }
.puzzle-stats { display: flex; gap: 8px; }
.puzzle-game-share { min-width: 112px; }
.share-label-short { display: none; }
.puzzle-stats > span, .complete-results > span {
  min-width: 82px; padding: 8px 12px; display: grid; justify-items: center;
  background: #edf3f1; border: 1px solid rgba(18,71,76,.08); border-radius: 13px;
}
.puzzle-stats small, .complete-results small { color: #71888b; font-size: .64rem; font-weight: 800; }
.puzzle-stats strong, .complete-results strong { margin-top: 2px; font-size: .94rem; }

.puzzle-intro, .puzzle-complete {
  position: absolute; z-index: 4; top: 50%; left: 50%;
  width: min(calc(100% - 32px),520px); padding: 38px;
  transform: translate(-50%,-46%); text-align: center;
  background: rgba(255,255,255,.96); border: 1px solid white; border-radius: 28px;
  box-shadow: 0 22px 60px rgba(29,57,59,.16);
}
.puzzle-complete { width: min(calc(100% - 32px),600px); max-height: calc(100dvh - 118px); overflow: auto; }
.puzzle-intro::before, .puzzle-complete::before {
  content: ""; position: absolute; z-index: -1; inset: -30vh -40vw;
  background: radial-gradient(circle at center,rgba(141,211,199,.25),transparent 50%);
  pointer-events: none;
}
.puzzle-intro-mark, .puzzle-complete-mark {
  width: 72px; height: 72px; margin: 0 auto 18px; display: grid; place-items: center;
  color: white; background: linear-gradient(145deg,#1f9894,#0b5962);
  border-radius: 24px; box-shadow: 0 14px 30px rgba(18,110,115,.22);
  font-size: 1.75rem; font-weight: 900;
}
.puzzle-complete-mark { border-radius: 50%; }
.puzzle-intro h3, .puzzle-complete h3 { margin: 4px 0 8px; font-size: clamp(1.8rem,5vw,2.5rem); }
.puzzle-intro > p:not(.eyebrow) { margin: 0; color: #668085; }
.puzzle-intro-actions { margin-top: 26px; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.puzzle-intro-actions .button { min-width: 150px; }

.puzzle-game {
  height: calc(100dvh - 86px); padding: 18px max(18px,calc((100% - 1320px)/2));
  display: grid; grid-template-columns: minmax(0,2fr) minmax(310px,1fr); gap: 18px;
}
.puzzle-board-panel, .piece-tray {
  min-width: 0; min-height: 0; position: relative; overflow: hidden;
  background: rgba(255,255,255,.92); border: 1px solid white; border-radius: 22px;
  box-shadow: 0 12px 34px rgba(29,57,59,.1);
}
.puzzle-board-panel { z-index: 2; }
.puzzle-board-panel.is-dragging-piece { z-index: 8; overflow: visible; }
.puzzle-board-panel.is-dragging-piece .puzzle-board-viewport { overflow: visible; }
.puzzle-board-viewport { width: 100%; height: 100%; overflow: hidden; touch-action: none; }
.puzzle-board { width: 100%; height: 100%; display: block; overflow: visible; touch-action: none; }
.puzzle-gesture-hint { display: none; }
.puzzle-outline-piece {
  fill: #e2ece9; fill-opacity: .82; stroke: #89aaa7; stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
}
.puzzle-placed-piece {
  stroke: rgba(23,54,58,.5); stroke-width: 1.2; vector-effect: non-scaling-stroke;
}
.puzzle-placed-label { pointer-events: none; }
.puzzle-piece-label-text {
  fill: #17363a; stroke: rgba(255,255,255,.96); paint-order: stroke fill;
  font-weight: 900; letter-spacing: .02em;
}
.puzzle-piece-label-leader {
  stroke: rgba(23,54,58,.68); stroke-linecap: round; pointer-events: none;
}
.puzzle-piece-label-leader[hidden] { display: none; }
.puzzle-drag-piece {
  filter: drop-shadow(0 8px 9px rgba(23,54,58,.28));
  stroke: white; stroke-width: 1.7; vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.puzzle-board-controls {
  position: absolute; z-index: 5; right: 14px; bottom: 14px; display: grid; overflow: hidden;
  border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 8px 22px rgba(29,57,59,.14);
}
.puzzle-board-controls button {
  width: 42px; height: 39px; padding: 0; color: #274c50; background: rgba(255,255,255,.96);
  border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 1.1rem; font-weight: 800;
}
.puzzle-board-controls button:last-child { border-bottom: 0; font-size: .9rem; }

.piece-tray { padding: 18px 13px 13px 18px; display: flex; flex-direction: column; }
.piece-tray-heading { padding-right: 5px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.piece-tray-heading h3 { margin: 0; font-size: .94rem; }
.piece-tray-hint { color: #789094; font-size: .66rem; white-space: nowrap; }
.piece-grid {
  min-height: 0; margin-top: 13px; padding: 2px 5px 8px 0; overflow: auto;
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-auto-rows: 118px; gap: 10px;
  overscroll-behavior: contain;
}
.piece-card {
  min-width: 0; padding: 8px; display: grid; grid-template-rows: minmax(0,1fr) auto;
  color: #17363a; background: #f8faf8; border: 1px solid rgba(18,71,76,.12);
  border-radius: 14px; cursor: grab; touch-action: none; user-select: none;
  transition: border-color 120ms ease,box-shadow 120ms ease,opacity 120ms ease;
}
.piece-card:hover, .piece-card:focus-visible {
  border-color: rgba(18,110,115,.55); outline: none; box-shadow: 0 7px 18px rgba(18,71,76,.1);
}
.piece-card.is-dragging { opacity: .28; cursor: grabbing; }
.piece-preview { width: 100%; height: 100%; min-height: 0; display: block; overflow: visible; pointer-events: none; }
.piece-preview path { stroke: rgba(23,54,58,.5); stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.piece-name {
  display: block; overflow: hidden; color: #31585c; font-size: .72rem; font-weight: 800;
  text-align: center; text-overflow: ellipsis; white-space: nowrap;
}
.piece-card.is-placed { display: none; }
.puzzle-announcement { position: fixed; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.puzzle-review {
  position: absolute; z-index: 4; inset: 0; padding: 28px;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  text-align: center; background: rgba(248,250,248,.97); border-radius: inherit;
}
.puzzle-review[hidden] { display: none; }
.puzzle-review-mark {
  width: 58px; height: 58px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg,#1f9894,#0b5962);
  border-radius: 50%; box-shadow: 0 12px 26px rgba(18,110,115,.2);
  font-size: 1.4rem; font-weight: 900;
}
.puzzle-review h3 { margin: 2px 0 7px; font-size: 1.18rem; }
.puzzle-review p:last-child { margin: 0; color: #668085; font-size: .78rem; line-height: 1.55; }
.puzzle-review .button { min-width: 150px; }

.complete-results { margin: 24px auto 0; display: flex; justify-content: center; gap: 10px; }
.complete-results > span { min-width: 128px; padding: 13px 18px; }
.complete-results strong { font-size: 1.2rem; }
.score-submit-panel {
  margin: 20px auto 0; padding: 14px; text-align: left;
  background: #f3f7f5; border: 1px solid rgba(18,71,76,.09); border-radius: 16px;
}
.score-submit-panel h4 { margin: 0; font-size: .94rem; }
.score-submit-panel > p { margin: 4px 0 11px; color: #668085; font-size: .68rem; line-height: 1.45; }
.score-submit-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; }
.score-submit-row label { color: #557276; font-size: .72rem; font-weight: 800; }
.score-submit-row input {
  min-width: 0; height: 40px; padding: 0 11px; color: #17363a; background: #fff;
  border: 1px solid rgba(18,71,76,.18); border-radius: 11px; outline: none;
}
.score-submit-row input:focus { border-color: #126e73; box-shadow: 0 0 0 3px rgba(18,110,115,.12); }
.score-submit-row .button { min-height: 40px; padding: 0 12px; font-size: .72rem; }
.score-submit-status { min-height: 1.2em; margin: 8px 0 0; color: #31585c; font-size: .72rem; font-weight: 800; }

.leaderboard-panel {
  position: fixed; z-index: 60; inset: 0; padding: 20px;
  display: grid; place-items: center; background: rgba(15,42,45,.38); backdrop-filter: blur(8px);
}
.leaderboard-panel[hidden] { display: none; }
.leaderboard-card {
  width: min(100%,680px); max-height: min(720px,calc(100dvh - 40px)); padding: 22px;
  overflow: auto; background: #fff; border: 1px solid rgba(255,255,255,.9);
  border-radius: 22px; box-shadow: 0 24px 70px rgba(15,42,45,.25);
}
.leaderboard-card h3 { margin: 0; font-size: 1.25rem; }
.leaderboard-table-wrap { margin-top: 16px; overflow-x: auto; }
.leaderboard-table { width: 100%; border-collapse: collapse; font-size: .76rem; }
.leaderboard-table th, .leaderboard-table td { padding: 9px 7px; border-bottom: 1px solid #e4ece9; text-align: left; white-space: nowrap; }
.leaderboard-table th { color: #668085; font-size: .66rem; }
.leaderboard-table td:first-child { width: 50px; color: #d16d45; font-weight: 900; }
.leaderboard-empty, .leaderboard-status { color: #668085; font-size: .78rem; text-align: center; }
.personal-best { margin-top: 14px; padding: 12px; color: #31585c; background: #edf4f2; border-radius: 13px; font-size: .78rem; font-weight: 800; }
.share-puzzle-status {
  position: fixed; z-index: 50; left: 50%; bottom: max(18px,env(safe-area-inset-bottom));
  min-height: 0; margin: 0; padding: 9px 13px; pointer-events: none;
  color: #fff; background: rgba(23,54,58,.92); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(23,54,58,.2); font-size: .76rem; font-weight: 800;
  opacity: 1; transform: translateX(-50%); transition: opacity 160ms ease;
}
.share-puzzle-status:empty { opacity: 0; }

noscript { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; background: #f4f1e9; }

@media (max-width: 719px) {
  .topbar { top: max(10px,env(safe-area-inset-top)); width: calc(100% - 20px); min-height: 64px; padding: 10px; border-radius: 17px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 12px; }
  .brand p { display: none; }
  .svg-stage { padding: 80px 0 12px; }
  .puzzle-discovery { top: 82px; padding: 7px 12px 7px 8px; gap: 8px; }
  .puzzle-discovery-icon { width: 29px; height: 29px; border-radius: 10px; font-size: .72rem; }
  .puzzle-discovery strong { font-size: .72rem; }
  .puzzle-discovery small { font-size: .61rem; }
  .button { min-height: 40px; padding: 0 13px; }
  .layer-panel { position: fixed; top: auto; right: 10px; bottom: max(10px,env(safe-area-inset-bottom)); left: 10px; width: auto; max-height: calc(100dvh - 20px); overflow: auto; transform: translateY(20px); transform-origin: bottom center; }
  .layer-panel.is-open { transform: none; }
  .map-controls { right: 12px; bottom: max(12px,env(safe-area-inset-bottom)); }
  .place-card { bottom: max(14px,env(safe-area-inset-bottom)); }
  .install-guide {
    width: calc(100% - 20px); bottom: max(10px,env(safe-area-inset-bottom));
    padding: 17px 48px 16px 17px; border-radius: 17px;
  }
  body.install-guide-visible .map-controls {
    bottom: calc(max(10px,env(safe-area-inset-bottom)) + 176px);
  }
  .puzzle-header {
    height: 112px; padding: max(8px,env(safe-area-inset-top)) 10px 8px;
    grid-template-columns: auto 1fr; grid-template-rows: 44px 44px; gap: 4px 9px;
  }
  .puzzle-header > .button { min-height: 38px; padding: 0 10px; font-size: .72rem; }
  .puzzle-heading { padding-right: 74px; text-align: left; }
  .puzzle-heading .eyebrow { display: none; }
  .puzzle-heading h2 { font-size: 1.03rem; }
  .puzzle-header-tools {
    grid-column: 1 / -1; width: 100%; justify-self: stretch;
    display: grid; grid-template-columns: auto minmax(0,1fr); gap: 6px;
  }
  .puzzle-stats { width: 100%; display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
  .puzzle-game-share { min-width: 58px; min-height: 35px; padding: 0 10px; font-size: .68rem; }
  .share-label-long { display: none; }
  .share-label-short { display: inline; }
  .puzzle-stats > span { min-width: 0; padding: 5px 8px; }
  .puzzle-stats strong { font-size: .82rem; }
  .puzzle-game {
    height: calc(100dvh - 112px); padding: 8px;
    grid-template-columns: 1fr; grid-template-rows: minmax(260px,58%) minmax(0,42%); gap: 8px;
  }
  .puzzle-board-panel, .piece-tray { border-radius: 17px; }
  .piece-tray { padding: 10px 7px 7px 10px; }
  .piece-tray-heading { align-items: center; }
  .piece-tray-heading .eyebrow { display: none; }
  .piece-tray-heading h3 { font-size: .8rem; }
  .piece-tray-hint { font-size: .6rem; }
  .piece-grid {
    margin-top: 8px; grid-template-columns: repeat(3,minmax(0,1fr));
    grid-auto-rows: 94px; gap: 7px;
  }
  .piece-card { padding: 6px; border-radius: 12px; }
  .piece-name { font-size: .64rem; }
  .puzzle-review { padding: 18px; grid-template-columns: auto 1fr; gap: 10px 13px; text-align: left; }
  .puzzle-review-mark { width: 46px; height: 46px; grid-row: 1; font-size: 1.12rem; }
  .puzzle-review h3 { font-size: .94rem; }
  .puzzle-review p:last-child { font-size: .68rem; }
  .puzzle-review .button { grid-column: 1 / -1; width: 100%; min-width: 0; }
  .puzzle-board-controls { right: 9px; bottom: 9px; }
  .puzzle-board-controls button { width: 38px; height: 35px; }
  .puzzle-gesture-hint {
    position: absolute; z-index: 6; top: 10px; left: 50%; padding: 7px 11px;
    display: flex; align-items: center; gap: 7px; transform: translateX(-50%);
    color: #31585c; background: rgba(255,255,255,.92); border: 1px solid rgba(18,71,76,.12);
    border-radius: 999px; box-shadow: 0 6px 18px rgba(29,57,59,.1);
    font-size: .66rem; font-weight: 800; white-space: nowrap; pointer-events: none;
    transition: opacity 180ms ease,visibility 180ms ease,transform 180ms ease;
  }
  .puzzle-gesture-hint.is-dismissed {
    visibility: hidden; opacity: 0; transform: translate(-50%,-6px);
  }
  .gesture-dots { position: relative; width: 22px; height: 14px; display: block; }
  .gesture-dots i {
    position: absolute; top: 2px; width: 9px; height: 9px;
    background: #8cb9b5; border: 2px solid white; border-radius: 50%;
    box-shadow: 0 1px 4px rgba(29,57,59,.18);
  }
  .gesture-dots i:first-child { left: 1px; }
  .gesture-dots i:last-child { right: 1px; }
  .puzzle-intro, .puzzle-complete { padding: 28px 20px; border-radius: 22px; }
  .puzzle-intro-mark, .puzzle-complete-mark { width: 62px; height: 62px; border-radius: 20px; }
  .puzzle-complete-mark { border-radius: 50%; }
  .puzzle-intro-actions { margin-top: 20px; }
  .puzzle-intro-actions .button { width: 100%; }
  .complete-results { gap: 7px; }
  .complete-results > span { min-width: 0; flex: 1; padding: 11px 8px; }
  .score-submit-row { grid-template-columns: 1fr; }
  .score-submit-row label { display: none; }
  .score-submit-row .button { width: 100%; }
  .leaderboard-panel { padding: 10px; }
  .leaderboard-card { max-height: calc(100dvh - 20px); padding: 17px 13px; border-radius: 18px; }
  .leaderboard-table th, .leaderboard-table td { padding: 8px 5px; font-size: .68rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
