:root {
  --ink: #10272d;
  --deep: #142f36;
  --deep-2: #0d242a;
  --cream: #f7f0df;
  --paper: #fffaf0;
  --mint: #70d7b0;
  --mint-dark: #289875;
  --gold: #ffc95d;
  --coral: #ff7e69;
  --blue: #68b8dc;
  --muted: #8aa0a2;
  --shadow: 0 12px 30px rgba(3, 23, 27, 0.25);
  --tile-gap: 8px;
  font-family: "Trebuchet MS", "Avenir Next", system-ui, sans-serif;
  color: var(--ink);
  background: var(--deep-2);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: 100svh;
  height: var(--app-height, 100svh);
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
body {
  background: radial-gradient(circle at 50% 0%, #2f5d61, var(--deep-2) 65%);
  position: fixed;
  inset: 0;
  width: 100%;
  display: grid;
  place-items: center;
  touch-action: manipulation;
}
button {
  font: inherit;
}
button:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 3px;
}

.game-shell {
  width: var(--stage-w, min(100%, calc(var(--app-height, 100svh) * 9 / 16)));
  height: var(--stage-h, min(var(--app-height, 100svh), calc(100vw * 16 / 9)));
  max-width: min(100%, 1080px);
  max-height: min(1920px, var(--app-height, 100svh));
  aspect-ratio: 9 / 16;
  margin: auto;
  position: relative;
  overflow: hidden;
  container-type: size;
  background:
    radial-gradient(
      circle at 15% 12%,
      rgba(112, 215, 176, 0.22),
      transparent 27%
    ),
    radial-gradient(
      circle at 90% 70%,
      rgba(104, 184, 220, 0.16),
      transparent 32%
    ),
    linear-gradient(155deg, #1d444b 0%, #112e35 58%, #0d242a 100%);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.42);
  isolation: isolate;
}

.game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.23;
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.25) 0.7px,
    transparent 0.7px
  );
  background-size: 11px 11px;
}

.ambient {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
  opacity: 0.35;
}
.ambient-one {
  width: 230px;
  height: 230px;
  background: #52bd99;
  top: -130px;
  right: -85px;
}
.ambient-two {
  width: 170px;
  height: 170px;
  background: #4583a5;
  bottom: -90px;
  left: -80px;
}
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow: hidden;
}
.screen.is-active {
  display: flex;
}

