/* ============================================================
   Abyssal Towline — title, briefing, pause, results screens
   ============================================================ */
.screens {
  position: fixed;
  inset: 0;
  z-index: 6;
  /* the container itself never eats taps; only a visible screen does */
  pointer-events: none;
}
.screens > .screen {
  pointer-events: auto;
}
.screens:empty {
  display: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: max(env(safe-area-inset-top), 1.25rem) 1.1rem max(env(safe-area-inset-bottom), 1.5rem);
  background:
    radial-gradient(ellipse at 50% 12%, rgba(12, 34, 52, 0.5), rgba(3, 6, 12, 0.94) 62%),
    rgba(3, 6, 12, 0.86);
  backdrop-filter: blur(7px);
  animation: screen-in 0.35s ease-out both;
}
.screen[hidden] {
  display: none;
}
@keyframes screen-in {
  from {
    opacity: 0;
  }
}

/* ---------- title ---------- */
.screen-title {
  place-items: start center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(8, 26, 40, 0.28), rgba(3, 6, 12, 0.9) 70%),
    rgba(3, 6, 12, 0.72);
}
.title-art {
  position: fixed;
  inset: 0;
  background-image: url("../assets/title-hero.webp");
  background-size: cover;
  background-position: 50% 42%;
  filter: saturate(1.08) contrast(1.05);
  z-index: -1;
  animation: art-drift 34s ease-in-out infinite alternate;
}
.title-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 6, 12, 0.55), rgba(3, 6, 12, 0.12) 34%, rgba(3, 6, 12, 0.9)),
    radial-gradient(ellipse at 50% 46%, rgba(3, 6, 12, 0.1), rgba(3, 6, 12, 0.72) 78%);
}
@keyframes art-drift {
  from {
    transform: scale(1.04) translate3d(-1%, -0.6%, 0);
  }
  to {
    transform: scale(1.11) translate3d(1%, 0.8%, 0);
  }
}

.title-scroll {
  width: 100%;
  max-width: 54rem;
  text-align: center;
  padding-block: 1rem 2.5rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--mint);
  margin: 0 0 0.9rem;
}
.eyebrow.good {
  color: var(--gold);
}
.eyebrow.bad {
  color: var(--danger);
}

.screen-title h1 {
  font-size: clamp(2.9rem, 15vw, 6.4rem);
  line-height: 0.88;
  letter-spacing: 0.03em;
  margin: 0 0 1.1rem;
  text-transform: uppercase;
  color: #f2fffb;
  text-shadow: 0 0 60px rgba(111, 242, 200, 0.28), 0 4px 30px rgba(0, 0, 0, 0.7);
}
.screen-title h1 span {
  display: block;
  color: var(--mint);
  font-size: 0.62em;
  letter-spacing: 0.16em;
  text-shadow: 0 0 44px rgba(111, 242, 200, 0.45);
}

.lede {
  max-width: 40ch;
  margin: 0 auto 1.6rem;
  color: #cfe3e4;
  font-size: clamp(0.92rem, 3.4vw, 1.06rem);
  line-height: 1.62;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8);
}
.lede em {
  color: var(--gold);
  font-style: normal;
}

.brief-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  text-align: left;
  margin: 0 auto 1.6rem;
}
.brief-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem 1.15rem;
  box-shadow: var(--shadow);
}
.brief-card h2 {
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.6rem;
}
.brief-card h2 + .brief-list {
  margin-bottom: 0.4rem;
}
.brief-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #c6d9df;
}
.brief-list:not(dl) > li {
  margin-bottom: 0.42rem;
}
.brief-list.keys {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 0.45rem;
}
.brief-list.keys kbd {
  margin-right: 0.16rem;
}
.brief-list b {
  color: var(--mint);
}

