:root {
  color-scheme: dark;
  --header-row-height: 64px;
  --bg: #000111;
  --bg-deep: 000111;
  --ink: #f4f4f4;
  --muted: #b9b9b9;
  --panel: #111114;
  --button: #f5f5f5;
  --button-ink: #000111;
  --shadow: rgba(0, 0, 0, 0.55);
  --grid-stroke: rgba(255, 255, 255, 0.1);
  --option-dim: rgba(255, 255, 255, 0.4);
  --option-active: #ffffff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font-family: inherit;
}

button {
  box-shadow: 10px 10px 0 rgba(255, 255, 255, 0.1);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: "VT323", "Courier New", monospace;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-user-select: none;
  user-select: none;
}

body.light-mode {
  color-scheme: light;
  --bg: #f7f6f2;
  --bg-deep: #eceae4;
  --ink: #101010;
  --muted: #6a6a6a;
  --panel: #ffffff;
  --button: #0b0b0d;
  --button-ink: #ffffff;
  --shadow: rgba(0, 0, 0, 0.2);
  --grid-stroke: #9a9a9a;
  --option-dim: rgba(0, 0, 0, 0.35);
  --option-active: #101010;
}

.scene {
  width: 100vw;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

.mobile-header {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--header-row-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 1rem 0;
  text-align: center;
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 4;
}

.mobile-header h1 {
  margin: 0;
  font-size: 2rem;
  font-style: italic;
  font-weight: 700;
}

#playfield {
  position: relative;
  border-radius: 0;
  background: var(--bg);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  box-shadow: none;
  touch-action: none;
  overflow: hidden;
  display: grid;
  align-content: start;
  justify-items: center;
  row-gap: 1rem;
  padding-top: 2.5rem;
  padding-bottom: 120px;
}

#playfield::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: none;
  pointer-events: none;
}

.grid-header {
  width: min(92vw, 420px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}

.grid-header .secondary-button {
  margin-bottom: 0;
}

.quilt-grid {
  position: relative;
  width: min(92vw, 420px);
  aspect-ratio: var(--grid-cols, 6) / var(--grid-rows, 6);
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 6), 1fr);
  grid-template-rows: repeat(var(--grid-rows, 6), 1fr);
  gap: 6px;
  z-index: 1;
}

.quilt-cell {
  border: 1px solid var(--grid-stroke);
  background: var(--bg);
  border-radius: 0;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: none;
  aspect-ratio: 1;
  font-size: 0;
  line-height: 0;
}

.quilt-cell:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.shape {
  width: 70%;
  height: 70%;
  background: var(--ink);
  pointer-events: none;
  box-sizing: border-box;
  display: block;
}

.quilt-grid.shape-size-s .shape {
  width: 55%;
  height: 55%;
}

.quilt-grid.shape-size-l .shape {
  width: 75%;
  height: 75%;
}