.menu-screen {
  align-items: center;
  justify-content: center;
  padding: max(16px, calc(env(safe-area-inset-top, 0px) - var(--stage-top-gap, 0px)))
    22px
    max(16px, calc(env(safe-area-inset-bottom, 0px) - var(--stage-bottom-gap, 0px)));
  color: var(--cream);
}
.menu-content {
  width: min(100%, 420px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.brand-mark {
  width: clamp(68px, 20vw, 96px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 26%;
  transform: rotate(-5deg);
  margin-bottom: 18px;
  background: linear-gradient(145deg, #fff8e8, #dacba9);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.55),
    inset 0 -8px 12px rgba(83, 54, 24, 0.16),
    0 16px 25px rgba(0, 0, 0, 0.3);
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 38px;
  height: 8px;
  border-radius: 99px;
  background: var(--mint);
  transform: translate(28px, -29px) rotate(30deg);
  box-shadow: 0 3px 0 #358c70;
}
.brand-mark span {
  color: var(--deep);
  font-size: clamp(38px, 12vw, 58px);
  font-weight: 1000;
  transform: rotate(5deg);
  text-shadow: 0 3px 0 #fff;
}
.eyebrow,
.modal-kicker {
  margin: 0 0 6px;
  color: var(--mint);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.2em;
}
h1 {
  margin: 0;
  font-size: clamp(2.9rem, 14vw, 5.2rem);
  line-height: 0.9;
  letter-spacing: -0.075em;
  font-weight: 1000;
  text-shadow: 0 7px 0 rgba(5, 24, 28, 0.34);
}
h1 span {
  color: var(--gold);
}
.tagline {
  font-size: clamp(1.1rem, 4.8vw, 1.45rem);
  line-height: 1.35;
  font-weight: 700;
  color: #cfdfdc;
  margin: 20px 0 24px;
}
.how-to {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 25px;
}
.how-step {
  min-width: 72px;
  display: grid;
  place-items: center;
  gap: 6px;
  color: #dceae6;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}
.how-step b {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.17);
  color: var(--gold);
  font-size: 1rem;
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.08);
}
.how-to i {
  height: 2px;
  width: 28px;
  margin-bottom: 21px;
  background: linear-gradient(
    90deg,
    rgba(112, 215, 176, 0.1),
    var(--mint),
    rgba(112, 215, 176, 0.1)
  );
}

.game-button {
  position: relative;
  border: 0;
  min-height: 64px;
  min-width: min(100%, 290px);
  padding: 0 32px;
  border-radius: 22px;
  color: #15342f;
  font-weight: 1000;
  letter-spacing: 0.08em;
  font-size: 1.08rem;
  cursor: pointer;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 33%),
    linear-gradient(135deg, #87e5bd, #4abe92);
  box-shadow:
    inset 0 -6px 0 rgba(17, 95, 74, 0.34),
    inset 0 2px 0 rgba(255, 255, 255, 0.75),
    0 10px 0 #0b211f,
    0 16px 28px rgba(0, 0, 0, 0.28);
  transition:
    transform 0.12s ease,
    filter 0.12s ease;
}
.game-button::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 17px;
  pointer-events: none;
}
.game-button:active {
  transform: translateY(7px);
  box-shadow:
    inset 0 -3px 0 rgba(17, 95, 74, 0.34),
    0 3px 0 #0b211f,
    0 8px 16px rgba(0, 0, 0, 0.22);
}
.game-button:hover {
  filter: brightness(1.05);
}
.play-glyph {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid #15342f;
  margin-right: 11px;
  transform: translateY(2px);
}
.secondary-button {
  margin-top: 13px;
  color: var(--cream);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.15), transparent 40%),
    linear-gradient(135deg, #48646a, #2b494f);
}
.danger-button {
  color: #4d1d19;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 36%),
    linear-gradient(135deg, #ff9b87, #ef6b5d);
}
.menu-meta {
  display: flex;
  gap: 40px;
  margin-top: 30px;
}
.menu-meta div {
  display: grid;
  gap: 2px;
}
.menu-meta span {
  color: #90aaa8;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}
.menu-meta strong {
  color: var(--cream);
  font-size: 1.15rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  position: relative;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 40%),
    linear-gradient(145deg, #35535a, #1d3940);
  box-shadow:
    inset 0 -4px rgba(3, 23, 27, 0.25),
    inset 0 1px rgba(255, 255, 255, 0.18),
    0 5px 10px rgba(0, 0, 0, 0.22);
}
.menu-sound {
  position: absolute;
  top: max(16px, calc(env(safe-area-inset-top, 0px) - var(--stage-top-gap, 0px)));
  right: 16px;
}
.pause-glyph::before,
.pause-glyph::after {
  content: "";
  position: absolute;
  top: 13px;
  width: 5px;
  height: 16px;
  border-radius: 2px;
  background: var(--cream);
  box-shadow: 0 2px #0d242a;
}
.pause-glyph::before {
  left: 15px;
}
.pause-glyph::after {
  right: 15px;
}
.sound-glyph::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 17px;
  width: 8px;
  height: 10px;
  background: var(--cream);
  border-radius: 2px;
  box-shadow: 5px 0 0 -1px var(--cream);
}
.sound-glyph::after {
  content: "))";
  position: absolute;
  color: var(--cream);
  font-weight: 900;
  font-size: 12px;
  top: 13px;
  left: 22px;
  letter-spacing: -4px;
}
.is-muted .sound-glyph::after {
  content: "×";
  color: var(--coral);
  font-size: 20px;
  top: 9px;
  left: 24px;
  letter-spacing: 0;
}

.play-screen {
  flex-direction: column;
  padding: max(8px, calc(env(safe-area-inset-top, 0px) - var(--stage-top-gap, 0px)))
    clamp(8px, 3.2cqi, 16px)
    max(8px, calc(env(safe-area-inset-bottom, 0px) - var(--stage-bottom-gap, 0px)));
  color: var(--cream);
  gap: clamp(4px, 1cqh, 10px);
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}
.level-chip {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-left: 4px;
}
.level-chip span {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #8fa8a7;
}
.level-chip strong {
  font-size: 1.38rem;
  color: var(--gold);
}
.timer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 92px;
  justify-content: center;
}
.timer strong {
  font-size: clamp(1.35rem, 6vw, 1.8rem);
  font-variant-numeric: tabular-nums;
}
.timer.is-urgent {
  color: #ff9b87;
  animation: timer-pulse 0.7s infinite alternate;
}
.clock-glyph {
  width: 19px;
  height: 19px;
  border: 3px solid currentColor;
  border-radius: 50%;
  position: relative;
}
.clock-glyph::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 2px;
  height: 6px;
  background: currentColor;
  transform-origin: bottom;
  transform: rotate(-30deg);
  border-radius: 2px;
}

