:root {
  --cream: #fff2cf;
  --ink: #3b2118;
  --coral: #da6952;
  --turq: #36a68b;
  --amber: #d6a13f;
  --lav: #7663a8;
  --green: #6e9850;
  --shadow: 0 12px 28px #21100980;
  --fast: 160ms;
  --normal: 280ms;
  --icon-plate: radial-gradient(
    circle at 50% 36%,
    #7a4338 0%,
    #5c2e24 58%,
    #3f1e18 100%
  );
  --icon-plate-shadow:
    inset 0 3px 0 #8a524488, 0 4px 0 #2b1510, 0 8px 12px #21100999;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1c0d08;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--cream);
  touch-action: manipulation;
}
button,
input {
  font: inherit;
}
.game-shell {
  position: relative;
  width: min(100vw, 560px);
  height: 100dvh;
  margin: auto;
  overflow: hidden;
  background: #5d301d url("assets/backgrounds/library-bg.png") center/cover
    no-repeat;
  box-shadow: 0 0 60px #000;
}
.game-shell:after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 80px #1d0d0888;
  z-index: 0;
}
.screen {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: max(18px, env(safe-area-inset-top)) 18px
    max(18px, env(safe-area-inset-bottom));
  overflow: hidden;
}
.screen.active {
  display: flex;
  flex-direction: column;
  animation: screenIn var(--normal) ease-out;
}
.asset-button,
.round-asset,
.booster {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  z-index: 2;
  touch-action: manipulation;
  pointer-events: auto;
  transition:
    transform var(--fast),
    filter var(--fast);
}
.asset-button img,
.round-asset img,
.booster img {
  display: block;
  width: 100%;
  height: auto;
}
.asset-button:hover,
.booster:hover {
  filter: brightness(1.08);
}
.asset-button:active,
.round-asset:active,
.booster:active {
  transform: translateY(3px) scale(0.98);
}
button:focus-visible,
input:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
}
.round-asset {
  width: 54px;
  height: 54px;
}
.coin-pill,
.collection-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  gap: 6px;
  height: 34px;
  min-width: 78px;
  padding: 0 8px;
  border: 3px solid #f3d58d;
  border-radius: 999px;
  background: #3b1f18dd;
  box-shadow: var(--shadow);
  font-weight: 900;
  font-size: 15px;
  color: #fff6d6;
  vertical-align: middle;
}
.collection-count {
  line-height: 1;
}
.coin-pill {
  line-height: 0;
}
.currency-gem,
.coin-amount {
  display: block;
  height: 22px;
  margin: 0;
  padding: 0;
}
.currency-gem {
  width: 22px;
  flex: 0 0 22px;
  object-fit: contain;
  filter: drop-shadow(0 2px 1px #120a0788);
}
.coin-amount {
  position: relative;
  top: -1px;
  font-size: 15px;
  font-weight: 900;
  line-height: 22px;
}
.home-top {
  display: flex;
  justify-content: flex-end;
}
.brand-lockup {
  text-align: center;
  margin: auto 0 18px;
}
.eyebrow {
  margin: 20px 0 5px;
  color: #7a3c28;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-shadow: 0 1px #ffe8b7;
}
.brand-lockup .eyebrow {
  color: #6b3828;
}
.brand-lockup h1 {
  margin: 0;
  line-height: 0.8;
  font-size: clamp(62px, 18vw, 96px);
  letter-spacing: -0.07em;
  text-shadow:
    0 5px 0 #65301f,
    0 10px 20px #35170da8;
}
.brand-lockup h1 span {
  display: block;
  color: #fff1c8;
}
.brand-lockup h1 strong {
  display: block;
  color: #49bda1;
}
.tagline {
  margin: 8px 0 0;
  padding: 0;
  color: #5a2a1c;
  font-size: clamp(14px, 4.2vw, 18px);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-shadow: 0 1px #ffe8b7;
}
.home-actions {
  display: grid;
  gap: 2px;
  width: min(82%, 420px);
  margin: 0 auto auto;
}
.save-note {
  text-align: center;
  color: #6d422f;
  font-weight: 700;
  font-size: 12px;
}
.screen-header,
.game-topbar {
  display: grid;
  grid-template-columns: 64px 1fr 96px;
  align-items: center;
  text-align: center;
  min-height: 70px;
  flex: 0 0 auto;
}
.screen-header h2 {
  margin: 0;
  color: #fff6d6;
  font-size: 30px;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    0 2px 0 #3b1a12,
    0 4px 8px #1a0c08aa;
}
.level-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 16px 2px 24px;
  touch-action: pan-y;
  scrollbar-width: none;
}
.level-btn {
  position: relative;
  aspect-ratio: 1;
  border: 5px solid #f4d89b;
  border-radius: 22px;
  background: linear-gradient(#d98262, #a74737);
  box-shadow:
    0 6px 0 #6c3023,
    0 10px 18px #39180d66;
  color: #fff4d1;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}
.level-btn.locked {
  opacity: 0.72;
  background: linear-gradient(#74665b, #453a34);
  border-color: #cbb995;
  box-shadow:
    0 6px 0 #30251f,
    0 10px 18px #21110b55;
}
.level-btn.completed {
  background: linear-gradient(#48bda0, #257a69);
}
.level-btn small {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  color: #ffe17d;
  font-size: 10px;
  letter-spacing: -1px;
}
.level-number {
  position: relative;
  z-index: 2;
}
.level-btn.locked .level-number {
  position: absolute;
  top: 7px;
  left: 10px;
  color: #e6d7bc;
  font-size: 14px;
}
.level-key {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 48%;
  height: 48%;
  object-fit: contain;
  transform: translate(-50%, -50%) rotate(-8deg);
  filter: drop-shadow(0 3px 2px #1f100aaa);
}
.level-btn.locked small {
  color: #dbc99e;
  letter-spacing: 0;
}
.game-topbar {
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  gap: 8px;
}
.screen-header {
  grid-template-columns: 58px minmax(0, 1fr) minmax(78px, 96px);
  gap: 8px;
}
.level-label,
.screen-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 0;
  min-width: 0;
  width: 100%;
  padding: 6px 8px 7px;
  border: 3px solid #f3d58d;
  border-radius: 18px;
  background: #3b1f18ee;
  box-shadow: var(--shadow);
}
.level-label span,
.screen-title .eyebrow {
  margin: 0;
  padding: 0;
  color: #ffe17d;
  font-size: clamp(9px, 2.6vw, 12px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.15;
  white-space: nowrap;
  text-shadow: 0 1px 2px #1a0c08;
}
.level-label strong,
.screen-title h2 {
  margin: 0;
  color: #fff6d6;
  font-size: clamp(16px, 5.2vw, 22px);
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 2px 0 #2b1510;
}
.status-row {
  display: grid;
  grid-template-columns: 72px 1fr 78px;
  align-items: center;
  gap: 9px;
}
.status-chip {
  padding: 7px 5px;
  border: 3px solid #e8c785;
  border-radius: 16px;
  background: #4a281edd;
  text-align: center;
  box-shadow: var(--shadow);
}
.status-chip small {
  display: block;
  color: #e8c785;
  font-size: 9px;
  font-weight: 900;
}
.status-chip strong {
  font-size: 22px;
}
.progress-wrap {
  position: relative;
  height: 22px;
  border: 3px solid #8a5638;
  border-radius: 999px;
  background: #3b2118;
  overflow: hidden;
}
.progress-wrap div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #38a88e, #76d7b9);
  transition: width var(--normal);
}
.progress-wrap span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  color: #fff6d6;
  text-shadow: 0 1px #2d1710;
}
.word-hud {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 78px;
  padding: 6px 0 2px;
}
.letter-slots {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: clamp(3px, 1.2vw, 7px);
  width: 100%;
  max-width: 100%;
  padding: 0 8px;
  box-sizing: border-box;
}
.letter-slot {
  flex: 0 0 auto;
  width: clamp(20px, 6.2vw, 34px);
  height: clamp(26px, 7.4vw, 40px);
  display: grid;
  place-items: center;
  border: 2px solid #f0d7a0;
  border-radius: 11px;
  background: linear-gradient(#fffdf6, #f4e3b6);
  box-shadow:
    inset 0 2px 0 #fff,
    0 4px 0 #8a4e32;
  color: #5a2d20;
  font-size: clamp(16px, 4.6vw, 22px);
  font-weight: 900;
}
.letter-slot.blank {
  color: #c4a07899;
  font-size: clamp(16px, 4.6vw, 22px);
}
.letter-slot.filled {
  background: linear-gradient(#fff, #f6e08a);
  color: #5a2d20;
}
.letter-slots.good .letter-slot {
  background: linear-gradient(#8fe3c9, #2f9d82);
  border-color: #7ee0c1;
  color: #fff;
  box-shadow: 0 4px 0 #1d6d5a;
}
.letter-slots.bad .letter-slot {
  background: linear-gradient(#f4b3a8, #c75a4d);
  border-color: #e08a7a;
  color: #fff;
  animation: shake 0.28s;
}
.letter-slots[data-len="8"] .letter-slot,
.letter-slots[data-len="9"] .letter-slot,
.letter-slots[data-len="10"] .letter-slot {
  width: clamp(18px, 6vw, 28px);
  height: clamp(24px, 6.8vw, 34px);
  font-size: clamp(13px, 3.8vw, 18px);
  border-radius: 8px;
}
.word-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 12px;
}
.word-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b3d2e66;
  box-shadow: inset 0 1px 2px #2b140c88;
}
.word-dot.found {
  background: #fff6d8;
  box-shadow:
    0 0 0 2px #f0d18c,
    0 0 8px #fff8e4aa;
}
.current-word {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.board-wrap {
  --n: 4;
  --tile: clamp(42px, 12vw, 54px);
  --gap: 6px;
  --pad: 6px;
  position: relative;
  width: min(
    100%,
    calc(
      var(--n) * var(--tile) + (var(--n) - 1) * var(--gap) + 2 * var(--pad) +
        10px
    )
  );
  aspect-ratio: 1;
  height: auto;
  margin: 8px auto auto;
  flex: 0 0 auto;
}
.board-wrap[data-size="5"] {
  --n: 5;
}
.board-wrap[data-size="6"] {
  --n: 6;
  --tile: clamp(38px, 11vw, 50px);
}
.board-wrap[data-size="7"] {
  --n: 7;
  --tile: clamp(32px, 9.5vw, 44px);
}
.letter-board {
  position: absolute;
  inset: var(--pad);
  display: grid;
  gap: var(--gap);
  z-index: 2;
}
.letter-tile {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  border: 0;
  border-radius: 22%;
  background-image: linear-gradient(145deg, #fff8df, #e7c98c);
  box-shadow:
    inset 0 4px 4px #fff,
    0 7px 0 #8b5236,
    0 10px 16px #2b130b78;
  color: #5a2d20;
  font-size: calc(var(--tile) * 0.5);
  line-height: 1;
  text-transform: uppercase;
  font-weight: 900;
  user-select: none;
}
.letter-tile.selected {
  transform: translateY(4px) scale(0.94);
  background: linear-gradient(145deg, #72d8bd, #319d84);
  box-shadow:
    inset 0 4px 4px #bff3e4,
    0 3px 0 #206e5e;
  color: #fff;
}
.letter-tile.hinted {
  animation: hintPulse 0.8s infinite;
}
.letter-tile.completed {
  box-shadow:
    inset 0 0 0 5px #54b99e,
    0 7px 0 #6f4935,
    0 10px 16px #2b130b78;
}
#path-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: visible;
}
.trace-line {
  fill: none;
  stroke: #46b79b;
  stroke-width: 16;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
}
.booster-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding-top: 8px;
}
.booster {
  position: relative;
}
.booster span {
  position: absolute;
  right: 3px;
  top: -4px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #3c2118;
  border: 2px solid #f3d899;
  color: white;
  font-size: 12px;
  font-weight: 900;
}
.booster:disabled {
  filter: grayscale(1);
  opacity: 0.55;
}
.shelves {
  overflow-y: auto;
  touch-action: pan-y;
  padding: 8px 0 30px;
}
.shelf {
  position: relative;
  margin: 10px 0 22px;
  padding: 10px 12px 22px;
  border-radius: 15px;
  background: #4f291ddd;
  border: 4px solid #9b603d;
  box-shadow:
    inset 0 0 18px #1d0e09,
    0 12px 0 #3e1e14;
}
.shelf h3 {
  margin: 0 0 8px;
  color: #f5d69b;
  font-size: 14px;
  letter-spacing: 0.12em;
}
.shelf-items {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  height: 80px;
}
.book {
  width: 30px;
  height: 68px;
  border: 3px solid #e8c77e;
  border-radius: 4px 7px 3px 3px;
  background: linear-gradient(90deg, #b9483e, #e0785d 55%, #89372f);
  box-shadow: 3px 3px #28120c;
}
.book:nth-child(2) {
  height: 58px;
  background: linear-gradient(90deg, #267e71, #55bda5 55%, #1e6158);
}
.book:nth-child(3) {
  height: 74px;
  background: linear-gradient(90deg, #66528f, #917bc1 55%, #493a6a);
}
.book.locked {
  background: #231713;
  border-color: #5a463a;
  filter: none;
}
.settings-panel {
  display: grid;
  gap: 18px;
  width: min(94%, 430px);
  margin: auto;
  padding: 22px 22px 28px;
  border: 5px solid #9a5b3a;
  border-radius: 28px;
  background: #f2d49ae8;
  color: #5b2e20;
  box-shadow: var(--shadow);
}
.settings-top {
  grid-template-columns: 64px 1fr;
  justify-items: start;
}
.settings-heading {
  text-align: center;
  margin: 0 0 6px;
}
.settings-heading .eyebrow {
  color: #8a4a32;
}
.settings-heading h2 {
  margin: 0;
  color: #5b2e20;
  font-size: 34px;
  line-height: 1;
  text-shadow: none;
}
.settings-panel label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 19px;
  font-weight: 900;
}
.settings-panel input {
  position: absolute;
  opacity: 0;
}
.settings-panel i {
  position: relative;
  width: 64px;
  height: 34px;
  border-radius: 20px;
  background: #795546;
  box-shadow: inset 0 3px 5px #29140d88;
}
.settings-panel i:after {
  content: "";
  position: absolute;
  top: 4px;
  left: 5px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f9e5b8;
  transition: left var(--fast);
}
.settings-panel input:checked + i {
  background: var(--turq);
}
.settings-panel input:checked + i:after {
  left: 33px;
}
.now-playing {
  margin: -8px 0 2px;
  padding: 0;
  border: 0;
  background: none;
  color: #7a4a32;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.reset-progress {
  width: 75%;
  margin: 24px auto 0;
}
.modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 25px;
  background: #1c0c08bb;
  backdrop-filter: blur(5px);
}
.modal[hidden] {
  display: none;
}
.modal-card {
  width: min(94%, 430px);
  padding: 28px 20px;
  border: 7px solid #9b5b38;
  border-radius: 32px;
  background: linear-gradient(#fff0c7, #e7bf7c);
  box-shadow:
    0 22px 0 #4d271b,
    0 30px 60px #0009;
  text-align: center;
  color: #5b2c20;
}
.modal-card h2 {
  margin: 4px 0 12px;
  font-size: 36px;
}
.modal-card p {
  font-weight: 700;
}
.modal-stars {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #b67220;
  text-shadow: 0 2px #fff1c5;
}
.modal-stars[hidden] {
  display: none;
}
.modal-stars img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 5px 3px #6b361d66);
}
.modal-actions {
  display: grid;
  gap: 6px;
  width: min(58%, 210px);
  margin: 10px auto 0;
  justify-items: center;
}
.modal-actions .asset-button,
.modal-actions .asset-button img {
  display: block;
  width: 100%;
  height: 56px;
  object-fit: contain;
}
.modal-card {
  position: relative;
  overflow: visible;
}
.modal-gem-pill {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 76px;
  height: 36px;
  padding: 3px 10px 3px 5px;
  border: 3px solid #e2bc68;
  border-radius: 20px;
  background: #4a281f;
  box-shadow: 0 5px 0 #2f1711, 0 8px 15px #3b1c1466;
  color: #fff3cd;
}
.modal-gem-pill[hidden] { display: none; }
.modal-gem-pill img {
  width: 27px;
  height: 27px;
  object-fit: contain;
  filter: drop-shadow(0 2px 1px #160a0788);
}
.modal-gem-pill strong {
  min-width: 24px;
  font-size: 16px;
  line-height: 1;
}
.flying-gem {
  position: absolute;
  z-index: 8;
  width: 31px;
  height: 31px;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 4px 3px #24100a88);
  animation: gemFly 760ms cubic-bezier(.2,.7,.25,1) forwards;
}
.modal-gem-pill.bump { animation: gemPillBump 240ms ease-out; }
@keyframes gemFly {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.25) rotate(0deg); }
  18% { opacity: 1; transform: translate(-50%, -75%) scale(1.05) rotate(65deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--fly-x)), calc(-50% + var(--fly-y))) scale(.35) rotate(420deg); }
}
@keyframes gemPillBump {
  50% { transform: scale(1.12); filter: brightness(1.2); }
}
.intro {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: #1c0c08cc;
  backdrop-filter: blur(6px);
}
.intro[hidden] {
  display: none;
}
.intro-card {
  position: relative;
  width: min(92%, 390px);
  padding: 52px 18px 18px;
  border: 7px solid #9b5b38;
  border-radius: 30px;
  background: linear-gradient(#fff0c7, #e7bf7c);
  box-shadow:
    0 18px 0 #4d271b,
    0 26px 48px #0009;
  text-align: center;
  color: #5b2c20;
}
.intro-head {
  position: absolute;
  left: 50%;
  top: 0;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border: 5px solid #f6e6bc;
  border-radius: 50%;
  background: var(--icon-plate);
  box-shadow: var(--icon-plate-shadow);
  transform: translate(-50%, -50%);
}
.intro-play-icon {
  display: block;
  width: 0;
  height: 0;
  margin-left: 6px;
  border-style: solid;
  border-width: 16px 0 16px 26px;
  border-color: transparent transparent transparent #fff6d6;
  filter: drop-shadow(0 2px 0 #2b1510);
}
.intro-card h2 {
  margin: 2px 0 12px;
  font-size: 32px;
  line-height: 1;
}
.intro-card p {
  margin: 0 auto 14px;
  max-width: 28ch;
  font-weight: 800;
  line-height: 1.35;
}
.intro-demo {
  display: grid;
  place-items: center;
  min-height: 78px;
  margin: 0 0 12px;
}
.intro-tiles {
  display: flex;
  gap: 8px;
  position: relative;
}
.intro-tile {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff8df, #e7c98c);
  box-shadow:
    inset 0 3px 3px #fff,
    0 5px 0 #8b5236;
  color: #5a2d20;
  font-size: 22px;
  font-weight: 900;
}
.intro-tile.on {
  background: linear-gradient(145deg, #72d8bd, #319d84);
  color: #fff;
  box-shadow:
    inset 0 3px 3px #bff3e4,
    0 4px 0 #206e5e;
}
.intro-hand {
  position: absolute;
  left: 6px;
  top: 38px;
  width: 22px;
  height: 22px;
  border: 3px solid #5b2c20;
  border-radius: 50% 50% 50% 12px;
  background: #fff6d8;
  transform: rotate(-30deg);
  animation: introDrag 1.8s ease-in-out infinite;
}
.intro-goal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.intro-goal strong {
  padding: 4px 12px;
  border: 3px solid #f3d58d;
  border-radius: 999px;
  background: #3b1f18;
  color: #fff6d6;
  font-size: 15px;
}
.intro-goal span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b3d2e66;
}
.intro-goal .row {
  display: flex;
  gap: 7px;
}
.intro-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 0 0 14px;
}
.intro-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b8895e;
}
.intro-dots i.on {
  background: #3b1f18;
  transform: scale(1.2);
}
.intro-btn {
  display: block;
  width: min(72%, 210px);
  margin: 0 auto;
  padding: 12px 16px;
  border: 3px solid #f6e6bc;
  border-radius: 16px;
  background: linear-gradient(#49bda1, #2f9d82);
  box-shadow: 0 5px 0 #1d6d5a;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.intro-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #1d6d5a;
}
.intro-skip {
  display: block;
  margin: 10px auto 0;
  border: 0;
  background: none;
  color: #7a3c28;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}
@keyframes introDrag {
  0%,
  12% {
    left: 8px;
    opacity: 0;
  }
  28%,
  72% {
    opacity: 1;
  }
  45% {
    left: 62px;
  }
  88%,
  100% {
    left: 118px;
    opacity: 0;
  }
}
.reduce-motion .intro-hand {
  animation: none;
  left: 62px;
  opacity: 1;
}
.toast {
  position: absolute;
  z-index: 50;
  left: 50%;
  bottom: 17%;
  transform: translate(-50%, 20px);
  padding: 11px 18px;
  border: 3px solid #f0d18c;
  border-radius: 18px;
  background: #3d2119eb;
  box-shadow: var(--shadow);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.timer-danger {
  color: #ff7d68 !important;
  animation: dangerPulse 0.55s infinite;
}
@keyframes screenIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes shake {
  25% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(8px);
  }
  75% {
    transform: translateX(-4px);
  }
}
@keyframes hintPulse {
  50% {
    filter: brightness(1.45);
    transform: scale(1.08);
  }
}
@keyframes dangerPulse {
  50% {
    transform: scale(1.15);
  }
}
@media (max-height: 720px) {
  .screen {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .word-hud {
    min-height: 64px;
    padding: 4px 0 0;
    gap: 6px;
  }
  .letter-slot {
    width: 26px;
    height: 32px;
    font-size: 16px;
  }
  .board-wrap {
    --tile: clamp(38px, 10.5vw, 48px);
  }
  .board-wrap[data-size="6"] {
    --tile: clamp(34px, 9.5vw, 44px);
  }
  .board-wrap[data-size="7"] {
    --tile: clamp(30px, 8.5vw, 38px);
  }
  .booster-row {
    padding: 3px 30px 0;
  }
  .game-topbar {
    min-height: 58px;
  }
  .level-label,
  .screen-title {
    padding: 5px 8px 6px;
    border-width: 2px;
  }
  .level-label span,
  .screen-title .eyebrow {
    font-size: 10px;
  }
  .level-label strong,
  .screen-title h2 {
    font-size: 18px;
  }
  .round-asset {
    width: 42px;
    height: 42px;
  }
  .status-chip {
    padding: 4px;
  }
  .home-actions {
    width: min(54vw, 240px);
    gap: 6px;
  }
  .brand-lockup {
    margin-bottom: 16px;
  }
  .brand-lockup h1 {
    font-size: 52px;
  }
  .tagline {
    margin-top: 6px;
    font-size: 15px;
  }
}
@media (min-width: 700px) {
  body {
    background: radial-gradient(circle, #6b3b28, #1b0c08);
  }
  .game-shell {
    border-left: 8px solid #7d472e;
    border-right: 8px solid #7d472e;
  }
  .board-wrap {
    --tile: 52px;
  }
  .board-wrap[data-size="6"] {
    --tile: 48px;
  }
  .board-wrap[data-size="7"] {
    --tile: 42px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Connected word-board treatment, inspired by compact mobile word puzzles. */
.board-wrap {
  padding: 0;
  border: 5px solid #9a4d30;
  border-radius: 26px;
  background: linear-gradient(145deg, #c95d35dd, #9e4027dd);
  box-shadow:
    inset 0 0 0 3px #ec8654,
    0 13px 0 #5d281c,
    0 18px 30px #2b130b88;
}
.letter-board {
  inset: var(--pad);
  gap: var(--gap);
}
.letter-tile {
  border-radius: 18%;
  background: linear-gradient(145deg, #fffefa, #e7e8ee);
  box-shadow:
    inset 0 3px 2px #fff,
    0 4px 0 #9d8caa,
    0 6px 10px #421d1460;
  color: #374875;
  transition:
    transform var(--fast),
    filter var(--fast),
    color var(--fast),
    background var(--fast),
    box-shadow var(--fast);
}
.letter-tile.selected {
  transform: translateY(3px) scale(0.92);
  background: linear-gradient(145deg, #fff7d4, #e7b447);
  box-shadow:
    inset 0 4px 4px #fff0a8,
    0 3px 0 #945a1c;
  color: #75431e;
}
.letter-tile.completed {
  background: transparent;
  box-shadow: none;
  color: var(--word-ink, #743228);
  text-shadow: 0 2px #ffffff4d;
  transform: none;
}
#path-layer {
  inset: var(--pad);
  width: calc(100% - 2 * var(--pad));
  height: calc(100% - 2 * var(--pad));
}
.trace-line,
.word-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trace-line {
  stroke: #f4d04f;
  opacity: 0.85;
}
.word-path {
  filter: drop-shadow(0 6px 0 #57281966);
}

/* Mahogany plates behind booster, settings, pause, and back icons. */
.booster-row {
  grid-template-columns: repeat(3, 60px);
  justify-content: space-evenly;
  align-items: center;
}
.booster {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  background: var(--icon-plate);
  border: 3px solid #f6e6bc;
  border-radius: 50%;
  box-shadow: var(--icon-plate-shadow);
  filter: none;
}
.booster img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  mix-blend-mode: lighten;
}
.booster span {
  right: -2px;
  top: -4px;
  z-index: 2;
  width: 22px;
  height: 22px;
  font-size: 11px;
  line-height: 1;
}

.home-top {
  justify-content: space-between;
  align-items: flex-start;
}
.home-settings {
  width: 50px;
  height: 50px;
  padding: 0;
  border: 3px solid #f6e6bc;
  border-radius: 50%;
  background: var(--icon-plate);
  box-shadow: var(--icon-plate-shadow);
  cursor: pointer;
  overflow: hidden;
  filter: none;
  transition:
    transform var(--fast),
    filter var(--fast);
}
.home-settings img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: lighten;
  transform: scale(0.8);
}
.home-settings:hover {
  filter: brightness(1.08);
}
.home-settings:active {
  transform: rotate(18deg) scale(0.94);
}

.round-asset {
  width: 48px;
  height: 48px;
  background: var(--icon-plate);
  border: 3px solid #f6e6bc;
  border-radius: 50%;
  box-shadow: var(--icon-plate-shadow);
  overflow: hidden;
  filter: none;
}
.round-asset img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: lighten;
  transform: scale(0.8);
}

/* Home actions support the logo instead of dominating the viewport. */
.home-actions {
  width: min(54vw, 240px);
  gap: 6px;
  margin: 4px auto auto;
  position: relative;
  z-index: 3;
}
.home-actions .asset-button,
.home-actions .asset-button img {
  width: 100%;
  height: 64px;
  object-fit: contain;
}

@media (max-width: 520px) {
  #home-screen .brand-lockup {
    margin: auto 0 18px;
  }
  #home-screen .brand-lockup .eyebrow {
    margin: 8px 0 6px;
  }
  #home-screen .tagline {
    margin-top: 6px;
    font-size: 15px;
  }
  #home-screen .home-actions {
    width: min(58vw, 220px);
    gap: 6px;
    margin: 8px auto auto;
  }
  #game-screen.screen {
    padding-top: max(16px, calc(env(safe-area-inset-top) + 8px));
  }
  #game-screen .game-topbar {
    margin-top: 0;
    min-height: 60px;
  }
  .level-label span,
  .screen-title .eyebrow {
    font-size: 10px;
    letter-spacing: 0.04em;
  }
  .level-label strong,
  .screen-title h2 {
    font-size: 18px;
  }
  #levels-screen.screen,
  #bookshelf-screen.screen {
    padding-top: max(16px, calc(env(safe-area-inset-top) + 8px));
  }
  #game-screen .status-row {
    margin-top: 6px;
  }
  #game-screen .word-hud {
    margin-top: 4px;
  }
  #game-screen .board-wrap {
    margin-top: 10px;
  }
}

@media (max-width: 420px) {
  .home-actions {
    width: min(60vw, 210px);
    gap: 5px;
  }
  .home-actions .asset-button,
  .home-actions .asset-button img {
    height: 58px;
  }
}