.quilt-grid.shape-shiny .shape {
  background: linear-gradient(135deg, #ffffff 0%, #b7f7ff 55%, #ffe2b8 100%);
}

.quilt-grid.shape-shiny .shape-empty {
  background: transparent;
}

.quilt-grid.shape-shiny .shape-water::before,
.quilt-grid.shape-shiny .shape-water::after {
  border-top-color: transparent;
  background: linear-gradient(135deg, #ffffff 0%, #b7f7ff 55%, #ffe2b8 100%);
}

.shape-empty {
  background: transparent;
}

.shape-circle {
  border-radius: 50%;
}

.shape-square {
  border-radius: 10%;
}

.shape-rounded {
  border-radius: 28%;
}

.shape-arch {
  border-radius: 50% 50% 18% 18% / 65% 65% 22% 22%;
}

.shape-semicircle {
  border-radius: 999px 999px 0 0;
  height: 52%;
  align-self: end;
}

.shape-pill {
  border-radius: 999px;
  width: 80%;
  height: 42%;
}

.shape-triangle {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.shape-diamond {
  width: 60%;
  height: 60%;
  border-radius: 12%;
  transform: rotate(45deg);
}

.shape-tree {
  background-color: var(--ink);
  mask-image: url("tree.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("tree.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-star {
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
}

.shape-crescent {
  background-color: #f5f5f5;
  mask-image: url("crescent.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("crescent.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.quilt-grid.shape-shiny .shape-crescent {
  background: linear-gradient(135deg, #ffffff 0%, #b7f7ff 55%, #ffe2b8 100%);
}

.shape-disc {
  background-color: var(--ink);
  mask-image: url("disc.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("disc.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-fire {
  background-color: var(--ink);
  mask-image: url("fire.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("fire.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-bolt {
  background-color: var(--ink);
  mask-image: url("bolt.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("bolt.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-double-bolt {
  background-color: var(--ink);
  mask-image: url("double-bolt.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("double-bolt.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-eye {
  background-color: var(--ink);
  mask-image: url("eye.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("eye.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-third-eye {
  background-color: var(--ink);
  mask-image: url("third-eye.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("third-eye.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-water {
  background: transparent;
  border: none;
  position: relative;
  width: 80%;
  height: 60%;
}

.shape-water::before,
.shape-water::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  border-top: 4px solid var(--ink);
  border-radius: 50%;
}

.shape-water::before {
  top: 20%;
}

.shape-water::after {
  top: 60%;
}

.shape-waves-icon {
  background-color: var(--ink);
  mask-image: url("waves.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("waves.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-water-icon {
  background-color: var(--ink);
  mask-image: url("water.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("water.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-arc {
  background-color: var(--ink);
  mask-image: url("arc.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("arc.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-burst {
  background-color: var(--ink);
  mask-image: url("burst.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("burst.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-stack {
  background-color: var(--ink);
  mask-image: url("stack.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("stack.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-heart {
  background-color: var(--ink);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M50 92 C20 70 6 48 12 30 C18 10 38 8 50 24 C62 8 82 10 88 30 C94 48 80 70 50 92 Z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M50 92 C20 70 6 48 12 30 C18 10 38 8 50 24 C62 8 82 10 88 30 C94 48 80 70 50 92 Z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.shape-quarter-tl {
  clip-path: circle(100% at 0% 0%);
}

.shape-quarter-tr {
  clip-path: circle(100% at 100% 0%);
}

.shape-quarter-br {
  clip-path: circle(100% at 100% 100%);
}

.shape-quarter-bl {
  clip-path: circle(100% at 0% 100%);
}

.analyze-button {
  width: calc(100% - 2.4rem);
  border: none;
  border-radius: 14px;
  padding: 1.25rem 2rem;
  font-size: 1.6rem;
  letter-spacing: 0.08em;
  background: var(--button);
  color: var(--button-ink);
  cursor: pointer;
  opacity: 0.25;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  margin: 1.2rem auto 1rem;
}

.header-actions {
  position: sticky;
  top: calc(env(safe-area-inset-top) + var(--header-row-height));
  height: var(--header-row-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 4;
  background: transparent;
}

.header-actions-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-actions .back-button {
  opacity: 1;
  pointer-events: auto;
}

.launch-active .header-actions {
  opacity: 0;
  pointer-events: none;
}

.back-button {
  position: static;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  box-shadow: none;
  display: grid;
  place-items: center;
  padding: 0;
}

.grid-active .back-button {
  opacity: 1;
  pointer-events: auto;
}

.start-screen .settings-back {
  opacity: 1;
  pointer-events: auto;
}

.back-button img {
  width: 30px;
  height: 30px;
  filter: invert(1);
}

.intro-close-button {
  position: fixed;
  top: calc(
    env(safe-area-inset-top) + var(--header-row-height) +
      (var(--header-row-height) - 40px) / 2
  );
  left: calc(50% - min(430px, 100vw) / 2 + 20px);
  opacity: 1;
  pointer-events: auto;
  z-index: 12;
}

.vision-meter {
  position: absolute;
  top: auto;
  right: auto;
  left: 50%;
  bottom: 230px;
  transform: translateX(-50%);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

.grid-date {
  font-size: 1.1rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  z-index: 2;
}

.grid-active .grid-date {
  opacity: 1;
}

.grid-active .vision-meter {
  opacity: 0;
  pointer-events: none;
}

.intro-active .back-button,
.intro-active .vision-meter,
.intro-active .grid-date {
  opacity: 0;
  pointer-events: none;
}

.intro-active .intro-close-button {
  opacity: 1;
  pointer-events: auto;
  z-index: 12;
}

.intro-active .header-actions {
  opacity: 0;
  pointer-events: none;
}

.settings-active .back-button,
.settings-active .vision-meter,
.settings-active .grid-date {
  opacity: 0;
  pointer-events: none;
}

.settings-active .start-close-button {
  opacity: 1;
  pointer-events: auto;
  z-index: 12;
}

.settings-active .header-actions {
  opacity: 0;
  pointer-events: none;
}

.confirm-active .back-button,
.confirm-active .vision-meter,
.confirm-active .grid-date {
  opacity: 0;
  pointer-events: none;
}

.analysis-active .back-button,
.analysis-active .vision-meter,
.analysis-active .grid-date {
  opacity: 0;
  pointer-events: none;
}

.analysis-active .header-actions {
  opacity: 0;
  pointer-events: none;
}

.analysis-active .mobile-header {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 120px);
  transform: translateX(-50%) translateY(10px);
  background: rgba(17, 17, 20, 0.92);
  color: #ffffff;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 6;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.settings-button,
.info-button {
  position: static;
}

.secondary-button {
  background: transparent;
  border: none;
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
  font-size: 1rem;
  padding: 0.25rem 0;
  margin-bottom: 2rem;
  cursor: pointer;
  letter-spacing: 0.08em;
  box-shadow: none;
}

body.light-mode .secondary-button {
  color: var(--button-ink);
  text-decoration-color: var(--button-ink);
}

.feedback-link {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
  letter-spacing: 0.08em;
  font-size: 1.2rem;
}

.feedback-link:hover {
  color: rgba(255, 255, 255, 0.7);
  text-decoration-color: rgba(255, 255, 255, 0.7);
}

.feedback-link-analysis {
  display: inline-block;
  margin-top: 1.4rem;
}

.feedback-link-intro {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.feedback-link-launch {
  display: inline-block;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 48px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration-color: rgba(255, 255, 255, 0.5);
}

.feedback-link-launch:hover {
  color: rgba(255, 255, 255, 0.7);
  text-decoration-color: rgba(255, 255, 255, 0.7);
}
.secondary-button:hover {
  color: rgba(255, 255, 255, 0.75);
  text-decoration-color: rgba(255, 255, 255, 0.75);
}

.timer {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  z-index: 3;
  display: none;
}

.timer.hidden {
  opacity: 0;
  pointer-events: none;
}

.analyze-button.visible {
  transform: translateY(0);
}

.analyze-button.enabled {
  opacity: 1;
  pointer-events: auto;
}

.controls {
  display: grid;
  gap: 6.6rem;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  text-align: center;
}

.control {
  display: grid;
  gap: 0.4rem;
}

.control label {
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.control-input {
  display: none;
}

.option-row {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  align-items: center;
}

.option {
  border: none;
  background: transparent;
  color: var(--option-dim);
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.2rem 0.3rem;
}

.option-smiley::after {
  content: "☺";
  display: block;
  margin-top: 0.35rem;
  font-size: 0.9rem;
  letter-spacing: 0;
  color: var(--muted);
  text-transform: none;
}

.option.is-active {
  color: var(--option-active);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.option-color {
  color: rgba(255, 255, 255, 0.55);
}

.option-color.is-active {
  color: #f04f5b;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.control input[type="range"] {
  width: 180px;
}

.control span {
  font-weight: 600;
  letter-spacing: 0.08em;
}

.analysis-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  top: -70px;
  transition: opacity 0.25s ease;
  z-index: 4;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

#analysis-overlay {
  padding: 1.2rem;
  box-sizing: border-box;
}

.analysis-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.analysis-modal {
  width: min(88vw, 360px);
  height: 100%;
  background: transparent;
  color: var(--ink);
  padding: 120px 1.4rem 220px;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  margin: 0 1.2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.analysis-modal h2 {
  margin: 0 0 1rem;
  font-size: 2.6rem;
  letter-spacing: 0.08em;
}

.analysis-modal p {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.6;
}

#analysis-overlay #analysis-text {
  overflow-y: auto;
  max-height: calc(100dvh - 520px);
  padding-right: 0.4rem;
  scrollbar-width: thin;
}

.symbol-tray {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 1.6rem;
}

.symbol-tray.visible {
  opacity: 1;
  pointer-events: auto;
}

.symbol-tray-panel {
  width: min(92vw, 420px);
  background: rgba(12, 12, 18, 0.95);
  border-radius: 18px;
  padding: 1.2rem 1.2rem 1.4rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.symbol-tray-panel h3 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.symbol-tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  gap: 0.6rem;
}

.symbol-option {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: none;
}

.symbol-option .shape {
  width: 70%;
  height: 70%;
  pointer-events: none;
}

.share-button {
  margin-top: 2.6rem;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 1.1rem 1.4rem;
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  background: var(--button);
  color: var(--button-ink);
  cursor: pointer;
  opacity: 0.25;
  pointer-events: none;
}

.share-button.enabled {
  opacity: 1;
  pointer-events: auto;
}

.analysis-meta {
  position: absolute;
  top: calc(env(safe-area-inset-top) + var(--header-row-height));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 0.4rem;
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

#analysis-overlay .analysis-modal {
  width: 100%;
  max-width: 440px;
  height: auto;
  aspect-ratio: 10 / 11;
  min-height: min(82vh, 820px);
  padding: 3.4rem 1.8rem;
  background: var(--bg);
  border: 4px solid #f5f5f5;
  box-shadow: 0 26px 50px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
  margin: 0;
  max-height: calc(100dvh - 2.4rem);
  max-height: calc(100vh - 2.4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  overflow-y: auto;
}

#analysis-overlay .analysis-meta {
  position: static;
  transform: none;
  gap: 0.2rem;
}

#analysis-overlay #analysis-time {
  display: none;
}

.analysis-mini {
  width: min(110px, 46vw);
  height: auto;
  display: block;
}

#analysis-overlay .secondary-button {
  margin-top: 0.4rem;
  margin-bottom: 0;
}

#confirm-overlay .analysis-modal {
  width: min(86vw, 320px);
  height: auto;
  background: var(--panel);
  padding: 2.2rem 1.8rem;
  border-radius: 24px;
  box-shadow: 0 26px 50px var(--shadow);
  text-align: left;
}

#confirm-overlay .analysis-modal h2 {
  font-size: 2rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

#confirm-overlay .analysis-modal p {
  font-size: 1.25rem;
  line-height: 1.5;
}

#reset-overlay .analysis-modal {
  width: min(86vw, 320px);
  height: auto;
  background: var(--panel);
  padding: 2.2rem 1.8rem;
  border-radius: 24px;
  box-shadow: 0 26px 50px var(--shadow);
  text-align: left;
}

#reset-overlay .analysis-modal h2 {
  font-size: 2rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

#reset-overlay .analysis-modal p {
  font-size: 1.25rem;
  line-height: 1.5;
}

.confirm-actions {
  margin-top: 1.4rem;
  display: grid;
  gap: 1.6rem;
}

.confirm-actions button {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 1rem 1.2rem;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.confirm-actions #confirm-cancel {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.confirm-actions #confirm-accept {
  background: var(--button);
  color: var(--button-ink);
}

.launch-screen,
.start-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.intro-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 10;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.intro-screen.hidden {
  display: none;
}

.intro-panel {
  width: min(86vw, 360px);
  margin: 0 1.2rem;
  background: transparent;
  color: var(--ink);
  padding: 1rem 0;
  border-radius: 0;
  text-align: center;
  box-shadow: none;
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 160px;
}

.intro-panel ol {
  margin: 0 0 1.8rem;
  padding: 0;
  line-height: 1.35;
  list-style-position: outside;
  padding-left: 1.6rem;
  font-size: 2.2rem;
  text-align: left;
}

.intro-panel li {
  margin-bottom: 1.4rem;
}

.intro-panel button {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 1.1rem 1.4rem;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  background: var(--button);
  color: var(--button-ink);
  cursor: pointer;
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2.4rem);
}

.launch-screen.hidden,
.start-screen.hidden {
  display: none;
}

.launch-screen #launch-begin,
.intro-panel button,
.start-screen #start-game {
  width: 100%;
  margin: 0 1.2rem;
  border: none;
  border-radius: 14px;
  padding: 1.25rem 2rem;
  font-size: 1.6rem;
  letter-spacing: 0.08em;
  background: var(--button);
  color: var(--button-ink);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.intro-panel button {
  margin: 0;
  width: calc(100% - 2.4rem);
}

.start-screen #start-game:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 22px 36px rgba(0, 0, 0, 0.24);
}

.start-screen #start-game:active {
  transform: translateX(-50%) translateY(1px) scale(0.98);
}

.start-panel {
  display: grid;
  gap: 1.1rem;
  justify-items: center;
  text-align: center;
  animation: rise-in 0.5s ease both;
  position: relative;
}

.launch-screen .start-panel {
  height: 100%;
  align-content: center;
  padding-bottom: 160px;
}

.launch-screen #launch-begin {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  width: calc(100% - 2.4rem);
  margin: 0;
}

.start-screen .start-panel {
  width: min(88vw, 340px);
  height: 100%;
  padding: 1.2rem 0 0.6rem;
  align-content: center;
  padding-bottom: 160px;
}

.start-screen .controls {
  margin-top: 4rem;
}

.start-screen #start-game {
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  padding: 1.1rem 1.6rem;
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2.4rem);
  margin: 0;
}

.start-close-button {
  position: fixed;
  top: calc(
    env(safe-area-inset-top) + var(--header-row-height) +
      (var(--header-row-height) - 40px) / 2
  );
  left: calc(50% - min(430px, 100vw) / 2 + 20px);
  opacity: 1;
  pointer-events: auto;
  z-index: 12;
}
.logo-grid {
  position: relative;
  width: 110px;
  height: 110px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  place-items: center;
}

.logo-cell {
  width: 48px;
  height: 48px;
  border: none;
  display: grid;
  place-items: center;
}

.logo-cell .shape {
  width: 70%;
  height: 70%;
}

.title-block {
  display: grid;
  gap: 0.5rem;
}

.title {
  margin: 0;
  font-size: 3.2rem;
  letter-spacing: 0.12em;
}

.subtitle {
  margin: 0.4rem 0 0;
  font-size: 1.3rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.launch-date {
  display: block;
  margin-top: 0.8rem;
}

.screen-title {
  position: absolute;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
}

.wavy-underline {
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

.settings-title {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logo-cycle {
  0%,
  20% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  25%,
  100% {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
}

@media (max-width: 600px) {
  #playfield {
    min-height: 0;
    align-content: start;
    padding-top: 2rem;
    padding-bottom: calc(160px + env(safe-area-inset-bottom));
  }

  .symbol-tray {
    padding: 0.8rem;
    align-items: end;
  }

  .symbol-tray-panel {
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding-bottom: calc(env(safe-area-inset-bottom) + 1.4rem);
  }
}