.objective-panel {
  padding: 9px 13px 10px;
  border-radius: 17px;
  background: rgba(6, 28, 33, 0.58);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.08),
    0 6px 18px rgba(0, 0, 0, 0.12);
}
.objective-copy {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 6px;
}
.objective-copy div {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.objective-copy span {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  color: #8da8a6;
}
.objective-copy strong {
  font-size: 1.05rem;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.objective-copy small {
  color: #77918f;
  font-weight: 800;
  font-size: 0.7rem;
}
.progress-track {
  height: 8px;
  background: #071d22;
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}
.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4bc495, #95ebc2);
  box-shadow: 0 0 10px rgba(112, 215, 176, 0.55);
  transition: width 0.35s ease;
}

.word-panel {
  min-height: 52px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 2px;
  flex: 0 0 auto;
}
.current-word {
  min-height: 28px;
  max-width: 70%;
  color: var(--cream);
  font-size: clamp(1.28rem, 6vw, 1.8rem);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.current-word.is-valid {
  color: var(--mint);
  text-shadow: 0 0 14px rgba(112, 215, 176, 0.4);
}
.current-word.is-invalid {
  color: var(--coral);
}
.word-points {
  margin-top: 4px;
  color: #819c9a;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}
.combo-badge {
  position: absolute;
  left: 2px;
  top: 15px;
  color: #7f9998;
  font-size: 0.54rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.combo-badge strong {
  display: block;
  color: var(--gold);
  font-size: 0.78rem;
  text-align: center;
  margin-top: 2px;
}
.combo-badge.is-hot {
  animation: combo-pop 0.25s ease;
}

.board-stage {
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 auto;
  position: relative;
  display: grid;
  place-items: center;
  touch-action: none;
  container-type: size;
}
.board-frame {
  position: relative;
  width: 100%;
  width: min(100%, var(--board-side, 100cqh));
  max-width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 1;
  padding: clamp(4px, 1.2vw, 9px);
  container-type: inline-size;
  border-radius: clamp(18px, 5vw, 28px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
  pointer-events: auto;
  background-image:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 40%),
    linear-gradient(155deg, #102d34, #091f25);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.08),
    inset 0 10px 25px rgba(255, 255, 255, 0.025),
    0 15px 28px rgba(2, 18, 22, 0.34);
}
.board {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--board-size, 6), 1fr);
  grid-template-rows: repeat(var(--board-size, 6), 1fr);
  --tile-gap: clamp(5px, 1.8cqi, 12px);
  gap: var(--tile-gap);
  touch-action: none;
  user-select: none;
  background: transparent;
  pointer-events: none;
}
.tile {
  display: grid;
  place-items: center;
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: clamp(8px, 2.5vw, 15px);
  cursor: pointer;
  color: #101820;
  font-weight: 1000;
  font-size: clamp(0.95rem, 8.4cqi, 2.15rem);
  line-height: 1;
  text-shadow: 0 1px rgba(255, 255, 255, 0.7);
  background-image: linear-gradient(
    180deg,
    #ffffff 0%,
    #eef6fa 72%,
    #dceaf1 100%
  );
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.95),
    inset 0 -5px 0 rgba(18, 70, 92, 0.12),
    0 6px 0 #0a2430,
    0 9px 10px rgba(0, 0, 0, 0.28);
  transition: opacity 0.18s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  touch-action: none;
  pointer-events: none;
}
.tile-letter {
  position: relative;
  z-index: 1;
  pointer-events: none;
}
.tile::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: transparent;
  pointer-events: none;
}
.tile::after {
  content: attr(data-points);
  position: absolute;
  right: 8%;
  bottom: 8%;
  z-index: 1;
  color: rgba(24, 48, 55, 0.42);
  font-size: 0.24em;
  text-shadow: none;
  pointer-events: none;
}
.tile.is-selected {
  color: #101820;
  text-shadow: none;
  background-image: linear-gradient(180deg, #b6ff5a 0%, #5cff22 55%, #3de00f 100%);
}
.tile.is-selected::before {
  background: #4dff16;
  box-shadow: inset 0 0 0 2px rgba(198, 255, 120, 0.7);
}
.tile.is-selected::after {
  opacity: 0;
}
.tile.is-hinted {
  animation: hint-glow 0.7s ease-in-out 3 alternate;
}
.tile.is-tutorial-target {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.95),
    inset 0 -5px 0 rgba(18, 70, 92, 0.12),
    0 6px 0 #0a2430,
    0 0 18px rgba(82, 255, 28, 0.55);
}
.tile.is-bomb-target {
  animation: target-glow 0.55s ease-in-out infinite alternate;
}
.tile.is-removing {
  opacity: 0;
  transform: scale(0.35) rotate(8deg);
}
.tile.is-spawned {
  animation: spawn 0.32s cubic-bezier(0.2, 0.85, 0.25, 1.25);
}
.tile.is-invalid {
  background-image: linear-gradient(145deg, #ffd1c9, #ed8d7f);
}
.path-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  overflow: visible;
  z-index: 1;
}
.path-layer * {
  pointer-events: none !important;
}
.path-line {
  fill: none;
  stroke: #4dff16;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.path-line-outline {
  stroke: #2db30c;
}
.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  overflow: hidden;
}
.float-score {
  position: absolute;
  color: var(--gold);
  font-weight: 1000;
  font-size: 1.3rem;
  text-shadow:
    0 3px 0 #513718,
    0 6px 12px rgba(0, 0, 0, 0.35);
  animation: float-score 0.85s ease-out forwards;
}
.board-message {
  position: absolute;
  z-index: 10;
  left: 50%;
  top: 49%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  pointer-events: none;
  max-width: 88%;
  padding: 12px 20px;
  border-radius: 18px;
  white-space: nowrap;
  color: #fff8e8;
  font-weight: 1000;
  font-size: clamp(0.92rem, 4.4vw, 1.4rem);
  letter-spacing: 0.08em;
  background: rgba(6, 24, 28, 0.94);
  box-shadow:
    inset 0 0 0 2px rgba(255, 244, 218, 0.22),
    0 12px 28px rgba(0, 0, 0, 0.5);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
}
.board-message.show {
  animation: message-pop 0.9s ease forwards;
}
.play-screen.is-tutorial .tile:not(.is-tutorial-target) {
  opacity: 0.42;
  filter: saturate(0.7);
}
.play-screen.is-tutorial .tool-dock {
  opacity: 0.35;
  pointer-events: none;
}
.tutorial-guide {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  --hand-x1: 15%;
  --hand-y1: 30%;
  --hand-x2: 15%;
  --hand-y2: 75%;
  --trail-len: 40%;
  --trail-angle: 90deg;
}
.tutorial-guide[hidden] {
  display: none;
}
.tutorial-label {
  position: absolute;
  left: 50%;
  top: 4%;
  transform: translateX(-50%);
  min-width: 230px;
  padding: 10px 18px;
  text-align: center;
  border-radius: 16px;
  color: var(--cream);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), transparent 42%),
    linear-gradient(145deg, #31555c, #17383f);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.09),
    0 8px 20px rgba(0, 0, 0, 0.3);
}
.tutorial-label strong {
  display: block;
  color: var(--gold);
  font-size: 0.95rem;
  letter-spacing: 0.16em;
}
.tutorial-label span {
  display: block;
  margin-top: 2px;
  color: #d7e6e2;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.tutorial-label small {
  display: block;
  margin-top: 3px;
  color: #9fc4bf;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
}
.tutorial-skip {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  pointer-events: auto;
  min-width: 132px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  color: #142b33;
  background: var(--gold);
  font-weight: 900;
  letter-spacing: 0.12em;
  box-shadow: 0 4px 0 #9a6d1c;
  cursor: pointer;
}
.tutorial-skip:active {
  transform: translateX(-50%) translateY(2px);
  box-shadow: 0 2px 0 #9a6d1c;
}
.tutorial-trail {
  position: absolute;
  left: var(--hand-x1);
  top: var(--hand-y1);
  width: var(--trail-len);
  height: 5px;
  border-radius: 99px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 201, 93, 0.15) 0 8px,
    var(--gold) 8px 17px
  );
  box-shadow: 0 0 15px rgba(255, 201, 93, 0.65);
  transform: translateY(-50%) rotate(var(--trail-angle));
  transform-origin: left center;
  animation: trail-pulse 0.8s ease-in-out infinite alternate;
}
.tutorial-guide img {
  position: absolute;
  left: var(--hand-x1);
  top: var(--hand-y1);
  width: 64px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 7px 5px rgba(0, 0, 0, 0.4));
  transform: translate(-18%, -12%);
  animation: tutorial-drag 1.8s ease-in-out infinite;
}
.tutorial-guide.is-holding .tutorial-trail,
.tutorial-guide.is-holding img {
  opacity: 0;
  animation: none;
}

