/* ═══════════════════════════════════════════
   TITLE SCREEN, PAUSE, BUTTONS
   ═══════════════════════════════════════════ */

/* ─── Title Screen ─── */
.screen--title {
  gap: 16px;
  /* `safe center` keeps the menu centred while it fits and falls back to
     flex-start the moment it does not — the centred-overflow trap that hides
     a screen's own heading. */
  justify-content: safe center;
  padding: calc(52px + env(safe-area-inset-top, 0px)) 16px
           calc(16px + env(safe-area-inset-bottom, 0px));
  background-color: var(--c-bg);
  background-image: var(--bg-abyss);
}

.title__greet {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--c-gold);
  margin: 6px 0 0;
  letter-spacing: 0.4px;
  text-shadow: 0 0 12px color-mix(in srgb, var(--c-gold) 20%, transparent);
  font-style: italic;
}

.title__greet[hidden] { display: none; }

.screen--title h1 {
  font-family: var(--font-display);
  /* Clamp for narrow phones — 3.5rem overflowed a 390-420pt viewport. */
  font-size: clamp(2.1rem, 8.5vw, 3.5rem);
  font-weight: 900;
  /* Even warm metal across the whole word — gold → ember → gold — so the
     last letters no longer die in grey. */
  background: linear-gradient(100deg, var(--c-gold) 0%, var(--c-ember) 50%, var(--c-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 6px;
  text-transform: uppercase;
  filter: drop-shadow(0 0 30px var(--c-gold-glow));
}

.screen--title .subtitle {
  color: var(--c-text-dim);
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.7;
  letter-spacing: 0.5px;
  max-width: 420px;
  text-align: center;
}

.title__emblem {
  width: 44px;
  height: 44px;
  color: var(--c-accent);
  opacity: 0.6;
  animation: emblem-spin 20s linear infinite;
  filter: drop-shadow(0 0 20px var(--c-accent-glow));
}

.title__emblem svg {
  width: 100%;
  height: 100%;
}

@keyframes emblem-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.title__hint {
  font-size: 0.75rem;
  color: var(--c-text-dim);
  letter-spacing: 1px;
  animation: hint-blink 2s ease-in-out infinite;
}

@keyframes hint-blink {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ─── Language switch ─── */
.lang-switch {
  display: flex;
  gap: 6px;
  /* Centred, but out of flow: a third language should grow it sideways from
     the middle, and two small buttons should never cost the menu a row of
     height it does not have. */
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.lang-btn {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-chip);
  color: var(--c-text-dim);
  transition: all var(--t-fast);
}

.lang-btn--active {
  color: var(--c-text-bright);
  border-color: var(--c-accent);
  background: var(--c-accent-dim);
}

@media (hover: hover) {
  .lang-btn:hover {
    color: var(--c-text-bright);
    border-color: var(--c-accent);
    background: var(--c-accent-dim);
  }
}

/* ─── Footer ─── */
.title__footer {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.65rem;
  color: var(--c-text-dim);
  margin-top: 8px;
}

.title__version { opacity: 0.5; }

.title__essence {
  color: var(--c-accent);
  opacity: 0.85;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.title__feedback {
  color: var(--c-text-dim);
  text-decoration: none;
  border-bottom: 1px dotted var(--c-text-dim);
  transition: color var(--t-fast);
}
@media (hover: hover) {
  .title__feedback:hover {
    color: var(--c-text-bright);
  }
}


.title__daily-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}


/* Short screens (SE-sized phones): the hub still has to fit in one screen,
   so the ornament gives up its height first. */
@media (max-height: 740px) {
  .screen--title {
    gap: 10px;
    padding-top: calc(44px + env(safe-area-inset-top, 0px));
  }
  .title__emblem { width: 32px; height: 32px; }
  .screen--title h1 { font-size: clamp(1.8rem, 7.5vw, 2.4rem); }
  .screen--title .btn { padding: 11px 32px; }
  .screen--title .btn--secondary { padding: 9px 24px; }
  .title__greet { font-size: 0.85rem; margin-top: 2px; }
  .title__contracts { margin-top: 6px; }
  .title__covenant { margin-top: 2px; font-size: 0.78rem; }
  .title__footer { margin-top: 2px; }
}

/* ─── Buttons ─── */
.btn {
  padding: 14px 40px;
  border: 1px solid var(--c-accent);
  border-radius: 12px;
  color: var(--c-text-bright);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--c-accent-dim) 0%, color-mix(in srgb, var(--c-accent) 8%, transparent) 100%);
  box-shadow: 0 0 20px var(--c-accent-glow), var(--shadow-md);
  transition: all var(--t-normal);
}

.btn--secondary {
  padding: 10px 28px;
  font-size: 0.85rem;
  border-color: var(--c-gold);
  background: var(--c-gold-dim);
  box-shadow: 0 0 12px var(--c-gold-glow), var(--shadow-sm);
}

.btn:active {
  background: linear-gradient(135deg, var(--c-accent) 0%, color-mix(in srgb, var(--c-accent) 55%, #101020) 100%);
  box-shadow: 0 0 40px var(--c-accent-glow), var(--shadow-lg);
  transform: translateY(-1px);
}

/* Hover only where a pointer can actually hover. On touch iOS keeps the
   hover state stuck on the last thing tapped, and a hover rule on a control
   can swallow the first tap of the next one. */
@media (hover: hover) {
  .btn:hover {
    background: linear-gradient(135deg, var(--c-accent) 0%, color-mix(in srgb, var(--c-accent) 55%, #101020) 100%);
    box-shadow: 0 0 40px var(--c-accent-glow), var(--shadow-lg);
    transform: translateY(-1px);
  }
}

/* ─── Pause overlay ─── */
.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 18, 0.85);
}
.pause-overlay[hidden] { display: none; }

.pause-overlay__box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.pause-overlay__text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--c-text-bright);
  letter-spacing: 2px;
}

.pause-overlay__buttons {
  display: flex;
  gap: 16px;
}

/* Audio preference pills — the only quiet switch in the game */
.pause-overlay__prefs {
  display: flex;
  gap: 10px;
}

.pause-pref {
  min-height: 44px; /* honest tap target */
  padding: 10px 16px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-text-bright);
  background: color-mix(in srgb, var(--c-surface) 80%, transparent);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.pause-pref--off {
  opacity: 0.45;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* Full reset — quiet until armed, unmistakable after */
.pause-reset {
  margin-top: 6px;
  min-height: 44px;
  padding: 10px 22px;
  font-family: var(--font-ui);
  font-size: var(--fs-3);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-text-dim);
  background: transparent;
  border: 1px dashed color-mix(in srgb, var(--c-danger) 35%, var(--c-border));
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.pause-reset--armed {
  color: var(--c-text-bright);
  border-style: solid;
  border-color: var(--c-danger);
  background: var(--c-danger-dim);
  box-shadow: 0 0 18px var(--c-danger-glow);
}

/* ─── Daily covenant + streak (P4.1) ─── */
.title__covenant {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: var(--c-accent);
  text-shadow: 0 0 10px var(--c-glow);
}

.title__streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--c-gold);
}

