/* =====================================================================
   Spirila - Descent :: Screens

   The title, node-cleared, end-of-run and confirmation screens. All four
   sit on the shared .modal-back shell from modal.css and are shown and
   hidden by screens.js, never by touching display anywhere else.
   ===================================================================== */

/* The spiral keeps turning behind every screen, so these overlays are
   thinner than the puzzle modal's - the backdrop is part of the game. */
.screen-back{
  background:rgba(3,5,11,.72);
  backdrop-filter:blur(6px);
}
#titleScreen{ z-index:65; }
#levelCompleteModal{ z-index:60; background:rgba(3,5,11,.42); backdrop-filter:blur(2px); }
#endModal{ z-index:70; }
#confirmModal{ z-index:80; background:rgba(3,5,11,.8); }

@keyframes screenIn{
  from{ opacity:0; transform:translateY(10px) scale(.985); }
  to{ opacity:1; transform:none; }
}
@media (prefers-reduced-motion:reduce){
  .title-card,.lc-card,.end-card,.confirm-card{ animation:none !important; }
}

/* ---------- Shared card + button vocabulary ---------- */
.title-card,.end-card,.confirm-card{
  width:min(92vw,520px);
  background:linear-gradient(180deg,rgba(16,24,38,.96),rgba(5,7,13,.97));
  border:1px solid var(--ring);
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:32px 30px;
  color:var(--ink);
  text-align:center;
  animation:screenIn .28s cubic-bezier(.2,.7,.3,1) both;
}

.btn-primary,.btn-ghost,.btn-danger{
  appearance:none;
  font:inherit;
  font-size:15px;
  border-radius:12px;
  padding:12px 20px;
  cursor:pointer;
  border:1px solid transparent;
  transition:transform .12s ease, background .18s ease, border-color .18s ease;
}
.btn-primary{
  background:linear-gradient(180deg,rgba(0,255,255,.22),rgba(0,255,255,.10));
  border-color:rgba(0,255,255,.5);
  color:#d8feff;
  font-weight:600;
  letter-spacing:.01em;
}
.btn-primary:hover{ background:linear-gradient(180deg,rgba(0,255,255,.3),rgba(0,255,255,.14)); }
.btn-ghost{
  background:rgba(255,255,255,.05);
  border-color:var(--ring);
  color:var(--muted);
}
.btn-ghost:hover{ background:rgba(255,255,255,.09); color:var(--ink); }
.btn-danger{
  background:rgba(255,107,138,.14);
  border-color:rgba(255,107,138,.45);
  color:#ffc2cd;
  font-weight:600;
}
.btn-danger:hover{ background:rgba(255,107,138,.22); }
.btn-primary:active,.btn-ghost:active,.btn-danger:active{ transform:translateY(1px) scale(.98); }
.btn-primary:focus-visible,.btn-ghost:focus-visible,.btn-danger:focus-visible{
  outline:2px solid #8fd1ff; outline-offset:2px;
}

