:root {
  color-scheme: light;
  --ink: #2c2119;
  --muted: #776b5e;
  --paper: #fffaf0;
  --cream: #f4ead7;
  --cream-dark: #e7d6bb;
  --forest: #254c3d;
  --forest-light: #dbe9df;
  --gold: #d9a520;
  --gold-dark: #8c6510;
  --tyrian: #630330;
  --tyrian-light: #8a174b;
  --tyrian-dark: #3d001c;
  --fence: #111;
  --open: #c8c4bc;
  --selected: #74aef7;
  --danger: #a64132;
  --shadow: 0 18px 50px rgb(72 45 24 / 12%);
}

* {
  box-sizing: border-box;
}

html {
  background: #fff;
}

body {
  min-width: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(37 76 61 / 30%);
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  width: min(100% - 28px, 690px);
  margin: 0 auto;
  padding:
    max(30px, env(safe-area-inset-top))
    env(safe-area-inset-right)
    max(50px, env(safe-area-inset-bottom))
    env(safe-area-inset-left);
}

.status-panel,
.action-row,
.legend {
  display: flex;
  align-items: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--forest);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  font-size: clamp(1.25rem, 4.5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.9;
}

.launch-screen {
  position: relative;
  z-index: 20;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding:
    max(28px, env(safe-area-inset-top))
    24px
    max(28px, env(safe-area-inset-bottom));
}

.launch-screen[hidden],
.tutorial-screen[hidden],
.app-shell[hidden],
.help-screen[hidden] {
  display: none;
}

.launch-card {
  width: min(100%, 560px);
  min-width: 0;
  text-align: center;
}

.launch-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38em;
  font-size: clamp(2.35rem, 9.6vw, 4.1rem);
  line-height: 1;
  margin-bottom: 18px;
}

.launch-logo {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  border-radius: 22%;
  box-shadow: 0 12px 30px rgb(61 0 28 / 25%);
}

.launch-title {
  max-width: 100%;
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1em;
  font-weight: 650;
  letter-spacing: -0.075em;
  line-height: 0.96;
  overflow-wrap: anywhere;
}

.launch-preview-demo {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 360px);
  margin: 14px auto 0;
}

.launch-preview-board {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: clamp(236px, 82vw, 292px);
  padding: 10px;
  border: 1px solid var(--cream-dark);
  border-radius: 13px;
  background: #ead9bd;
  box-shadow: inset 0 2px 10px rgb(90 50 30 / 12%);
}

.launch-preview-v3 {
  grid-template-columns: repeat(7, 1fr);
  width: min(100%, 292px);
  padding: 9px;
  gap: 4px;
}

.launch-preview-v4 {
  grid-template-columns: repeat(7, 1fr);
  width: clamp(236px, 82vw, 292px);
  padding: 8px;
  gap: 3px;
}

.launch-preview-v3 span {
  font-size: clamp(0.88rem, 3.1vw, 1.12rem);
}

.launch-preview-v4 span {
  font-size: clamp(0.88rem, 3.1vw, 1.12rem);
}

.launch-preview-v3 .preview-crown-tile {
  overflow: visible;
  color: transparent;
}

.launch-preview-v4 .preview-crown-tile {
  overflow: visible;
  color: var(--forest);
}

.launch-preview-v4 .preview-crown-letter {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--forest);
  font: inherit;
  line-height: 1;
}

.launch-preview-v4 .preview-crown-spot {
  border-color: transparent;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  transition: background 260ms ease, color 260ms ease, border-color 260ms ease, transform 260ms ease, box-shadow 260ms ease;
}

.launch-preview-v4 .preview-crown-spot::after {
  position: absolute;
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #111;
  box-shadow: inset -2px -3px 0 rgb(35 15 8 / 22%), 0 2px 4px rgb(44 33 25 / 22%);
  content: "";
  opacity: 0;
  transform: scale(0.45);
  transition: opacity 260ms ease, transform 260ms ease;
}

.launch-preview-v4 .preview-crown {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 104%;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: #fff7c6;
  background: radial-gradient(circle at 35% 28%, var(--tyrian-light), var(--tyrian) 55%, var(--tyrian-dark));
  box-shadow: 0 4px 8px rgb(61 0 28 / 28%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 5vw, 1.6rem);
  font-style: normal;
  line-height: 1;
  transition: transform 420ms ease, opacity 420ms ease;
}

.launch-preview-board span {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  font-size: clamp(0.88rem, 3.1vw, 1.12rem);
  font-weight: 800;
  line-height: 1;
}

.launch-preview-v2 .preview-chain,
.launch-preview-v3 .preview-chain {
  border-color: rgb(44 33 25 / 12%);
  color: var(--forest);
  background: #fffdfa;
  animation: previewChainTile 5.6s ease-in-out infinite;
}

.launch-preview-v2 .preview-chain::after,
.launch-preview-v3 .preview-chain::after {
  position: absolute;
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #111;
  box-shadow: inset -2px -3px 0 rgb(35 15 8 / 22%), 0 2px 4px rgb(44 33 25 / 22%);
  content: "";
  opacity: 0;
  transform: scale(0.45);
  animation: previewChainDot 5.6s ease-in-out infinite;
}

.launch-preview-v4 .preview-cager {
  border-color: rgb(44 33 25 / 12%);
  color: var(--forest);
  background: #fffdfa;
  transition: background 260ms ease, color 260ms ease, border-color 260ms ease, transform 260ms ease, box-shadow 260ms ease;
}

.launch-preview-v4 .preview-cager::after {
  position: absolute;
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #111;
  box-shadow: inset -2px -3px 0 rgb(35 15 8 / 22%), 0 2px 4px rgb(44 33 25 / 22%);
  content: "";
  opacity: 0;
  transform: scale(0.45);
  transition: opacity 260ms ease, transform 260ms ease;
}

.launch-preview-v2 .preview-chain-2,
.launch-preview-v2 .preview-chain-2::after {
  animation-delay: 0.1s;
}

.launch-preview-v2 .preview-chain-3,
.launch-preview-v2 .preview-chain-3::after {
  animation-delay: 0.2s;
}

