@font-face {
  font-family: 'Tangdle Sans';
  src: url('assets/fonts/roboto-regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tangdle Sans';
  src: url('assets/fonts/roboto-bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tangdle Serif';
  src: url('assets/fonts/tangdle-serif-bold-italic.woff') format('woff');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
:root {
  font-family: 'Tangdle Sans', Arial, sans-serif;
  color: #321f0c;
  color-scheme: light dark;
  background: Canvas;
  --wine: #79273f;
  --olive: #557512;
  --board-nudge: 1.0666667cqw;
  --gold: #917323;
}
* { box-sizing: border-box; }
body { margin: 0; }
#game-shell { position: relative; width: calc(375px * var(--game-scale, 1)); height: calc(667px * var(--game-scale, 1)); margin: 0 auto; overflow: clip; }
#game-stage { position: absolute; width: 375px; height: 667px; transform: scale(var(--game-scale, 1)); transform-origin: top left; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* All measurements share the Photoshop artwork's 894 by 1519 coordinate space. */
main {
  position: relative;
  container-type: inline-size;
  width: 375px;
  aspect-ratio: 894 / 1519;
  margin: 0 auto;
  background: url('assets/bkg-main.png') center top / 100% 100% no-repeat;
}
.brand { position: absolute; left: 16%; top: 1.3%; width: 34%; height: 7.5%; border-radius: 12px; }
.header-actions {
  position: absolute;
  left: 74.9%;
  top: 2.85%;
  width: 17.7%;
  height: 4.45%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.icon { border: 0; background: transparent; padding: 0; display: grid; place-items: center; }
.menu-button { width: 7.2cqw; height: 7.2cqw; }
.menu-button svg { width: 7cqw; height: 7cqw; fill: none; stroke: #35220d; stroke-width: 2.2; stroke-linecap: round; }
.help-button {
  width: 6.9cqw;
  flex-shrink: 0;
  height: 6.9cqw;
  border: .45cqw solid #35220d;
  border-radius: 50%;
  font-size: 5.6cqw;
  line-height: 1;
}
h1 {
  position: absolute;
  left: calc(28.2% + var(--board-nudge));
  top: calc(10.4% + 3px);
  width: 57.8%;
  margin: 0;
  color: var(--wine);
  font-family: 'Tangdle Serif', Georgia, serif;
  font-weight: 700;
  font-style: italic;
  font-size: 7cqw;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  letter-spacing: -.18cqw;
}
#score {
  position: absolute;
  left: calc(30.1% + var(--board-nudge));
  top: 17.05%;
  color: var(--wine);
  font-size: 4.9cqw;
  font-weight: 700;
  line-height: 1.15;
}
.clock {
  position: absolute;
  left: calc(59.2% + var(--board-nudge));
  top: 17.05%;
  width: 27.9%;
  height: 3.25%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55cqw;
  border: .2cqw solid #9d711e;
  border-radius: 6cqw;
  background: linear-gradient(100deg, #edbb53b3, #fadd8db3);
  color: var(--wine);
  font-size: 4.15cqw;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.daily-date {
  position: absolute;
  left: calc(31% + var(--board-nudge));
  top: 17.05%;
  width: 55%;
  color: var(--wine);
  font-size: 4.4cqw;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
main:not(.has-started) #score, main:not(.has-started) .clock { visibility: hidden; }
main.has-started .daily-date { visibility: hidden; }
.board-wrap {
  position: absolute;
  left: calc(28.35% + var(--board-nudge));
  top: 21.65%;
  width: 60.75%;
  height: 38.35%;
}
/* Safari needs its prefixed selection and long-press rules on SVG descendants too. */
.board-wrap, .board-wrap * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}
.tile { fill: #f5ce7b; fill-opacity: .37; stroke: none; }
.letter { fill: #30200f; font-family: 'Tangdle Sans', Arial, sans-serif; font-size: 31px; font-weight: 700; pointer-events: none; }
.empty { fill: #8d722b; opacity: .35; }
.cell { cursor: pointer; }
.cell:focus { outline: none; }
.cell:focus-visible .tile { stroke: var(--wine); stroke-width: 2; }
.selected .tile { fill: #c5757a; fill-opacity: .55; }
.selected .letter { fill: #5d192e; }
.blocked .tile { fill: #d65c30; fill-opacity: .9; }
.blocked .letter { fill: #651d0f; }
.blocker .tile { fill: #d65c30; fill-opacity: .9; stroke: #a42f17; stroke-width: 3; }
.trace { fill: none; stroke: #79273f; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; opacity: .28; pointer-events: none; }
.trace-head { fill: none; stroke: var(--wine); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; opacity: .85; pointer-events: none; }
.exit-ray { stroke: #bc3f1f; stroke-width: 2; stroke-dasharray: 4 5; opacity: .8; }
.primary {
  border: 1px solid #642037;
  border-radius: 100px;
  background: linear-gradient(#85324b, #78243e);
  color: #fff2cc;
  font-weight: 700;
}
.primary:disabled { opacity: .62; }
#untangle {
  position: absolute;
  left: calc(43.5% + var(--board-nudge));
  top: 61.55%;
  width: 32%;
  height: 4.3%;
  padding: 0;
  font-size: 4.6cqw;
  font-weight: 400;
  line-height: 1;
}
#words {
  position: absolute;
  left: calc(24% + var(--board-nudge));
  top: 67%;
  width: 57%;
  height: 21.2%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  column-gap: 3cqw;
}
#words li { min-width: 0; }
.word-choice {
  display: flex;
  align-items: center;
  gap: 1cqw;
  width: 100%;
  padding: .25cqw 0;
  background: none;
  border: 0;
  font-size: 3.2cqw;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
}
.word-badge {
  display: inline-grid;
  place-items: center;
  width: 5cqw;
  height: 5cqw;
  flex-shrink: 0;
  border: .25cqw solid #90751e;
  border-radius: 50%;
  color: #fff6d7;
  font-size: 3cqw;
  font-weight: 400;
}
.word-choice[aria-pressed='true'] .word-badge { background: var(--olive); border-color: #73852b; }
.word-label { position: relative; }
.done .word-choice { color: #aa9a69; text-decoration: line-through; text-decoration-thickness: .55cqw; }
.done .word-choice .word-badge { background: var(--wine); border-color: #917126; color: transparent; }
.feedback {
  position: absolute;
  left: 16.5%;
  top: 91.1%;
  width: 67%;
  height: 5.55%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 .5cqw;
  color: var(--wine);
  font-family: 'Tangdle Serif', Georgia, serif;
  font-size: 4cqw;
  font-weight: 700;
  font-style: italic;
  line-height: 1.1;
  text-align: center;
}
.feedback.letters { font-size: 6cqw; white-space: nowrap; }
.feedback.warn { color: var(--wine); }
.board-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3cqw;
  border: .4cqw double #a47c26;
  border-radius: 3cqw;
  background: #f8e7bb;
  box-shadow: inset 0 0 0 .65cqw #f0d08c, 0 1cqw 3cqw #69431b25;
  color: var(--wine);
  z-index: 6;
}
.board-card::before, .board-card::after { content: '❧'; color: #8b762b; font-size: 7cqw; line-height: 1; }
.board-card h2 { font-family: 'Tangdle Serif', Georgia, serif; font-size: 6cqw; font-weight: 700; font-style: italic; line-height: 1.25; margin: 2cqw 0; }
.board-card p { font-size: 3.25cqw; line-height: 1.5; margin: 1cqw 0 3cqw; }
.board-card .primary { padding: 2.5cqw 4cqw; font-size: 3.4cqw; margin: 0 0 2cqw; }
.eyebrow { font-size: 2.4cqw; letter-spacing: .25cqw; font-weight: 700; color: #87702b; }
.reward-popup {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: max-content;
  max-width: 96%;
  padding: 3cqw;
  border: .35cqw double #9f7b29;
  border-radius: 2.7cqw;
  background: #fae9bff5;
  color: var(--wine);
  pointer-events: none;
  box-shadow: 0 .75cqw 3cqw #68401f2b;
  animation: points-pop 1800ms ease-out both;
}
.reward-bonus { display: flex; justify-content: space-between; gap: 3cqw; font-size: 3.4cqw; line-height: 1.5; font-weight: 700; white-space: nowrap; }
.penalty-popup { color: #d65c30; }
.reward-title { font-size: 4cqw; line-height: 1.2; font-weight: 700; text-align: center; margin-bottom: .7cqw; }
.reward-note { font-size: 3cqw; line-height: 1.3; text-align: center; margin-top: .8cqw; }
.reward-total { border-top: .2cqw solid #aa8736; margin-top: 1.3cqw; padding-top: .8cqw; font-size: 8cqw; line-height: 1.15; font-weight: 700; text-align: center; white-space: nowrap; }
.flying { pointer-events: none; }
.flying circle { fill: #d9a3a0; }
.flying text { font-family: 'Tangdle Sans', Arial, sans-serif; fill: #5d192e; font-size: 31px; font-weight: 700; }
.dot-confetti { position: fixed; z-index: 1000; pointer-events: none; width: 0; height: 0; }
.dot-confetti i { position: absolute; width: 6px; height: 4px; border-radius: 1px; animation: dot-burst 900ms ease-out both; }
.dot-confetti .confetti-streak { height: 2px; background: #88722a; transform-origin: left center; animation: crossout-sweep 350ms ease-out both; }
@keyframes points-pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  40%, 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}
@keyframes points-fade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dot-burst { 0% { opacity: 1; transform: translate(0,0) rotate(0deg); } 100% { opacity: 0; transform: translate(var(--dx),var(--dy)) rotate(var(--spin)); } }
@keyframes crossout-sweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .dot-confetti { display: none; }
  .reward-popup { animation: points-fade 1800ms linear both; }
}
dialog {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: auto;
  top: calc(333.5px * var(--game-scale, 1));
  margin: 0;
  width: 345px;
  max-width: none;
  max-height: 635px;
  transform: scale(var(--game-scale, 1)) translate(-50%, -50%);
  transform-origin: top left;
  overflow: auto;
  padding: 26px;
  border: 4px double #9a7b31;
  border-radius: 20px;
  background: #f9e7bb;
  color: #4c3219;
  box-shadow: 0 8px 40px #38231144;
}
dialog::backdrop { background: #35220c80; }
dialog .eyebrow { font-size: 10px; letter-spacing: 1.5px; }
dialog h2 { font-family: 'Tangdle Serif', Georgia, serif; font-size: 27px; font-style: italic; line-height: 1.2; color: var(--wine); margin: 10px 0 20px; }
dialog p { font-size: 13px; line-height: 1.6; }
dialog .small { font-size: 12px; }
dialog .primary { padding: 10px 20px; font-size: 13px; }
.close { position: absolute; right: 10px; top: 5px; border: 0; background: none; font-size: 28px; color: var(--wine); }
#game-menu { top: calc(347.5px * var(--game-scale, 1)); height: 558px; padding: 0; overflow: hidden; }
#game-menu[open] { display: flex; flex-direction: column; }
.menu-header { min-height: 52px; margin: 11px 20px 5px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.menu-header h2 { margin: 0; color: #85702d; font-family: 'Tangdle Sans', Arial, sans-serif; font-size: 12px; font-style: normal; font-weight: 700; letter-spacing: 1px; line-height: 1.2; text-transform: uppercase; }
.menu-header .close { position: static; padding: 0 2px; font-size: 27px; line-height: 1; }
#menu-list-wrap { flex: 1 1 auto; min-height: 0; margin: 0 20px 9px; overflow-y: auto; scrollbar-color: #79273f4d transparent; scrollbar-width: thin; }
#pager { display: grid; gap: 5px; padding: 0 2px 5px 0; }
#pager button { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 33px; padding: 7px 10px; border: 1px solid #b59752; border-radius: 7px; background: #fff3d280; color: #543a21; text-align: left; font-size: 12px; line-height: 1.25; }
#pager .puzzle-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pager .completion-score, #pager .resume-label { flex-shrink: 0; margin-left: auto; text-align: right; white-space: nowrap; }
#pager button.active { background: var(--wine); color: #fff2cc; border-color: var(--wine); }
.menu-footer { min-height: 67px; padding: 0 20px 11px; display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
.menu-footer-actions { display: flex; align-items: center; justify-content: center; gap: 8px; }
#countdown { margin: 0; text-align: center; color: #85702d; font-size: 12px; font-weight: 700; line-height: 1.3; }
.menu-footer-link, .sound-toggle { height: 40px; border: 1px solid #ad8c42; border-radius: 9px; background: #fff3d2; color: var(--wine); display: grid; place-items: center; }
.menu-footer-link { padding: 0 10px; font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.sound-toggle { width: 40px; padding: 7px; }
.sound-toggle svg { width: 100%; height: 100%; fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-toggle .sound-waves { fill: none; }
.sound-toggle .sound-muted { display: none; fill: none; stroke-width: 2.6; }
.sound-toggle[aria-pressed="false"] .sound-waves { display: none; }
.sound-toggle[aria-pressed="false"] .sound-muted { display: block; }
#menu-list-wrap::-webkit-scrollbar { width: 5px; }
#menu-list-wrap::-webkit-scrollbar-thumb { border-radius: 5px; background: #79273f4d; }
#menu-list-wrap::-webkit-scrollbar-track { background: transparent; }
#dev-controls { width: min(100%, 375px); margin: 0 auto; text-align: center; }
#dev-controls:empty { display: none; }
.dev-toggle { min-height: 29px; margin: 0 3px; padding: 3px 7px; border: 0; background: Canvas; color: CanvasText; font-size: 11px; }
/* Zoom mockups use the same composition coordinates on phones and desktop. */
#zoom-toggle {
  position: absolute;
  left: 34.7%;
  top: 61.55%;
  width: 8%;
  height: 4.3%;
  border-radius: 50%;
  background: var(--wine);
  color: #f9e7bb;
}
#zoom-toggle svg { width: 6.12cqw; height: 6.12cqw; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
#zoom-toggle:disabled { opacity: .62; }
#zoom-panel {
  position: absolute;
  left: 4.8%;
  top: .95%;
  width: 89.6%;
  height: 59.7%;
  z-index: 7;
  border: .8cqw double #a47c26;
  border-radius: 5.3cqw;
  background: #f8e7bb;
  box-shadow: inset 0 0 0 .8cqw #f0d08c, 0 .6cqw 1cqw #69431b65;
}
.zoomed header, .zoomed h1 { visibility: hidden; }
.zoomed #score { left: 9.6%; top: 3.15%; z-index: 8; }
.zoomed .clock { left: 63.2%; top: 3%; width: 27%; height: 3%; z-index: 8; }
.zoomed .board-wrap { left: 8.9%; top: 7.35%; width: 81.3%; height: 52%; z-index: 8; }




/* Concise help follows the five sections in help-description-v02.docx. */
.help-section { margin: 17px 0; }
.help-section h3 { margin: 0 0 5px; font-family: 'Tangdle Serif', Georgia, serif; font-size: 23px; font-weight: 700; font-style: italic; line-height: 1.2; color: var(--wine); }
.help-section p { margin: 0; }


/* Help scrolls inside an inset track, leaving the rounded frame untouched. */
#instructions { top: calc(318.582215px * var(--game-scale, 1)); height: 605.16443px; padding: 0; overflow: hidden; }
.help-scroll { height: calc(100% - 36px); margin: 18px 6px; padding: 8px 10px 8px 22px; overflow: auto; scrollbar-width: none; }
.help-scroll::-webkit-scrollbar { display: none; }
.help-scrollbar { position: absolute; right: 5px; top: 22px; bottom: 22px; width: 5px; touch-action: none; cursor: pointer; }
.help-scrollbar span { position: absolute; left: 0; top: 0; width: 100%; border-radius: 5px; background: var(--wine); opacity: .3; }

/* Results follow the 375 by 667 end-score mockup; start cover stays unchanged. */
#celebrate { padding: 0; }
#celebrate::before, #celebrate::after { position: absolute; left: 0; width: 100%; }
#celebrate::before { top: 3.8%; }
#celebrate::after { bottom: 3.7%; }
#celebrate h2 { position: absolute; top: 15%; width: 100%; margin: 0; font-size: 7.466667cqw; line-height: 1.2; }
#celebrate #result { position: absolute; top: 48.5%; width: 100%; margin: 0; font-size: 3.733333cqw; line-height: 1.5; }
#celebrate #share-score { position: absolute; top: 63.2%; width: 36.266667cqw; height: 12.266667cqw; padding: 0; margin: 0; font-size: 4.266667cqw; opacity: 1; }

/* Tutorial stays inside the uniformly scaled master frame. */
.tutorial #score, .tutorial .clock { visibility: hidden; }
#tutorial-hint { position:absolute; left:35%; top:17%; width:47%; height:3.5%; font-size:3cqw; padding:0; }
#tutorial-card { z-index:7; padding:3cqw; }
#tutorial-card h2 { font-size:5.8cqw; }
#tutorial-card p { font-size:3.4cqw; line-height:1.4; }
#tutorial-card::before, #tutorial-card::after { font-size:5cqw; }
.tutorial-target .word-label { text-decoration:underline; text-decoration-color:var(--gold); text-underline-offset:.7cqw; }
#tutorial-card::before { font-size:4.3cqw; }
#tutorial-card::after { display:none; }
#tutorial-card h2 { margin:1cqw 0; font-size:5.5cqw; }
#tutorial-card p { margin:1cqw 0 2.5cqw; font-size:3.2cqw; line-height:1.4; }
#tutorial-card .primary { margin:0; }

.tutorial #celebrate #share-score { width:48cqw; white-space:nowrap; }
