/* ---------- loader ---------- */
#loader { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: radial-gradient(ellipse at 50% 45%, #5a2e05 0%, #2a1400 60%, #160a00 100%); color: #f3d9a4; overflow: hidden; }
.ld-svg { width: min(38vmin, 260px); overflow: visible; }
.ld-ring-bg { fill: none; stroke: rgba(243, 217, 164, .12); stroke-width: 2; }
.ld-ring { fill: none; stroke: #e5a53a; stroke-width: 2.5; stroke-dasharray: 100; stroke-dashoffset: 100; transform: rotate(-90deg); transition: stroke-dashoffset .3s; stroke-linecap: round; }
.ld-shape { fill: url(#none); fill: #e5a53a; filter: drop-shadow(0 0 18px rgba(229, 165, 58, .55)); }
.ld-rings circle { fill: none; stroke: rgba(229, 165, 58, .45); stroke-width: 1.2; stroke-dasharray: 3 5; }
.ld-title { font-family: 'UTM Horizon', serif; font-size: clamp(28px, 5vmin, 46px); letter-spacing: .04em; color: #f6dca6; text-transform: uppercase; }
.ld-title span { color: #e5a53a; }
.ld-sub { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; opacity: .7; }
.ld-sub b { color: #e5a53a; font-weight: inherit; }

/* ---------- chapter dots ---------- */
#dots { position: fixed; right: 22px; top: 50%; transform: translateY(-50%); z-index: 20; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 6px; border-radius: 22px; opacity: 0; transition: opacity .5s var(--ease); }
body.ready #dots { opacity: 1; } 
#dots:hover { opacity: 1 !important; background: rgba(52, 26, 2, .25); backdrop-filter: blur(10px); }
.dot { all: unset; position: relative; cursor: pointer; width: 22px; height: 22px; display: grid; place-items: center; }
.dot i { width: 6px; height: 6px; border-radius: 50%; background: rgba(90, 44, 0, .45); box-shadow: 0 0 0 1.5px rgba(255, 240, 210, .6); transition: transform .3s var(--ease), background .3s, opacity .3s; }
.dot:hover i { transform: scale(1.6); background: var(--bronze); }
.dot.on i { opacity: 0; }
.dot span { position: absolute; right: 30px; top: 50%; transform: translate(8px, -50%); white-space: nowrap; pointer-events: none;
  padding: 6px 12px; border-radius: 10px; font-size: 13px; color: #f8e5bd; background: rgba(52, 26, 2, .82); opacity: 0;
  transition: opacity .25s, transform .3s var(--ease); box-shadow: 0 6px 20px rgba(40, 18, 0, .3); }
.dot span b { font-family: 'UTM Horizon'; font-weight: normal; color: #f3c46c; margin-right: 8px; }
.dot:hover span, .dot:focus-visible span { opacity: 1; transform: translate(0, -50%); }
.marker { position: absolute; left: 50%; top: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; overflow: visible;
  fill: #b25e04; filter: drop-shadow(0 0 6px rgba(229, 138, 5, .6)) drop-shadow(0 0 1px #fff); }
@media (max-width: 860px) { #dots { display: none; } }

/* ---------- overview ---------- */
#overview { position: fixed; inset: 0; z-index: 40; overflow: auto; padding: 48px clamp(16px, 5vw, 72px) 64px;
  background: rgba(36, 18, 0, .82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); color: #f6e2b8; touch-action: pan-y; }
#overview header { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
#overview h2 { margin: 0; font-family: 'UTM Horizon'; font-weight: normal; font-size: clamp(26px, 3.4vw, 44px); color: #f3c46c; letter-spacing: .03em; }
#overview p { margin: 0; opacity: .7; font-size: 14px; }
kbd { font-family: inherit; font-size: .85em; padding: 2px 7px; border-radius: 6px; background: rgba(255, 220, 160, .14); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .3); }
#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.card { all: unset; cursor: pointer; display: block; border-radius: 14px; transition: transform .35s var(--ease); }
.card .th { aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #e9d4a8; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); outline: 2px solid transparent; outline-offset: 3px; transition: outline-color .25s; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .cap { display: flex; gap: 10px; align-items: baseline; padding: 10px 4px 0; font-size: 14px; }
.card .cap b { font-family: 'UTM Horizon'; font-weight: normal; color: #f3c46c; font-size: 18px; }
.card:hover { transform: translateY(-4px); } .card:hover .th, .card:focus-visible .th { outline-color: rgba(243, 196, 108, .6); }
.card.cur .th { outline-color: #f3c46c; }
body.ov #dots { opacity: 0 !important; pointer-events: none; }

::view-transition-group(deck) { animation-duration: .75s; animation-timing-function: cubic-bezier(.7, 0, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .5s; }

/* ---------- hint / rotate ---------- */
#hint { position: fixed; left: 50%; bottom: 28px; display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 32px); transform: translate(-50%, 10px); z-index: 19; opacity: 0; pointer-events: none;
  transition: opacity .6s, transform .6s var(--ease); font-size: 13px; color: #fff3da; background: rgba(52, 26, 2, .55); padding: 8px 16px; border-radius: 999px; backdrop-filter: blur(10px); }
#hint kbd { margin-right: 4px; }
body.show-hint #hint { opacity: 1; transform: translate(-50%, 0); }
#rotate { display: none; }
body.portrait #rotate { display: flex; position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 30; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 999px; background: rgba(52, 26, 2, .7); color: #f6e2b8; font-size: 13px; }
#rotate svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; animation: tilt 2.4s var(--ease) infinite; }
#rotate p { margin: 0; }

body.shot #dots, body.shot #hint, body.shot #backdrop { display: none; }
body.shot #stage { box-shadow: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { .hud-star { animation: none; } }

/* ---------- toast / waiting ---------- */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); z-index: 30; padding: 9px 18px; border-radius: 999px;
  background: rgba(52, 26, 2, .72); color: #f8e5bd; font-size: 14px; backdrop-filter: blur(12px); opacity: 0; pointer-events: none;
  transition: opacity .35s, transform .45s var(--ease); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#wait { position: fixed; right: 26px; bottom: 26px; z-index: 30; width: 34px; height: 34px; opacity: 0; transition: opacity .3s; pointer-events: none; }
#wait i { position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(145, 72, 1, .2); border-top-color: #b25e04; animation: spin .8s linear infinite; }
body.waiting #wait { opacity: 1; }