.launch-preview-v2 .preview-chain-4,
.launch-preview-v2 .preview-chain-4::after {
  animation-delay: 0.3s;
}

.launch-preview-v2 .preview-chain-5,
.launch-preview-v2 .preview-chain-5::after {
  animation-delay: 0.4s;
}

.launch-preview-v2 .preview-chain-6,
.launch-preview-v2 .preview-chain-6::after {
  animation-delay: 0.5s;
}

.launch-preview-v2 .preview-chain-7,
.launch-preview-v2 .preview-chain-7::after {
  animation-delay: 0.6s;
}

.launch-preview-v2 .preview-chain-8,
.launch-preview-v2 .preview-chain-8::after {
  animation-delay: 0.7s;
}

.launch-preview-v2 .preview-crown-tile,
.launch-preview-v3 .preview-crown-tile {
  overflow: visible;
  color: transparent;
}

.launch-preview-v2 .preview-crown-tile::before,
.launch-preview-v3 .preview-crown-tile::before {
  content: attr(data-letter);
  color: var(--forest);
  opacity: 0;
  animation: previewCrownTile 5.6s ease-in-out infinite;
}

.launch-preview-v2 .preview-crown {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 104%;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: #fff7c6;
  background: radial-gradient(circle at 35% 28%, var(--tyrian-light), var(--tyrian) 55%, var(--tyrian-dark));
  box-shadow: 0 4px 8px rgb(61 0 28 / 28%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 5vw, 1.6rem);
  font-style: normal;
  line-height: 1;
  animation: previewCrownMoveV2 5.6s ease-in-out infinite;
}

.launch-preview-v3 .preview-crown {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 104%;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: #fff7c6;
  background: radial-gradient(circle at 35% 28%, var(--tyrian-light), var(--tyrian) 55%, var(--tyrian-dark));
  box-shadow: 0 4px 8px rgb(61 0 28 / 28%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 5vw, 1.6rem);
  font-style: normal;
  line-height: 1;
  animation: previewCrownMoveV3 6.6s ease-in-out infinite;
}

.preview-built-word-v2 {
  grid-template-columns: repeat(8, 1.1em);
  min-width: 8.8em;
}

.preview-built-word-v2-short {
  grid-template-columns: repeat(5, 1.25em);
  min-width: 6.25em;
}

.preview-built-word-v3-short {
  grid-template-columns: repeat(5, 1.25em);
  min-width: 6.25em;
}

.preview-built-word-v4-word {
  grid-template-columns: repeat(5, 1.25em);
  min-width: 6.25em;
  width: max-content;
  margin: 0 auto;
  justify-content: center;
}

.preview-built-word-v2 .preview-built-letter {
  opacity: 0;
  transform: translateX(-12px) scale(0.86);
}

.preview-built-word-v2 .preview-built-1 {
  animation: previewBuiltLetterV2 5.6s ease-in-out infinite;
}

.preview-built-word-v2 .preview-built-2 {
  animation: previewBuiltLetterV2 5.6s ease-in-out 0.1s infinite;
}

.preview-built-word-v2 .preview-built-3 {
  animation: previewBuiltLetterV2 5.6s ease-in-out 0.2s infinite;
}

.preview-built-word-v2 .preview-built-4 {
  animation: previewBuiltLetterV2 5.6s ease-in-out 0.3s infinite;
}

.preview-built-word-v2 .preview-built-5 {
  animation: previewBuiltLetterV2 5.6s ease-in-out 0.4s infinite;
}

.preview-built-word-v2 .preview-built-6 {
  animation: previewBuiltLetterV2 5.6s ease-in-out 0.5s infinite;
}

.preview-built-word-v2 .preview-built-7 {
  animation: previewBuiltLetterV2 5.6s ease-in-out 0.6s infinite;
}

.preview-built-word-v2 .preview-built-8 {
  animation: previewBuiltLetterV2 5.6s ease-in-out 0.7s infinite;
}

.preview-built-word-v2-short .preview-built-letter {
  opacity: 0;
  transform: translateX(-12px) scale(0.86);
}

.preview-built-word-v3-short .preview-built-letter {
  opacity: 0;
  transform: translateX(-12px) scale(0.86);
}

.preview-built-word-v2-short .preview-built-1 {
  animation: previewBuiltLetterV2Short 5.6s ease-in-out infinite;
}

.preview-built-word-v2-short .preview-built-2 {
  animation: previewBuiltLetterV2Short 5.6s ease-in-out 0.1s infinite;
}

.preview-built-word-v2-short .preview-built-3 {
  animation: previewBuiltLetterV2Short 5.6s ease-in-out 0.2s infinite;
}

.preview-built-word-v2-short .preview-built-4 {
  animation: previewBuiltLetterV2Short 5.6s ease-in-out 0.3s infinite;
}

.preview-built-word-v2-short .preview-built-5 {
  animation: previewBuiltLetterV2Short 5.6s ease-in-out 0.4s infinite;
}

.preview-built-word-v3-short .preview-built-1 {
  animation: previewBuiltLetterV2Short 6.6s ease-in-out infinite;
}

.preview-built-word-v3-short .preview-built-2 {
  animation: previewBuiltLetterV2Short 6.6s ease-in-out 0.11s infinite;
}

.preview-built-word-v3-short .preview-built-3 {
  animation: previewBuiltLetterV2Short 6.6s ease-in-out 0.22s infinite;
}

.preview-built-word-v3-short .preview-built-4 {
  animation: previewBuiltLetterV2Short 6.6s ease-in-out 0.33s infinite;
}

.preview-built-word-v3-short .preview-built-5 {
  animation: previewBuiltLetterV2Short 6.6s ease-in-out 0.44s infinite;
}

.preview-built-word-v4-word .preview-built-letter {
  opacity: 0;
  transform: translateX(-12px) scale(0.86);
}

.preview-built-word-v4-word .preview-built-1 {
  animation: previewBuiltLetterV4 7.2s ease-in-out infinite;
}

.preview-built-word-v4-word .preview-built-2 {
  animation: previewBuiltLetterV4 7.2s ease-in-out 0.08s infinite;
}

