/* The title and the delver picker share the same brass controls and safe-area trim. */
.title-screen, .delver-screen, .entry-sheet {
  --entry-ink:#101718;
  --entry-paper:#f4ead2;
  --entry-brass:#e2bc79;
  --entry-pad:clamp(12px,4.5vw,28px);
  --entry-left:max(var(--entry-pad),env(safe-area-inset-left));
  --entry-right:max(var(--entry-pad),env(safe-area-inset-right));
  color:var(--entry-paper);
}
.title-screen, .delver-screen {
  position:relative;
  isolation:isolate;
  flex:1;
  min-height:0;
  overflow:auto;
  overscroll-behavior:contain;
  background:var(--entry-ink);
}
body:has(.title-screen,.delver-screen)::before { background:none }
:is(.title-screen,.delver-screen,.entry-sheet) button { touch-action:manipulation }
.entry-bar {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:calc(8px + env(safe-area-inset-top)) var(--entry-right) 8px var(--entry-left);
}
.entry-icon, .entry-pill, .title-screen .ledger-link {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:44px; padding:0 13px; border:1px solid #aa99745e; border-radius:5px;
  color:var(--entry-paper); background:#131a19ed;
  font:600 16px/1.2 var(--font-body); cursor:pointer;
}
.entry-icon { width:44px; flex:none; padding:0 }
.entry-icon .icon, .entry-pill .icon { width:21px; height:21px }
.back-chevron { transform:rotate(180deg) }
.down-chevron { transform:rotate(90deg) }
.entry-primary, .entry-secondary {
  position:relative; display:flex; align-items:center; justify-content:center; gap:10px;
  width:100%; padding:10px 38px; border:1px solid #f4d899; border-radius:4px;
  background:linear-gradient(108deg,#f4d79c,#d9b273); color:#241c12;
  min-height:54px; font:700 25px/1.14 var(--font-display); letter-spacing:.015em; cursor:pointer;
}
.entry-primary::before {
  content:""; position:absolute; inset:3px; border:1px solid #5a431b55; border-radius:1px; pointer-events:none;
}
.entry-primary .icon, .title-actions .entry-secondary .icon { position:absolute; right:18px; width:20px; height:20px }
.entry-secondary {
  min-height:46px; border-color:#b5a17a70; background:#121917eb; color:var(--entry-paper);
  font:600 19px/1.2 var(--font-body);
}
:is(.entry-primary,.entry-secondary,.entry-pill,.entry-icon,.entry-row):active { filter:brightness(.87) }

.title-screen { display:flex; flex-direction:column }
.title-screen, .entry-loading { --entry-belfry:url('assets/title-belfry.webp') center 36% / cover no-repeat }
.title-screen::before, .title-screen::after {
  content:""; position:absolute; inset:0; z-index:-1; pointer-events:none;
}
.title-screen::before { background:var(--entry-belfry) }
.title-screen::after {
  background:linear-gradient(180deg,#080d102b,transparent 14%,transparent 46%,#0c111250 62%,#0c1112e0 83%,#0b1011);
}
.title-screen .ledger-link { gap:7px; color:#f3ddb4 }
.title-screen #title-settings { margin-left:auto }
.title-menu {
  width:min(100%,436px); margin:auto auto 0;
  padding:26px var(--entry-right) max(24px,calc(12px + env(safe-area-inset-bottom))) var(--entry-left);
}
.title-wordmark {
  margin:0 0 clamp(20px,4dvh,38px); text-align:center; text-transform:uppercase;
  font:800 clamp(45px,18.2vw,80px)/.92 var(--font-display); letter-spacing:-.015em;
  color:#f5e6c7; text-shadow:0 2px 14px #080b0b;
}
.title-wordmark span {
  display:flex; justify-content:center; align-items:center; gap:12px; margin-bottom:4px;
  color:#eed199; font:700 clamp(20px,6.7vw,31px)/1 var(--font-display); letter-spacing:.15em; white-space:nowrap;
}
.title-wordmark span::before, .title-wordmark span::after {
  content:""; width:clamp(22px,8vw,45px); height:1px; background:#cfa76a;
}
.title-wordmark strong { display:block; white-space:nowrap; font-weight:800 }
.title-actions { display:grid; gap:9px }

.delver-screen { --art-x:50%; display:grid; grid-template-rows:auto minmax(168px,1fr) auto }
.delver-bar {
  display:grid; grid-template-columns:1fr auto 1fr;
  border-bottom:1px solid #ab997343; background:#131a1a;
}
.delver-bar h1 { margin:0; text-align:center; font:700 clamp(20px,5.2vw,29px)/1.12 var(--font-display) }
.delver-bar .entry-pill { justify-self:end; font-variant-numeric:tabular-nums }
.delver-stage { --caption-room:0px; position:relative; isolation:isolate; min-width:0; overflow:hidden; background:var(--entry-ink); touch-action:pan-y pinch-zoom }
.delver-keyart { position:absolute; inset:0 0 auto; width:100%; height:calc(100% - var(--caption-room)); object-position:var(--art-x) var(--face-y) }
.delver-screen .portrait-bulwark { --art-x:36% }
.delver-screen .portrait-cinderist { --art-x:29% }
.delver-screen .portrait-shade { --art-x:50% }
.delver-screen .portrait-chorister { --art-x:36% }
.delver-screen .portrait-thornbow { --art-x:61% }
.delver-screen .portrait-lamplighter { --art-x:40% }
.delver-stage::after {
  content:""; position:absolute; inset:0 0 var(--caption-room); pointer-events:none;
  background:linear-gradient(0deg,var(--entry-ink) 0%,#101718d9 11%,#1017185c 26%,transparent 46%);
}
@media (orientation:portrait) {
  .delver-stage { --caption-room:clamp(36px,11dvh,96px) }
  .delver-stage::after { background:linear-gradient(0deg,var(--entry-ink),#10171884 12%,transparent 27%) }
}
.delver-caption { position:absolute; z-index:1; left:var(--entry-left); bottom:4px; right:var(--entry-right) }
.delver-caption h2 {
  width:fit-content; max-width:100%; color:#f7ead2;
  font:800 clamp(42px,13.6vw,82px)/.95 var(--font-display); text-transform:uppercase; letter-spacing:.003em;
  text-shadow:0 2px 10px #090e10;
}
.delver-stats { display:flex; align-items:center; gap:11px; min-height:44px; font:600 18px/1.2 var(--font-body) }
.delver-stats>span:first-child { color:var(--delver-color) }
.delver-hp { display:inline-flex; align-items:center; gap:5px; padding-left:11px; border-left:1px solid #aeaa955e }
.delver-hp .icon { width:16px; height:16px; color:#e3a58b }
.delver-stats .entry-icon { margin-left:auto; color:#e9d6ad; background:transparent; border:0 }
.delver-controls {
  display:grid; align-content:center; justify-items:center; gap:10px;
  padding:6px var(--entry-right) max(16px,calc(8px + env(safe-area-inset-bottom))) var(--entry-left);
  background:var(--entry-ink);
}
.delver-roster { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:clamp(4px,1.2vw,8px); width:min(100%,480px) }
.delver-roster .class-card {
  display:block; width:100%; min-height:44px; height:auto; aspect-ratio:1;
  padding:0; background:#202527; border:1px solid #756e5b; border-radius:3px; box-shadow:none;
}
.delver-roster .class-card:hover { transform:none }
.delver-roster .class-portrait {
  position:absolute; inset:0; width:100%; height:100%; object-position:var(--art-x) var(--face-y); border:0;
}
.delver-roster .class-copy {
  position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; padding:0;
}
.delver-roster .class-card.on { border:2px solid #f0d093; box-shadow:0 0 0 1px #f0d093 }
.delver-roster .class-check {
  right:0; top:auto; bottom:0; width:18px; height:18px; border-radius:2px 0 0;
  background:#f0d093; color:#211c16;
}
.delver-roster .class-check .icon { width:13px; height:13px; stroke-width:2.3 }
.delver-roster .class-card.locked .class-portrait { filter:grayscale(.85) brightness(.47) }
.delver-roster .class-card.locked .class-check {
  display:grid; opacity:1; transform:none; background:#172022; color:#ead3a8;
}
.delver-launch { display:grid; justify-items:center; gap:5px; width:min(100%,480px) }
.delver-launch .entry-secondary {
  width:auto; max-width:100%; min-height:44px; border:0; background:transparent; color:#e3cda7;
  padding:5px 12px; gap:7px; font-size:17px;
}
.delver-launch .entry-secondary .icon { width:16px; height:16px }
.delver-launch .entry-secondary .down-chevron { width:13px; height:13px }
.entry-wait { display:grid; min-height:54px; align-items:center; text-align:center; color:#ddd3bb; overflow-wrap:anywhere }

.entry-sheet {
  position:fixed; inset:auto 0 var(--entry-keyboard,0px); margin:0 auto; width:min(100%,480px); max-width:100%;
  max-height:calc(var(--entry-visible-height,100dvh) - max(12px,env(safe-area-inset-top))); overflow:auto; overscroll-behavior:contain;
  border:1px solid #948467; border-bottom:0; border-radius:12px 12px 0 0;
  padding:0 var(--entry-right) max(22px,calc(10px + env(safe-area-inset-bottom))) var(--entry-left);
  background:#182020; box-shadow:0 -12px 45px #060b0d6b; font:400 18px/1.4 var(--font-body);
}
.entry-sheet::backdrop { background:#080e11bc }
.entry-sheet-head, .entry-overlay .modal-head {
  position:sticky; top:0; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:12px;
  min-height:62px; padding:9px 0; margin-bottom:12px; border-bottom:1px solid #93856859; background:#182020;
}
.entry-sheet-head h2, .entry-overlay .modal-head h2 { font:700 29px/1.07 var(--font-display); color:var(--entry-paper) }
.entry-sheet-head form { margin:0 }
.entry-sheet-head .entry-icon { border:0; background:transparent }
.entry-sheet-body, .entry-form { display:grid; gap:12px }
.entry-field { display:grid; gap:5px; font-weight:600 }
.entry-field input { min-height:48px; color:var(--entry-paper); border-color:#777464; font-size:19px }
.entry-field #code { text-transform:uppercase; font-weight:700; letter-spacing:.14em }
.entry-row, .entry-sheet .ledger-link {
  display:flex; width:100%; align-items:center; gap:10px; min-height:46px; padding:8px 0;
  background:none; border:0; border-bottom:1px solid #93856855; border-radius:0; text-align:left;
  justify-content:flex-start; color:var(--entry-paper); cursor:pointer; font:600 18px/1.25 var(--font-body);
}
.entry-row>.icon:first-child, .entry-sheet .ledger-link .icon { color:var(--entry-brass) }
.entry-row>.icon:last-child:not(:first-child), .entry-row>b { margin-left:auto; color:var(--entry-brass) }
.entry-sheet [data-install] { display:none }
.can-install .entry-sheet [data-install] { display:flex }
.entry-sheet .entry-status { color:#f0cf93; font-size:16px }
.entry-status:empty { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%) }
.entry-room { display:flex; align-items:center; justify-content:space-between; gap:8px }
.entry-room>span, .entry-trinket small { display:block; color:#cebfa6; font-size:16px }
.entry-room b { display:block; color:#eed19b; font:700 28px/1.1 var(--font-display); letter-spacing:.14em }
.entry-sheet .plist { display:grid; grid-template-columns:minmax(0,1fr); gap:4px }
.entry-sheet .prow-l { background:transparent; border:0; border-bottom:1px solid #93856838 }
.entry-sheet .prow-l .nm { overflow-wrap:anywhere }
.entry-trinket { display:flex; align-items:flex-start; gap:12px; padding-top:12px; border-top:1px solid #93856855 }
.entry-trinket img { width:56px; height:56px; object-fit:contain }
.entry-trinket strong { display:block; margin:1px 0 3px; color:var(--entry-brass); font-size:20px }
.entry-sheet .mode-list { grid-template-columns:minmax(0,1fr); gap:7px }
.entry-sheet .mode-card { min-height:60px; padding:7px 12px }
.entry-sheet .mode-card b { font-size:22px }
.entry-sheet .mode-card .top span { margin-top:1px }
.entry-timer>span { display:block; margin:0 0 5px; font-weight:600 }
.entry-timer>div { display:flex; flex-wrap:wrap; gap:6px }
.entry-timer .btn { min-width:44px }
.entry-timer .btn.on { border-color:var(--entry-brass); color:var(--entry-brass) }
.entry-rules summary { width:fit-content; min-height:44px; padding:10px 0; color:var(--entry-brass); cursor:pointer }
.entry-rules summary:focus-visible { outline:2px solid var(--entry-brass); outline-offset:2px }
.entry-rules section { padding-block:12px; border-top:1px solid #93856855 }
.entry-rules h3 { margin-bottom:6px; font-size:20px }
.entry-rules ul { margin:6px 0 0; padding-left:22px; color:#d2c9b7 }
.entry-overlay .modal-body { overflow:visible; padding:0 }
.entry-overlay .help p, .entry-overlay .gloss { font-size:17px }

@media (max-width:760px), (pointer:coarse) {
  body:has(.entry-loading)::before { background:none }
  .entry-loading { margin:auto auto 0; padding:20px 16px max(32px,env(safe-area-inset-bottom)) }
  .entry-loading::before {
    content:""; position:absolute; inset:0; z-index:-1;
    background:linear-gradient(0deg,#0b1111,transparent 46%),var(--entry-belfry);
  }
  .entry-loading .loading-lantern { display:none }
  .entry-loading h1 { font:800 clamp(32px,9vw,52px)/1.08 var(--font-display); text-transform:uppercase }
  .entry-loading .connection-message { color:#e4cfaa }
}
@media (min-width:540px) and (orientation:landscape) {
  .title-screen::before { right:36%; background-position:center 32% }
  .title-screen::after { background:linear-gradient(90deg,transparent 27%,#10171846 41%,var(--entry-ink) 62%) }
  .title-menu { align-self:flex-end; margin:auto 3vw auto 0; width:min(44%,436px) }
  .title-wordmark { font-size:clamp(40px,7.4vw,80px) }
  .title-wordmark span { font-size:clamp(20px,2.8vw,31px) }
  .delver-screen { grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); grid-template-rows:auto minmax(175px,1fr) }
  .delver-bar { grid-column:1/-1 }
  .delver-controls { padding-left:var(--entry-pad); border-left:1px solid #8c805c48; gap:18px }
  .delver-roster { grid-template-columns:repeat(3,minmax(44px,1fr)); max-width:250px }
  .delver-launch { max-width:340px }
  .delver-caption { bottom:max(7px,env(safe-area-inset-bottom)) }
  .delver-caption h2 { font-size:clamp(40px,7vw,80px) }
}
@media (min-width:540px) and (orientation:landscape) and (max-height:480px) {
  .title-menu { padding-block:10px max(14px,env(safe-area-inset-bottom)) }
  .title-wordmark { margin-bottom:14px }
  .delver-roster { max-width:186px }
  .delver-controls { gap:6px }
  .delver-launch .entry-primary { padding-inline:30px; font-size:22px }
}
@media (max-height:610px) and (orientation:portrait) {
  .title-menu { padding-top:12px; padding-bottom:max(14px,env(safe-area-inset-bottom)) }
  .title-wordmark { margin-bottom:14px }
  .delver-controls { gap:3px; padding-bottom:max(10px,env(safe-area-inset-bottom)) }
}
@media (min-width:600px) {
  .entry-sheet { bottom:max(12px,var(--entry-keyboard,0px)); border-bottom:1px solid #948467; border-radius:10px }
}
@media (forced-colors:active) {
  .delver-roster .class-card.on { outline:3px solid Highlight; outline-offset:-3px }
  .delver-roster .class-check { forced-color-adjust:none }
}
@media (prefers-reduced-motion:no-preference) {
  .entry-sheet[open] { animation:entry-sheet-in .16s ease-out }
  @keyframes entry-sheet-in { from { transform:translateY(14px); opacity:.8 } }
}