/* ---------- Title ---------- */
.title-eyebrow{
  font-size:11px;
  letter-spacing:.28em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:10px;
}
.title-name{
  font-size:clamp(38px,9vw,54px);
  font-weight:700;
  letter-spacing:-.02em;
  line-height:1;
  margin-bottom:16px;
  background:-webkit-linear-gradient(45deg,#00ffff,#68ffb3);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}
.title-lede{
  font-size:14.5px;
  line-height:1.6;
  color:var(--muted);
  max-width:34ch;
  margin:0 auto 26px;
}
.title-actions{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-bottom:22px;
}
.title-actions .btn-primary{ width:100%; padding:14px; font-size:16px; }
.title-actions .btn-ghost{ width:100%; padding:10px; font-size:13.5px; }

.title-meta{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:8px 22px;
  font-size:12.5px;
  color:var(--muted);
}
.title-meta b{
  display:block;
  font-size:17px;
  font-weight:600;
  color:var(--ink);
  font-variant-numeric:tabular-nums;
  margin-bottom:2px;
}
.title-meta span{ display:block; }

.title-sub{
  font-size:10.5px;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:8px;
  text-align:left;
}
.title-history{
  margin-top:24px;
  padding-top:20px;
  border-top:1px solid var(--ring);
}
.run-list{
  list-style:none;
  max-height:172px;
  overflow-y:auto;
  text-align:left;
  display:grid;
  gap:4px;
}
.run-list li{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  padding:7px 10px;
  border-radius:8px;
  background:rgba(255,255,255,.04);
  font-size:12.5px;
  color:var(--muted);
}
.run-list .run-when{ color:var(--ink); }
.run-list .run-time{ font-variant-numeric:tabular-nums; }
.run-list .run-flawless{ color:#68ffb3; }
.run-list::-webkit-scrollbar{ width:8px; }
.run-list::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.14); border-radius:8px; }

/* ---------- Node cleared ---------- */
.lc-card{
  width:min(88vw,340px);
  background:linear-gradient(180deg,rgba(16,28,42,.95),rgba(5,9,16,.96));
  border:1px solid rgba(104,255,179,.32);
  border-radius:16px;
  box-shadow:0 14px 44px rgba(0,0,0,.55);
  padding:22px 22px 20px;
  text-align:center;
  color:var(--ink);
  animation:screenIn .22s cubic-bezier(.2,.7,.3,1) both;
}
.lc-badge{
  display:inline-block;
  font-size:9.5px;
  letter-spacing:.16em;
  text-transform:uppercase;
  font-weight:700;
  color:#04231a;
  background:#68ffb3;
  border-radius:20px;
  padding:3px 9px;
  margin-bottom:10px;
}
.lc-title{
  font-size:20px;
  font-weight:700;
  letter-spacing:-.01em;
  margin-bottom:12px;
  background:-webkit-linear-gradient(45deg,#00ffff,#68ffb3);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}
.lc-stats{
  display:flex;
  justify-content:center;
  gap:20px;
  font-size:12px;
  color:var(--muted);
  margin-bottom:16px;
}
.lc-stats b{
  display:block;
  font-size:16px;
  font-weight:600;
  color:var(--ink);
  font-variant-numeric:tabular-nums;
  margin-bottom:1px;
}
.lc-continue{ width:100%; padding:10px; font-size:14px; }

/* ---------- End of run ---------- */
.end-eyebrow{
  font-size:10.5px;
  letter-spacing:.24em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:10px;
}
.end-title{
  font-size:clamp(26px,6vw,34px);
  font-weight:700;
  letter-spacing:-.02em;
  line-height:1.1;
  margin-bottom:10px;
  background:-webkit-linear-gradient(45deg,#00ffff,#b892ff);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}
.end-lede{
  font-size:14px;
  color:var(--muted);
  max-width:32ch;
  margin:0 auto 24px;
  line-height:1.55;
}
.end-stats{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:1px;
  background:var(--ring);
  border:1px solid var(--ring);
  border-radius:12px;
  overflow:hidden;
  margin-bottom:24px;
}
.end-stats div{
  background:rgba(5,7,13,.75);
  padding:14px 10px;
}
.end-stats b{
  display:block;
  font-size:20px;
  font-weight:600;
  color:var(--ink);
  font-variant-numeric:tabular-nums;
  margin-bottom:3px;
}
.end-stats span{
  font-size:10.5px;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:var(--muted);
}
.end-actions{ display:flex; flex-direction:column; gap:10px; }
.end-actions .btn-primary{ width:100%; padding:13px; }
.end-actions .btn-ghost{ width:100%; padding:10px; font-size:13.5px; }

/* ---------- Confirmation ---------- */
.confirm-card{ width:min(90vw,400px); padding:26px 26px 22px; }
.confirm-title{ font-size:20px; font-weight:700; margin-bottom:10px; }
.confirm-body{
  font-size:13.5px;
  line-height:1.6;
  color:var(--muted);
  margin-bottom:22px;
}
.confirm-actions{ display:flex; gap:10px; }
.confirm-actions button{ flex:1; padding:11px; font-size:14px; }

/* ---------- Depth indicator in the header ---------- */
.header-actions{ display:flex; gap:8px; align-items:center; }
.depth-btn{
  font-variant-numeric:tabular-nums;
  letter-spacing:.02em;
  display:inline-flex;
  align-items:baseline;
  gap:5px;
}
.depth-btn .depth-word{
  font-size:10px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--muted);
}
.depth-btn .depth-sep{ color:var(--muted); margin:0 1px; }
.depth-btn[aria-expanded="true"]{
  border-color:rgba(104,255,179,.5);
  background:rgba(104,255,179,.12);
}
@media (max-width:560px){
  .depth-btn .depth-word{ display:none; }
}