.preview-built-word-v4-word .preview-built-3 {
  animation: previewBuiltLetterV4 7.2s ease-in-out 0.16s infinite;
}

.preview-built-word-v4-word .preview-built-4 {
  animation: previewBuiltLetterV4 7.2s ease-in-out 0.24s infinite;
}

.preview-built-word-v4-word .preview-built-5 {
  animation: previewBuiltLetterV4 7.2s ease-in-out 0.32s infinite;
}

.preview-built-word {
  display: grid;
  grid-template-columns: repeat(5, 1.45em);
  min-width: 7.25em;
  color: var(--tyrian-dark);
  font-size: clamp(1.02rem, 4vw, 1.34rem);
  font-weight: 900;
  letter-spacing: 0.03em;
}

.preview-built-letter {
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateX(-18px) scale(0.85);
}

.preview-built-f {
  animation: previewBuiltConsonant 4.8s ease-in-out infinite;
}

.preview-built-n {
  animation: previewBuiltConsonant 4.8s ease-in-out 0.12s infinite;
}

.preview-built-c {
  animation: previewBuiltConsonant 4.8s ease-in-out 0.24s infinite;
}

.preview-built-e {
  color: var(--gold-dark);
  animation: previewBuiltVowel 4.8s ease-in-out infinite;
}

.launch-description {
  max-width: 390px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 3.7vw, 1.08rem);
  line-height: 1.45;
}

.preview-caption-stack {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(100%, 320px);
  margin: 0 auto;
  min-height: 2.7em;
  color: var(--tyrian-dark);
  font-size: clamp(0.98rem, 3.7vw, 1.12rem);
  font-weight: 850;
  line-height: 1.25;
  text-align: center;
}

.preview-caption {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.launch-preview-v4[data-preview-stage="1a"] .preview-crown {
  transform: translate(-50%, -50%);
  opacity: 1;
}

.launch-preview-v4[data-preview-stage="1b"] .preview-crown,
.launch-preview-v4[data-preview-stage="2"] .preview-crown,
.launch-preview-v4[data-preview-stage="3a"] .preview-crown,
.launch-preview-v4[data-preview-stage="3b"] .preview-crown,
.launch-preview-v4[data-preview-stage="3c"] .preview-crown {
  transform: translate(calc(-156% - 4px), -50%);
  opacity: 1;
}

.launch-preview-v4[data-preview-stage="1a"] .preview-crown-spot,
.launch-preview-v4[data-preview-stage="1b"] .preview-crown-spot {
  border-color: transparent;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.launch-preview-v4[data-preview-stage="1b"] .preview-crown-spot::after,
.launch-preview-v4[data-preview-stage="2"] .preview-crown-spot::after,
.launch-preview-v4[data-preview-stage="3a"] .preview-crown-spot::after,
.launch-preview-v4[data-preview-stage="3b"] .preview-crown-spot::after,
.launch-preview-v4[data-preview-stage="3c"] .preview-crown-spot::after {
  opacity: 1;
  transform: scale(1);
}

.launch-preview-v4[data-preview-stage="1b"] .preview-crown-spot,
.launch-preview-v4[data-preview-stage="2"] .preview-crown-spot,
.launch-preview-v4[data-preview-stage="3a"] .preview-crown-spot,
.launch-preview-v4[data-preview-stage="3b"] .preview-crown-spot,
.launch-preview-v4[data-preview-stage="3c"] .preview-crown-spot {
  border-color: transparent;
  color: transparent;
  background: transparent;
  box-shadow: none;
}

.launch-preview-v4[data-preview-stage="3b"] .preview-cager,
.launch-preview-v4[data-preview-stage="3c"] .preview-cager {
  border-color: transparent;
  color: transparent;
  background: transparent;
  box-shadow: none;
}

.launch-preview-v4[data-preview-stage="3b"] .preview-cager::after,
.launch-preview-v4[data-preview-stage="3c"] .preview-cager::after {
  opacity: 1;
  transform: scale(1);
}

.launch-preview-v4[data-preview-stage="3b"] .preview-cager-6,
.launch-preview-v4[data-preview-stage="3c"] .preview-cager-6 {
  border-color: transparent;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.launch-preview-v4[data-preview-stage="3b"] .preview-cager-6::after,
.launch-preview-v4[data-preview-stage="3c"] .preview-cager-6::after {
  opacity: 0;
  transform: scale(0.45);
}

.launch-preview-v4[data-preview-stage="3b"] .preview-crown-tile,
.launch-preview-v4[data-preview-stage="3c"] .preview-crown-tile {
  border-color: transparent;
  color: transparent;
  background: transparent;
  box-shadow: none;
}

.launch-preview-v4[data-preview-stage="3b"] .preview-crown-tile::after,
.launch-preview-v4[data-preview-stage="3c"] .preview-crown-tile::after {
  opacity: 1;
  transform: scale(1);
}

.launch-preview-v4[data-preview-stage="3b"] .preview-crown-letter,
.launch-preview-v4[data-preview-stage="3c"] .preview-crown-letter {
  opacity: 0;
}

.launch-preview-v4[data-preview-stage="3b"] .preview-crown,
.launch-preview-v4[data-preview-stage="3c"] .preview-crown {
  opacity: 1;
}

.launch-preview-v4[data-preview-stage="1a"] .preview-cager,
.launch-preview-v4[data-preview-stage="1b"] .preview-cager,
.launch-preview-v4[data-preview-stage="2"] .preview-cager,
.launch-preview-v4[data-preview-stage="3a"] .preview-cager {
  border-color: transparent;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.launch-preview-v4[data-preview-stage="1a"] .preview-cager::after,
.launch-preview-v4[data-preview-stage="1b"] .preview-cager::after,
.launch-preview-v4[data-preview-stage="2"] .preview-cager::after,
.launch-preview-v4[data-preview-stage="3a"] .preview-cager::after {
  opacity: 0;
  transform: scale(0.45);
}

.launch-note {
  margin: 8px auto 28px;
  color: var(--forest);
  font-size: 0.82rem;
  font-weight: 750;
}

.launch-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.launch-button {
  min-width: min(100%, 236px);
}

.launch-practice-button {
  border-color: rgb(44 33 25 / 16%);
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 0 rgb(44 33 25 / 8%);
}

.launch-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 12px auto 0;
  padding: 0;
  border: 0;
  color: var(--forest);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.14em;
  cursor: pointer;
}

.tutorial-screen {
  width: min(100% - 28px, 690px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    0
    max(28px, env(safe-area-inset-bottom));
}

.tutorial-header {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  margin-bottom: 16px;
}

.tutorial-stage {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: 100%;
}

.tutorial-message-panel {
  width: min(100%, 430px);
  text-align: center;
}

.tutorial-message {
  margin: 8px auto 0;
  color: #1e5fa8;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.35;
}

.tutorial-board-area {
  position: relative;
  width: 100%;
}

.tutorial-board {
  pointer-events: none;
}

.tutorial-board span,
.tutorial-word-row span {
  display: grid;
  place-items: center;
  font-weight: 850;
}

.tutorial-board > span {
  position: relative;
  z-index: 2;
  aspect-ratio: 1;
  color: var(--ink);
  font-size: 1.12rem;
}

.tutorial-board > span::before {
  position: absolute;
  inset: 18%;
  z-index: -1;
  border-radius: 50%;
  background: rgb(255 255 255 / 35%);
  content: "";
}

.tutorial-board .tutorial-crown-tile::before {
  inset: 6%;
  border: 2px solid var(--gold);
  background: radial-gradient(circle at 35% 28%, var(--tyrian-light), var(--tyrian) 55%, var(--tyrian-dark));
  box-shadow: 0 4px 9px rgb(61 0 28 / 35%);
}

.tutorial-board > span.tutorial-tapping::before,
.tutorial-board > span.tutorial-selected::before {
  background: var(--selected);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 20%);
}

.tutorial-board > span.tutorial-tapping {
  transform: scale(1.06);
}

.tutorial-board > span.tutorial-selected {
  color: var(--ink);
}

.tutorial-board > span.tutorial-cage-post {
  color: transparent;
}

.tutorial-board > span.tutorial-cage-post::before {
  content: none;
}

.tutorial-board > span.tutorial-cage-post::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 45%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--fence);
  box-shadow: inset -2px -3px 0 rgb(35 15 8 / 22%), 0 2px 4px rgb(44 33 25 / 22%);
  content: "";
  transform: translate(-50%, -50%);
}

.tutorial-tap-marker {
  position: absolute;
  z-index: 20;
  width: 26px;
  height: 26px;
  border: 2px solid #111;
  border-radius: 50%;
  background: rgb(255 255 255 / 82%);
  box-shadow: 0 6px 16px rgb(44 33 25 / 18%);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
}

.tutorial-tap-marker[hidden] {
  display: none;
}

.tutorial-tap-marker.is-tapping {
  animation: tutorialTap 520ms ease-out;
}

.tutorial-crown-letter-popup {
  position: absolute;
  z-index: 30;
  min-width: 112px;
  padding: 7px 10px;
  border: 1px solid rgb(44 33 25 / 18%);
  border-radius: 999px;
  color: #fff;
  background: #111;
  box-shadow: 0 8px 18px rgb(44 33 25 / 18%);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
}

.tutorial-crown-letter-popup[hidden] {
  display: none;
}

@keyframes tutorialTap {
  0% {
    opacity: 0;
    transform: translate(-50%, -85%) scale(0.76);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.84);
  }
  70% {
    opacity: 0.88;
    transform: translate(-50%, -50%) scale(1.18);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.65);
  }
}