.record-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.6rem;
  margin-bottom: 1.5rem;
}
.record-row > div {
  min-width: 6rem;
}
.record-row span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.record-row b {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.dive-btn {
  display: inline-block;
  padding: 0.85rem 2.4rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-ink);
  background: linear-gradient(160deg, #a6ffe0, var(--mint) 45%, var(--mint-deep));
  box-shadow: 0 0 34px rgba(111, 242, 200, 0.34), 0 10px 26px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.22s, filter 0.2s;
}
.dive-btn:hover,
.dive-btn:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow: 0 0 46px rgba(111, 242, 200, 0.5), 0 14px 30px rgba(0, 0, 0, 0.55);
}
.dive-btn:active {
  transform: translateY(1px) scale(0.985);
}

.ghost-btn {
  display: inline-block;
  padding: 0.72rem 1.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(11, 26, 44, 0.6);
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background-color 0.18s, transform 0.14s;
}
.ghost-btn:hover,
.ghost-btn:focus-visible {
  color: var(--mint);
  border-color: var(--mint-deep);
  background: rgba(19, 48, 56, 0.7);
  transform: translateY(-1px);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 0.4rem;
}

.save-note {
  font-size: 0.68rem;
  color: var(--ink-dim);
  margin: 0.8rem 0 1.2rem;
  min-height: 1.2em;
}

.log {
  max-width: 30rem;
  margin: 0 auto;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}
.log summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  list-style: none;
  text-align: center;
}
.log summary::-webkit-details-marker {
  display: none;
}
.log summary:hover {
  color: var(--mint);
}
.log ul {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}
.log li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-soft);
  border-bottom: 1px dotted rgba(29, 58, 82, 0.7);
  padding-bottom: 0.28rem;
}
.log li b {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.log-empty {
  color: var(--ink-dim);
  justify-content: center !important;
}

.credit-line {
  margin: 1.4rem 0 0;
  font-size: 0.62rem;
  color: var(--ink-dim);
}

/* ---------- panels (brief / clear / pause / over / win) ---------- */
.brief-panel {
  width: 100%;
  max-width: 30rem;
  text-align: center;
  background: linear-gradient(180deg, rgba(13, 30, 46, 0.94), rgba(6, 14, 24, 0.96));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.6rem 1.4rem 1.7rem;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(111, 242, 200, 0.08);
  animation: panel-in 0.32s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(1.1rem) scale(0.97);
  }
}
.brief-panel.bad {
  border-color: rgba(255, 107, 94, 0.4);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 107, 94, 0.12), 0 0 60px rgba(255, 107, 94, 0.12);
}
.brief-panel.gold {
  border-color: rgba(255, 201, 120, 0.42);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 201, 120, 0.14), 0 0 70px rgba(255, 201, 120, 0.14);
}
.brief-panel h2 {
  font-size: clamp(1.5rem, 6.5vw, 2.15rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.brief-panel > p {
  max-width: 34ch;
  margin-inline: auto;
  color: #c6d9df;
  font-size: 0.9rem;
}
.brief-panel .lede {
  margin-bottom: 1.1rem;
}

.brief-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.4rem, 1fr));
  gap: 0.55rem;
  margin: 1.1rem 0 1.3rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.brief-facts dt {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.brief-facts dd {
  margin: 0.16rem 0 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.brief-facts dd:first-of-type {
  color: var(--mint);
}

/* landscape phones: keep panels short */
@media (max-height: 560px) {
  .screen {
    place-items: start center;
  }
  .brief-panel {
    padding: 1rem 1.1rem 1.1rem;
  }
  .brief-facts {
    margin: 0.7rem 0 0.9rem;
    padding: 0.55rem 0;
  }
  .screen-title h1 {
    font-size: clamp(2.2rem, 9vw, 3.4rem);
  }
}

/* ---------- title: sound panel and tutorial button ---------- */
.sound-panel {
  max-width: 30rem;
  margin: var(--space-3) auto var(--space-3);
  padding: 0.9rem 1.1rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 20, 32, 0.8);
  text-align: left;
}
.sound-panel .eyebrow {
  margin-bottom: 0.4rem;
}
.vol-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 3.4rem;
  align-items: center;
  gap: 0.7rem;
  margin: 0.45rem 0;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.vol-row output {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.vol-row input[type="range"] {
  width: 100%;
  accent-color: var(--mint);
  min-height: 2.2rem;
  cursor: pointer;
}
.title-actions {
  justify-content: center;
}