.tool-dock {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(7px, 2vw, 12px);
  width: min(100%, 510px);
  margin: 0 auto;
  flex: 0 0 auto;
}
.tool-button {
  min-height: clamp(50px, 7.2vh, 68px);
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: 1fr;
  align-items: center;
  padding: 7px 27px 7px 10px;
  color: #dbe8e4;
  font-size: clamp(0.58rem, 2.7vw, 0.76rem);
  font-weight: 1000;
  letter-spacing: 0.06em;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), transparent 42%),
    linear-gradient(145deg, #35545b, #1e3b42);
  box-shadow:
    inset 0 -5px rgba(3, 23, 27, 0.28),
    inset 0 1px rgba(255, 255, 255, 0.16),
    0 6px 9px rgba(0, 0, 0, 0.24);
}
.tool-button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 -2px rgba(3, 23, 27, 0.28),
    0 2px 4px rgba(0, 0, 0, 0.2);
}
.tool-button:disabled {
  opacity: 0.38;
  filter: grayscale(0.5);
  cursor: not-allowed;
}
.tool-button b {
  position: absolute;
  right: 7px;
  top: 7px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border-radius: 8px;
  background: #0b262c;
  color: var(--gold);
  font-size: 0.66rem;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1);
}
.bomb-button {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(145deg, #695a43, #3f3b35);
}
.bomb-button.is-armed {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(145deg, #e09f48, #a95c3d);
  box-shadow:
    inset 0 -5px rgba(85, 40, 16, 0.3),
    0 0 18px rgba(255, 174, 77, 0.48);
}
.tool-glyph {
  position: relative;
  width: 27px;
  height: 27px;
  display: block;
  justify-self: center;
}
.shuffle-glyph::before,
.shuffle-glyph::after {
  content: "";
  position: absolute;
  left: 3px;
  width: 20px;
  height: 8px;
  border: 3px solid var(--blue);
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 12px 0 0;
}
.shuffle-glyph::before {
  top: 3px;
  transform: rotate(12deg);
}
.shuffle-glyph::after {
  bottom: 3px;
  transform: rotate(192deg);
}
.bomb-glyph {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    #ffe2a0,
    #ee8a4f 23%,
    #402c29 26%,
    #161e20 70%
  );
  box-shadow: 0 3px 0 #071c21;
}
.bomb-glyph::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 7px;
  border: 3px solid var(--gold);
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 8px 0 0;
  top: -6px;
  right: -4px;
  transform: rotate(-22deg);
}
.hint-glyph::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 4px;
  top: 1px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow:
    inset 0 -4px rgba(130, 83, 20, 0.25),
    0 2px 0 #15282c;
}
.hint-glyph::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 7px;
  left: 8px;
  bottom: 1px;
  border-radius: 2px 2px 5px 5px;
  background: #e2a944;
  box-shadow: 0 2px 0 #15282c;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(4, 19, 23, 0.78);
  backdrop-filter: blur(8px);
}
.modal-backdrop.is-open {
  display: grid;
}
.game-modal {
  display: none;
  width: min(100%, 390px);
  padding: 34px 25px 28px;
  text-align: center;
  color: var(--cream);
  border-radius: 30px;
  background-image:
    linear-gradient(155deg, rgba(255, 255, 255, 0.12), transparent 35%),
    linear-gradient(145deg, #244b52, #102f36);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.1),
    inset 0 -10px rgba(3, 21, 25, 0.14),
    0 24px 55px rgba(0, 0, 0, 0.45);
  animation: modal-in 0.22s ease-out;
}
.game-modal.is-open {
  display: block;
}
.game-modal h2 {
  margin: 0 0 25px;
  font-size: clamp(2rem, 10vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}
.game-modal .game-button {
  display: block;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.text-action {
  margin-top: 25px;
  color: #aac0bd;
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.result-emblem {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  margin: -65px auto 20px;
  border-radius: 21px;
  color: var(--deep);
  font-size: 2rem;
  font-weight: 1000;
  background: linear-gradient(145deg, #fff4d6, #e4be67);
  transform: rotate(-6deg);
  box-shadow:
    inset 0 2px rgba(255, 255, 255, 0.7),
    0 9px 0 #0a252b,
    0 15px 24px rgba(0, 0, 0, 0.3);
}
.result-score {
  display: grid;
  place-items: center;
  padding: 15px;
  margin: -8px 0 14px;
  border-radius: 18px;
  background: rgba(4, 24, 29, 0.35);
}
.result-score span,
.result-stats span {
  color: #89a4a2;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}
.result-score strong {
  color: var(--gold);
  font-size: 2.35rem;
  font-variant-numeric: tabular-nums;
}
.result-score small {
  display: none;
  color: var(--mint);
  font-weight: 900;
  font-size: 0.66rem;
  letter-spacing: 0.15em;
}
.result-score small.is-visible {
  display: block;
}
.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}
.result-stats div {
  display: grid;
  gap: 5px;
  padding: 11px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}
.result-stats strong {
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-modal p:not(.modal-kicker) {
  color: #adc1be;
  margin: -12px 0 23px;
}
.howto-modal h2 {
  margin-bottom: 18px;
}
.howto-steps {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}
.howto-steps li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(4, 24, 29, 0.35);
}
.howto-steps b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #13352e;
  background: linear-gradient(145deg, #8ae8c0, #4bbd94);
}
.howto-steps strong {
  display: block;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
.howto-steps span {
  display: block;
  margin-top: 2px;
  color: #9eb8b5;
  font-size: 0.72rem;
  font-weight: 700;
}
.howto-demo {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 12px;
}
.howto-demo b {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 86px;
  height: 16px;
  transform: translate(-50%, -50%);
  background: #4dff16;
  border-radius: 99px;
  box-shadow: 0 0 0 3px #2db30c;
}
.howto-demo i {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 1000;
  font-size: 1.35rem;
  color: #101820;
  border-radius: 12px;
  background: #4dff16;
  box-shadow:
    inset 0 0 0 2px rgba(198, 255, 120, 0.7),
    0 4px 0 #0a2430;
}
.howto-note {
  margin: 0 0 18px;
  color: #9eb8b5;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Raster UI icon sprite: sound, shuffle, bomb, hint. */
.sound-glyph,
.tool-glyph { background-image: url("assets/ui-icon-sprite.png") !important; background-repeat: no-repeat !important; background-size: 200% 200% !important; }
.sound-glyph { position: absolute; inset: 7px; background-position: 0 0 !important; }
.tool-glyph { width: 36px; height: 36px; filter: drop-shadow(0 3px 2px rgba(0,0,0,.28)); }
.shuffle-glyph { background-position: 100% 0 !important; }
.bomb-glyph { border-radius: 0; background-position: 0 100% !important; box-shadow: none; }
.hint-glyph { background-position: 100% 100% !important; }
.sound-glyph::before, .sound-glyph::after,
.shuffle-glyph::before, .shuffle-glyph::after,
.bomb-glyph::before, .bomb-glyph::after,
.hint-glyph::before, .hint-glyph::after { display: none !important; content: none !important; }
.is-muted .sound-glyph { opacity: .38; filter: grayscale(1); }

@keyframes timer-pulse {
  to {
    transform: scale(1.05);
  }
}
@keyframes combo-pop {
  50% {
    transform: scale(1.18);
  }
}
@keyframes hint-glow {
  to {
    filter: brightness(1.18);
    box-shadow:
      inset 0 0 0 3px var(--gold),
      0 6px 0 #5a421c,
      0 0 20px rgba(255, 201, 93, 0.75);
  }
}
@keyframes target-glow {
  to {
    box-shadow:
      inset 0 0 0 3px var(--coral),
      0 5px 0 #572e2a,
      0 0 18px rgba(255, 126, 105, 0.7);
  }
}
@keyframes spawn {
  from {
    transform: translateY(-35px) scale(0.8);
    opacity: 0;
  }
}
@keyframes float-score {
  to {
    transform: translateY(-70px) scale(1.12);
    opacity: 0;
  }
}
@keyframes message-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.65);
  }
  22%,
  65% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(1.08);
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}
@keyframes tutorial-drag {
  0%,
  12% {
    left: var(--hand-x1);
    top: var(--hand-y1);
    transform: translate(-18%, -12%) scale(1);
    opacity: 0;
  }
  20% {
    opacity: 1;
    transform: translate(-18%, -12%) scale(0.92);
  }
  72% {
    left: var(--hand-x2);
    top: var(--hand-y2);
    opacity: 1;
    transform: translate(-18%, -12%) scale(0.92);
  }
  88%,
  100% {
    left: var(--hand-x2);
    top: var(--hand-y2);
    opacity: 0;
    transform: translate(-18%, -12%) scale(1);
  }
}
@keyframes trail-pulse {
  to {
    filter: brightness(1.35);
    opacity: 0.65;
  }
}

@media (max-height: 700px) {
  .play-screen {
    gap: 4px;
  }
  .game-header {
    min-height: 40px;
  }
  .icon-button {
    width: 40px;
    height: 40px;
  }
  .objective-panel {
    padding-top: 6px;
    padding-bottom: 7px;
  }
  .word-panel {
    min-height: 46px;
  }
  .combo-badge {
    top: 6px;
  }
  .tool-button {
    min-height: 50px;
  }
  .tagline {
    margin: 12px 0 16px;
  }
  .how-to {
    margin-bottom: 17px;
  }
  .brand-mark {
    margin-bottom: 10px;
  }
}

@media (max-width: 699px) {
  :root {
    --tile-gap: clamp(4px, 1.6cqi, 8px);
  }
  .current-word {
    font-size: clamp(1.05rem, 5.8cqi, 1.45rem);
    letter-spacing: 0.1em;
  }
  .combo-badge {
    top: 8px;
    font-size: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