.tutorial-crown-tile span {
  opacity: 0;
}

.tutorial-crown-tile i {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  color: #fff7c6;
  font-family: Georgia, serif;
  font-size: clamp(2.2rem, 12vw, 4rem);
  font-style: normal;
  line-height: 1;
  transform: translate(-50%, -56%);
}

.tutorial-word-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}

.tutorial-word-row span {
  width: 30px;
  aspect-ratio: 1;
  border-radius: 9px;
  background: #ead9bd;
  box-shadow: inset 0 0 0 1px var(--cream-dark);
  transition: transform 420ms ease, box-shadow 220ms ease, background 220ms ease;
}

.tutorial-word-row.is-dragging span[data-letter="G"] {
  transform: translateX(36px);
}

.tutorial-word-row span.is-shifting-left {
  transform: translateX(-36px);
}

.tutorial-word-row span.is-dragged {
  position: relative;
  z-index: 4;
  background: #fff4d2;
  box-shadow:
    inset 0 0 0 1px var(--gold),
    0 10px 18px rgb(44 33 25 / 22%);
  animation: tutorialWordDrag 900ms ease-in-out forwards;
}

.tutorial-word-row span.is-settled {
  animation: tutorialWordDrop 460ms ease-out;
}

.tutorial-word-row span.tutorial-word-tapping {
  transform: scale(1.08);
  background: #fff4d2;
  box-shadow:
    inset 0 0 0 1px var(--gold),
    0 6px 12px rgb(44 33 25 / 16%);
}

@keyframes tutorialWordDrag {
  0% {
    transform: translate(0, 0) scale(1);
  }
  22% {
    transform: translate(0, -16px) scale(1.08);
  }
  72% {
    transform: translate(var(--drag-x), -16px) scale(1.08);
  }
  100% {
    transform: translate(var(--drag-x), 0) scale(1);
  }
}

@keyframes tutorialWordDrop {
  0% {
    transform: scale(1.12);
    background: #fff4d2;
  }
  100% {
    transform: scale(1);
    background: #ead9bd;
  }
}

.tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
}

.tutorial-actions .primary-button.is-validating {
  animation: tutorialValidatePress 880ms ease-in-out;
}

@keyframes tutorialValidatePress {
  0% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
    box-shadow: none;
  }
  22% {
    transform: translateY(3px) scale(0.93);
    filter: brightness(0.8);
    box-shadow: 0 0 0 5px rgb(30 95 168 / 18%);
  }
  52% {
    transform: translateY(3px) scale(0.93);
    filter: brightness(0.82);
    box-shadow: 0 0 0 8px rgb(30 95 168 / 12%);
  }
  74% {
    transform: translateY(-1px) scale(1.04);
    filter: brightness(1.06);
    box-shadow: 0 0 0 4px rgb(30 95 168 / 14%);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
    box-shadow: none;
  }
}