.title__streak[hidden] { display: none; }

.title__streak svg,
.title__streak svg.gi {
  width: 14px;
  height: 14px;
}

.title__streak i { font-style: normal; }

/* ─── Daily contracts (P4.2) ─── */
.title__contracts {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  background: rgba(0, 0, 0, 0.25);
  text-align: left;
  min-width: 260px;
}

.title__contracts[hidden] { display: none; }

.title__contracts-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--c-text-dim);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.title__contracts-count {
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
}

/* Folded by default — the list is three lines nobody needs before a run. */
.title__contracts-list { display: none; margin-top: 6px; }
.title__contracts--open .title__contracts-list { display: block; }

.title__contract {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 0.8rem;
  padding: 2px 0;
  color: var(--c-text);
}

.title__contract--done {
  color: var(--c-heal);
}

.title__contract-progress {
  color: var(--c-text-dim);
  font-weight: 700;
}

.title__contract--done .title__contract-progress { color: var(--c-heal); }

/* ─── The Rift (P5) — the weekly gate, torn between two worlds. ─── */
.btn--rift {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* The lock line needs a row of its own — without wrapping it squeezed the
     label into two words and the week into two lines. */
  flex-wrap: wrap;
  gap: 4px 10px;
  border: 1px solid color-mix(in srgb, var(--rift-a, #8a99b8) 55%, transparent);
  background:
    linear-gradient(115deg,
      color-mix(in srgb, var(--rift-a, #8a99b8) 18%, transparent) 0%,
      rgba(0, 0, 0, 0.3) 48%,
      color-mix(in srgb, var(--rift-b, #c87838) 18%, transparent) 100%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--rift-b, #c87838) 25%, transparent);
}

.btn--rift[hidden] { display: none; }

.btn-rift__glyph svg,
.btn-rift__glyph svg.gi {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 0 5px var(--rift-a, currentColor));
}

.btn-rift__week {
  font-size: 0.68rem;
  letter-spacing: 1px;
  color: var(--c-text-dim);
  font-weight: 600;
}

/* Heritage of the Rift — top-10% badge of the last completed week */
.btn-rift__heritage {
  display: inline-flex;
  width: 15px;
  height: 15px;
  color: var(--c-gold, #d8b04a);
}

.btn-rift__heritage svg {
  width: 100%;
  height: 100%;
}

.btn-rift__hint {
  flex-basis: 100%;
  margin-top: 3px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--c-text-dim);
}

.btn-rift__hint[hidden] { display: none; }

/* Dimmed, but not so dim the explanation cannot be read. */
.btn--rift-locked {
  opacity: 0.75;
  filter: saturate(0.4);
}

/* Stacked button: label + quiet explainer line. */
.btn--stacked {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

.btn-sub {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: none;
  color: var(--c-text-dim);
  font-family: Inter, sans-serif;
}