.tutorial-move-tabs {
  display: flex;
  justify-content: space-between;
  width: min(100%, 430px);
  margin-top: -2px;
}

.tutorial-move-tabs button {
  min-width: 104px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #8bbce8;
  border-radius: 8px;
  color: #12324d;
  background: #d9ecff;
  box-shadow: inset 0 -1px 0 rgb(18 50 77 / 12%);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.launch-note-v4 {
  min-height: 1.1em;
  opacity: 0;
  animation: previewLaunchNoteV4 12s ease-in-out infinite;
}

@keyframes previewChainTile {
  0%,
  10% {
    border-color: rgb(44 33 25 / 12%);
    color: var(--forest);
    background: #fffdfa;
    box-shadow: inset 0 -2px 0 rgb(72 45 24 / 7%);
  }

  16%,
  40% {
    border-color: var(--selected);
    color: var(--ink);
    background: var(--selected);
    box-shadow: 0 0 0 3px rgb(231 226 217 / 26%), inset 0 -2px 0 rgb(140 101 16 / 8%);
    transform: translateY(-2px);
  }

  50%,
  76% {
    border-color: transparent;
    color: transparent;
    background: transparent;
    box-shadow: none;
    transform: translateY(0);
  }

  86%,
  100% {
    border-color: rgb(44 33 25 / 12%);
    color: var(--forest);
    background: #fffdfa;
    box-shadow: inset 0 -2px 0 rgb(72 45 24 / 7%);
  }
}

@keyframes previewChainDot {
  0%,
  44%,
  86%,
  100% {
    opacity: 0;
    transform: scale(0.45);
  }

  52%,
  76% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes previewBuiltLetterV2 {
  0%,
  12%,
  76%,
  100% {
    opacity: 0;
    transform: translateX(-12px) scale(0.86);
  }

  20%,
  56% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes previewBuiltLetterV2Short {
  0%,
  12%,
  70%,
  100% {
    opacity: 0;
    transform: translateX(-12px) scale(0.86);
  }

  20%,
  54% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes previewBuiltLetterV4 {
  0%,
  16%,
  100% {
    opacity: 0;
    transform: translateX(-12px) scale(0.86);
  }

  20%,
  50% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes previewCrownMoveV2 {
  0%,
  44% {
    transform: translate(-50%, -50%);
  }

  52%,
  76% {
    transform: translate(calc(-150% - 5px), -50%);
  }

  86%,
  100% {
    transform: translate(-50%, -50%);
  }
}

@keyframes previewCrownMoveV3 {
  0%,
  36% {
    transform: translate(-50%, -50%);
    opacity: 1;
  }

  46%,
  72% {
    transform: translate(calc(60% + 3px), calc(60% + 3px));
    opacity: 1;
  }

  82%,
  100% {
    transform: translate(calc(60% + 3px), calc(60% + 3px)) scale(0.92);
    opacity: 0;
  }
}

@keyframes previewCrownMoveV4 {
  0%,
  36% {
    transform: translate(-50%, -50%);
    opacity: 1;
  }

  44%,
  58% {
    transform: translate(-50%, -50%);
    opacity: 1;
  }

  64%,
  100% {
    transform: translate(calc(-156% - 4px), -50%);
    opacity: 1;
  }
}

@keyframes previewCagerTile {
  0%,
  22%,
  54%,
  100% {
    border-color: rgb(44 33 25 / 12%);
    color: var(--forest);
    background: #fffdfa;
    box-shadow: inset 0 -2px 0 rgb(72 45 24 / 7%);
    transform: translateY(0);
  }

  28%,
  48% {
    border-color: var(--selected);
    color: var(--ink);
    background: var(--selected);
    box-shadow: 0 0 0 3px rgb(231 226 217 / 26%), inset 0 -2px 0 rgb(140 101 16 / 8%);
    transform: translateY(-2px);
  }

  60%,
  66% {
    border-color: transparent;
    color: transparent;
    background: transparent;
    box-shadow: none;
    transform: translateY(0);
  }
}

@keyframes previewCagerDot {
  0%,
  52%,
  100% {
    opacity: 0;
    transform: scale(0.45);
  }

  58%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes previewCaptionCrown {
  0%,
  36%,
  100% {
    opacity: 1;
  }

  42%,
  100% {
    opacity: 0;
  }
}

@keyframes previewCaptionCaged {
  0%,
  46%,
  100% {
    opacity: 0;
  }

  52%,
  76% {
    opacity: 1;
  }
}

@keyframes previewCaptionMessage {
  0%,
  78% {
    opacity: 0;
  }

  84%,
  100% {
    opacity: 1;
  }
}

@keyframes previewLaunchNoteV4 {
  0%,
  82% {
    opacity: 0;
  }

  88%,
  100% {
    opacity: 1;
  }
}

@keyframes previewCrownTile {
  0%,
  44%,
  86%,
  100% {
    opacity: 0;
    transform: translateY(0);
  }

  52%,
  76% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .launch-preview-v2 .preview-chain,
  .launch-preview-v2 .preview-chain::after,
  .launch-preview-v2 .preview-crown,
  .launch-preview-v2 .preview-crown-tile::before,
  .launch-preview-v4 .preview-cager,
  .launch-preview-v4 .preview-cager::after,
  .launch-preview-v4 .preview-crown,
  .launch-preview-v4 .preview-crown-letter,
  .preview-built-letter,
  .launch-note-v4 {
    animation: none;
  }
}

.launch-card .launch-button {
  position: relative;
  z-index: 1;
  display: inline-block;
  min-height: 50px;
  padding-right: 22px;
  padding-left: 22px;
  -webkit-appearance: none;
  appearance: none;
  border-color: rgb(44 33 25 / 18%);
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 0 rgb(44 33 25 / 10%);
  font-size: 1rem;
  line-height: 1;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

.launch-card .primary-button.launch-button {
  border-color: #111;
  color: #fff;
  background: #111;
  box-shadow: none;
}

.game-topbar {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  min-height: 42px;
  margin-bottom: 20px;
}

.game-brand {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 7px;
  min-width: 0;
}

.game-brand-logo {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 8px;
}

.game-brand-title {
  min-width: 0;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1;
}

.turn-badge {
  display: inline-block;
  justify-self: center;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--forest);
  background: var(--forest-light);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.turn-badge.is-hidden {
  display: none !important;
}

.game-identity {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .launch-actions {
    flex-direction: column;
  }

  .launch-button {
    width: min(100%, 236px);
  }
}

.settings-menu,
.help-menu {
  position: relative;
}

.settings-menu {
  justify-self: start;
}

.help-menu {
  justify-self: end;
}

.topbar-icon-button,
.back-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  font-weight: 850;
  cursor: pointer;
}

.settings-menu-button {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  line-height: 1;
}

.topbar-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  width: 180px;
  padding: 5px;
  border: 1px solid var(--cream-dark);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 30px rgb(44 33 25 / 18%);
}

.settings-menu-dropdown {
  left: 0;
  width: 165px;
}

.help-menu-dropdown {
  right: 0;
}

.topbar-dropdown[hidden] {
  display: none;
}

.topbar-dropdown button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.topbar-dropdown button:hover,
.topbar-dropdown button:focus-visible {
  background: #fff;
}

.settings-menu-dropdown button {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-menu-dropdown .mode-check {
  color: var(--forest);
  font-weight: 900;
  visibility: hidden;
}

.settings-menu-dropdown button[aria-checked="true"] .mode-check {
  visibility: visible;
}

.settings-menu-dropdown .settings-menu-action {
  margin-top: 5px;
  border-top: 1px solid rgb(44 33 25 / 10%);
  border-radius: 0 0 8px 8px;
  font-weight: 850;
  text-align: center;
}

.status-panel {
  min-height: 50px;
  margin-bottom: 10px;
  padding: 9px 14px;
  border: 1px solid rgb(90 50 30 / 10%);
  border-radius: 14px;
  background: #fff;
}

.status-panel[hidden] {
  display: none;
}

.status-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.intro-hint {
  position: relative;
  z-index: 8;
  width: min(100%, 400px);
  margin: 0 auto 8px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.intro-hint::before {
  content: none;
}

.intro-hint > * {
  position: relative;
  z-index: 1;
}

.intro-steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 0;
}

.intro-step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  width: 100%;
  white-space: normal;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
}

.intro-chain-copy {
  color: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: normal;
  overflow-wrap: anywhere;
}

.intro-step-copy {
  color: inherit;
  white-space: normal;
  overflow-wrap: anywhere;
}

.intro-chain span,
.intro-check-badge,
.intro-dot {
  display: inline-grid;
  place-items: center;
}

.intro-chain span,
.intro-check-badge {
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid rgb(90 50 30 / 14%);
  background: #fff;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0;
}

.intro-selected {
  background: #ece7df;
}

.intro-check-badge {
  background: #111;
  border-color: #111;
  color: #fff;
  min-width: 42px;
}

.intro-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgb(90 50 30 / 14%);
}

.intro-cage {
  gap: 6px;
}

.help-screen {
  width: min(100% - 28px, 690px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(20px, env(safe-area-inset-top))
    0
    max(40px, env(safe-area-inset-bottom));
}

.help-screen-header {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--cream-dark);
}

.help-screen-header h1 {
  font-size: 1.4rem;
  line-height: 1;
  text-align: center;
}

.back-button {
  border: 0;
  font-size: 1.5rem;
}

.help-content {
  max-width: 580px;
  margin: 0 auto;
  padding: 10px 4px 30px;
}

.help-content section {
  padding: 24px 0;
  border-bottom: 1px solid var(--cream-dark);
  scroll-margin-top: 16px;
}

.help-content h2 {
  font-size: 1.35rem;
}

.help-content p,
.help-content li {
  color: var(--muted);
  line-height: 1.55;
}

.help-content ul {
  padding-left: 21px;
}
.message-toast {
  position: relative;
  z-index: 20;
  width: min(100%, 420px);
  min-height: 2.2rem;
  padding: 0;
  margin: 0 auto 8px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.message-toast[hidden] {
  display: none;
}

.message-toast.is-empty {
  visibility: hidden;
}

.message-toast::before {
  content: none;
}

.message-toast,
.action-message {
  font-size: 0.88rem;
  line-height: 1.35;
}

.action-message {
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid rgb(90 50 30 / 10%);
  border-radius: 12px;
  color: var(--forest);
  background: #fff;
}

.action-message[hidden] {
  display: none;
}

.grid-area {
  position: relative;
}

.letter-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: 92%;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid var(--cream-dark);
  border-radius: 21px;
  background: #ead9bd;
  box-shadow: inset 0 2px 10px rgb(90 50 30 / 12%);
  user-select: none;
  touch-action: none;
}

.crown-letter-popup {
  position: absolute;
  z-index: 30;
  min-width: 112px;
  padding: 7px 10px;
  border: 1px solid rgb(44 33 25 / 18%);
  border-radius: 999px;
  color: #fff;
  background: #111;
  box-shadow: 0 8px 18px rgb(44 33 25 / 18%);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
}

.crown-letter-popup[hidden] {
  display: none;
}

@media (min-width: 900px), (hover: hover) and (pointer: fine) {
  .app-shell {
    width: min(100% - 10px, 550px);
    padding-top: 7px;
    padding-bottom: 8px;
  }

  .tutorial-screen {
    width: min(100% - 28px, 520px);
    padding-top: 8px;
    padding-bottom: 12px;
  }

  .tutorial-header {
    margin-bottom: 8px;
  }

  .tutorial-stage {
    gap: 8px;
  }

  .tutorial-message {
    margin-top: 4px;
    font-size: 0.84rem;
    line-height: 1.25;
  }

  .tutorial-board-area {
    width: min(100%, 430px);
  }

  .tutorial-board {
    width: 100%;
    gap: 6px;
    padding: 10px;
  }

  .tutorial-board > span {
    font-size: 1rem;
  }

  .tutorial-crown-tile i {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
  }

  .tutorial-word-row {
    min-height: 34px;
  }

  .tutorial-actions {
    margin-top: 0;
  }

  .game-topbar {
    min-height: 24px;
    margin-bottom: 12px;
  }

  .intro-hint {
    width: min(84%, 380px);
    min-height: 98px;
    padding: 8px 10px;
    margin: 8px auto 10px;
  }

  .message-toast {
    width: min(90%, 390px);
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.8rem;
  }

  .letter-grid {
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
  }

  .tile {
    font-size: 1.12rem;
  }

  .tile.monarch::after {
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
  }

  .lower-game-area {
    padding-top: 6px;
  }

  .word-controls {
    margin-top: 0;
  }

  .action-message {
    margin-top: 6px;
    font-size: 0.76rem;
  }

  .word-row {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    align-items: center;
    width: 100%;
    min-height: 34px;
    margin: 2px 0 0;
    padding: 1px 0;
    gap: 2px;
    overflow: hidden;
  }

  .word-tile {
    width: 100%;
    min-width: 0;
    aspect-ratio: 1;
    border-radius: 4px;
    font-size: 0.38rem;
  }

  .action-row {
    margin-top: 4px;
    gap: 8px;
  }

  .action-row .primary-button,
  .action-row .secondary-button {
    height: 24px;
    min-height: 24px;
    padding-inline: 7px;
    font-size: 0.7rem;
  }
}

.cage-lines {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.selection-lines {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.cage-lines polyline {
  fill: none;
  stroke: #111;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.selection-lines polyline {
  fill: none;
  stroke: var(--selected);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 12;
  vector-effect: non-scaling-stroke;
}

.selection-lines.locked polyline {
  stroke: var(--selected);
}

.tile,
.word-tile {
  display: grid;
  place-items: center;
  border: 0;
  font-weight: 800;
  user-select: none;
  -webkit-user-select: none;
}

.tile {
  position: relative;
  z-index: 2;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  font-size: 1.12rem;
  box-shadow: none;
  cursor: pointer;
  transition: transform 100ms ease, background 130ms ease, box-shadow 130ms ease;
  isolation: isolate;
}

.tile:hover:not(:disabled) {
  transform: translateY(-1px);
}

.tile.unavailable {
  cursor: default;
}

.tile.selected {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.tile.selected::before,
.tile.intro-highlight::before {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: 94%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid transparent;
  box-sizing: border-box;
  content: "";
  transform: translate(-50%, -50%);
}

.tile.selected::before {
  background: var(--selected);
  border-color: var(--selected);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 10%);
}

.tile.selected.locked {
  background: transparent;
  box-shadow: none;
}

.tile.selected.locked::before {
  background: var(--selected);
  border-color: var(--selected);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 10%);
}

.selection-lines.locked {
  display: none;
}

.tile.intro-highlight {
  z-index: 1;
  background: transparent;
  box-shadow: none;
}

.tile.intro-highlight::before {
  background: #d7d4ce;
  border-color: #d7d4ce;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 10%);
}

.tile.open {
  border-color: transparent;
  color: transparent;
  background: transparent;
  box-shadow: none;
}

.tile.open::after,
.tile.fence::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36%;
  aspect-ratio: 1;
  border-radius: 50%;
  content: "";
  transform: translate(-50%, -50%);
}

.tile.open::after {
  background: var(--open);
  box-shadow: inset 0 1px 3px rgb(44 33 25 / 20%);
}

.tile.fence {
  border-color: transparent;
  color: transparent;
  background: transparent;
  box-shadow: none;
  cursor: not-allowed;
}

.tile.fence::after {
  width: 45%;
  background: var(--fence);
  box-shadow: inset -2px -3px 0 rgb(35 15 8 / 22%), 0 2px 4px rgb(44 33 25 / 22%);
}

.tile.monarch::before {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 88%;
  aspect-ratio: 1;
  border: 2px solid #d9a520;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 35% 28%, var(--tyrian-light), var(--tyrian) 55%, var(--tyrian-dark));
  box-shadow: 0 4px 9px rgb(61 0 28 / 35%);
  content: "";
  transform: translate(-50%, -50%);
}

.tile.monarch::after {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  color: #fff7c6;
  content: "♛";
  font-family: Georgia, serif;
  font-size: clamp(2.4rem, 11.2vw, 4.5rem);
  line-height: 1;
  transform: translate(-50%, -56%);
}

.word-controls {
  margin-top: 0;
}

.lower-game-area {
  position: relative;
  padding-top: 24px;
  background: #fff;
}

.word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  min-height: 70px;
  padding: 9px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.word-placeholder {
  margin: 0;
  color: #9b8c7d;
  font-size: 0.82rem;
  text-align: center;
}

.word-tile {
  flex: 0 0 clamp(34px, 9vw, 48px);
  aspect-ratio: 1;
  position: relative;
  justify-items: center;
  padding: 0;
  border-radius: 14px;
  color: var(--ink);
  background: #ead9bd;
  font-size: 1rem;
  box-shadow:
    inset 0 0 0 1px var(--cream-dark),
    0 1px 2px rgb(72 45 24 / 10%);
  cursor: grab;
  touch-action: none;
}

.word-tile.locked {
  cursor: default;
}

.word-tile:active {
  cursor: grabbing;
}

.word-tile-letter {
  position: relative;
  z-index: 1;
}

.action-row {
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.action-row .primary-button,
.action-row .secondary-button {
  height: 34px;
  min-height: 34px;
}

.action-row .primary-button {
  border-color: #111;
  color: #fff;
  background: #111;
  box-shadow: none;
}

.primary-button,
.secondary-button {
  min-height: 43px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 1px solid rgb(44 33 25 / 18%);
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 0 rgb(44 33 25 / 10%);
}

.secondary-button {
  border: 1px solid rgb(44 33 25 / 18%);
  color: var(--ink);
  background: #fff;
}

.game-over-overlay .secondary-button {
  height: 34px;
  min-height: 34px;
  padding: 0 20px;
  border-color: #111;
  color: #fff;
  background: #111;
  box-shadow: none;
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.monarch-controls {
  margin-top: 22px;
  padding: 12px 16px;
  border-radius: 15px;
  color: var(--ink);
  background: #fff;
  font-weight: 750;
  text-align: center;
}

.monarch-controls p {
  margin: 0;
}

.legend {
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-tile,
.legend-dot {
  display: inline-grid;
  place-items: center;
  width: 18px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
}

.legend-tile {
  width: 22px;
  height: 22px;
  border: 2px solid #111;
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  background: #ead9bd;
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 35%),
    0 0 0 1px rgb(17 17 17 / 18%);
  font-size: 0.7rem;
  line-height: 1;
  font-style: normal;
}

.legend-tile::before {
  content: attr(data-letter);
  color: var(--ink);
  transform: translateX(40%);
}

.legend-dot {
  border-radius: 50%;
}

.legend-dot.open { background: var(--open); }
.legend-dot.fence { background: var(--fence); }

.dialog-backdrop {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #fff;
  backdrop-filter: none;
}

#gameScreen.app-shell #enclosureBackdrop.dialog-backdrop {
  position: absolute;
  z-index: 14;
  inset: 0;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: clamp(72px, 12vh, 110px) 20px 20px;
  background: rgb(255 255 255 / 88%);
  backdrop-filter: none;
}

.dialog-backdrop[hidden] {
  display: none;
}

#gameScreen.app-shell #enclosureBackdrop.dialog-backdrop[hidden] {
  display: none;
}

.game-over-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 18px;
  background: #fff;
  backdrop-filter: none;
}

.game-over-overlay[hidden] {
  display: none;
}

.app-shell.game-is-over .lower-game-area {
  padding-top: 12px;
}

.app-shell.game-is-over .game-over-overlay {
  position: static;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}

.game-over-title-row {
  display: none;
}

.result-puzzle {
  margin: 0;
  color: var(--gold-dark);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.15;
}

.result-outcome {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1.2;
}

.result-turns {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
}

.result-stats {
  display: grid;
  justify-items: center;
  gap: 2px;
  max-width: 100%;
  margin-bottom: 14px;
}

.result-stats p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.26;
  text-align: center;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.game-over-dialog .result-actions button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 0.78rem;
}

.share-status {
  min-height: 1em;
  margin: 7px 0 0;
  color: var(--forest);
  font-size: 0.72rem;
  font-weight: 700;
}

.game-dialog h2 {
  font-size: 2rem;
}

.statistics-dialog {
  padding: 24px;
}

.statistics-dialog h2 {
  font-size: 1.65rem;
}

.statistics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 12px;
}

.statistics-grid div {
  display: grid;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 12px;
  background: var(--cream);
}

.statistics-grid strong {
  color: var(--forest);
  font-size: 1.25rem;
}

.statistics-grid span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.statistics-dialog .statistics-note {
  margin: 10px 0 16px;
  font-size: 0.75rem;
}

.enclosure-dialog {
  max-width: 360px;
  padding: 24px;
  border: 1px solid rgb(90 50 30 / 12%);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 35px rgb(20 12 7 / 22%);
  text-align: center;
}

.enclosure-dialog h2 {
  font-size: 1.55rem;
}

.game-over-dialog .share-status {
  margin: 7px 0 0;
  line-height: 1.2;
}

.game-over-dialog .share-status:empty {
  display: none;
}

.limit-dialog {
  padding: 26px;
}

.limit-dialog h2 {
  font-size: 1.55rem;
}

.confirm-dialog h2 {
  font-size: 1.55rem;
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

@media (max-width: 480px) {
  .app-shell {
    width: min(100% - 12px, 690px);
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }

  .game-topbar {
    min-height: 36px;
    margin-bottom: 18px;
  }

  .intro-steps {
    grid-template-columns: 1fr;
  }

  .intro-step {
    align-items: center;
    text-align: left;
    white-space: nowrap;
  }

  .intro-sample {
    min-height: 24px;
  }

  .message-toast {
    width: min(92%, 420px);
    padding: 9px 13px;
    margin-bottom: 9px;
    font-size: 0.84rem;
  }

  .app-shell.game-is-over .lower-game-area {
    padding-top: 8px;
  }

  .letter-grid {
    gap: 8px;
    padding: 10px;
    border-radius: 13px;
  }

  .tile {
    border-radius: 14%;
    font-size: 1.12rem;
    box-shadow: none;
  }

  .tile.monarch::before {
    border-width: 1px;
  }

  .tile.monarch::after {
    font-size: clamp(2.2rem, 14vw, 3.4rem);
  }

  .lower-game-area {
    padding-top: 16px;
  }

  .intro-hint {
    width: min(90%, 420px);
    min-height: 74px;
    padding: 9px 11px;
    margin: 8px auto 10px;
  }

  .action-message {
    margin-top: 7px;
    font-size: 0.8rem;
  }

  .word-row {
    margin-top: 8px;
    min-height: 58px;
    gap: 4px;
    padding: 6px;
    border-radius: 13px;
  }

  .action-row {
    margin-top: 13px;
  }

  .word-tile {
    flex-basis: clamp(28px, 8.5vw, 36px);
    border-radius: 12px;
    background: #ead9bd;
  }
}

@media (max-width: 340px) {
  .eyebrow {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }

  .primary-button,
  .secondary-button {
    min-height: 38px;
    padding-inline: 12px;
    font-size: 0.82rem;
  }

  .word-placeholder {
    font-size: 0.72rem;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .app-shell {
    width: min(100% - 20px, 900px);
    padding-block: 10px 20px;
  }

  .message-toast {
    width: min(46ch, 45%);
    font-size: 0.8rem;
    margin-bottom: 8px;
  }

  .action-message {
    margin-top: 6px;
    font-size: 0.76rem;
  }

  .word-controls,
  .monarch-controls {
    margin-top: 0;
  }

  .lower-game-area {
    padding-top: 0;
  }

  .intro-hint {
    width: min(82%, 360px);
    min-height: 72px;
    padding: 8px 10px;
    margin: 8px auto 8px;
  }

}
