:root {
  --ink: #23201a;
  --paper: rgba(246, 240, 222, 0.92);
  --paper-solid: #f4ecd9;
  --vermilion: #a53b27;
  --line: rgba(44, 36, 24, 0.16);
  --muted: #6d6350;
  --shadow: 0 12px 40px rgba(20, 17, 10, 0.22);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #10141c; color: var(--ink); font-family: Georgia, 'Times New Roman', serif; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#view:active { cursor: grabbing; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 52%, rgba(14, 12, 8, 0.3) 100%); mix-blend-mode: multiply; }
.chrome { transition: opacity .4s ease; }
body.hide-ui .chrome { opacity: 0; pointer-events: none; }

#brand { position: fixed; top: 18px; left: 20px; display: flex; align-items: center; gap: 11px; color: #fff8e8; text-shadow: 0 2px 14px rgba(0,0,0,.55); }
#brand .seal { width: 40px; height: 40px; display: grid; place-items: center; border: 1.5px solid rgba(255,248,232,.75); border-radius: 5px; font-size: 23px; background: rgba(165,59,39,.85); }
#brand strong { display: block; font-size: 19px; letter-spacing: .06em; font-weight: 500; }
#brand span { display: block; font-size: 12px; opacity: .88; margin-top: 2px; letter-spacing: .05em; }

#time-panel { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 12px 15px 11px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.clock-row { display: flex; align-items: center; gap: 13px; }
#play { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper-solid); color: var(--ink); font-size: 15px; cursor: pointer; }
#play:hover { border-color: var(--vermilion); color: var(--vermilion); }
.clock { line-height: 1; min-width: 88px; }
.clock span { font-size: 29px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.clock small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); margin-top: 5px; }
.speeds { display: flex; gap: 3px; margin-left: auto; background: rgba(44,36,24,.06); padding: 3px; border-radius: 9px; }
.speeds button, .presets button { border: 0; background: transparent; color: var(--muted); font-family: inherit; cursor: pointer; border-radius: 7px; font-size: 12px; padding: 6px 9px; }
.speeds button.active { background: var(--paper-solid); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
#scrub { width: 100%; appearance: none; height: 20px; margin: 10px 0 6px; background: transparent; cursor: pointer; }
#scrub::-webkit-slider-runnable-track { height: 5px; border-radius: 4px; background: linear-gradient(90deg, #232c4a 0%, #6f83a6 18%, #e7b78a 32%, #bcd3d5 48%, #f0e6bf 60%, #e8a05c 74%, #4a3f63 85%, #171d33 100%); }
#scrub::-moz-range-track { height: 5px; border-radius: 4px; background: linear-gradient(90deg, #232c4a, #6f83a6 18%, #e7b78a 32%, #bcd3d5 48%, #f0e6bf 60%, #e8a05c 74%, #4a3f63 85%, #171d33); }
#scrub::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--paper-solid); border: 2.5px solid var(--vermilion); margin-top: -6.5px; box-shadow: 0 2px 7px rgba(0,0,0,.25); }
#scrub::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--paper-solid); border: 2.5px solid var(--vermilion); }
.presets { display: flex; gap: 3px; justify-content: space-between; }
.presets button { flex: 1; font-size: 11.5px; padding: 6px 2px; letter-spacing: .02em; }
.presets button.active { background: var(--vermilion); color: #fff7e9; }
.presets button:hover { color: var(--ink); }
.presets button.active:hover { color: #fff7e9; }

#actions { position: fixed; right: 20px; top: 20px; display: flex; gap: 8px; }
#actions button { background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; font-family: inherit; font-size: 13px; cursor: pointer; color: var(--ink); box-shadow: 0 4px 18px rgba(0,0,0,.14); }
#actions button:hover { border-color: var(--vermilion); }
#actions span { margin-left: 3px; }

#reticle { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: 0 0 0 1.5px rgba(0,0,0,.28); pointer-events: none; }
#caption { position: fixed; left: 50%; bottom: 148px; transform: translateX(-50%); font-size: 13.5px; color: #fff9ec; background: rgba(20,17,12,.5); padding: 6px 13px; border-radius: 20px; opacity: 0; transition: opacity .3s; pointer-events: none; text-shadow: 0 1px 4px rgba(0,0,0,.5); white-space: nowrap; }
#caption.show { opacity: 1; }
#tooltip { position: fixed; transform: translate(14px, 14px); background: var(--paper-solid); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; font-size: 13px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .15s; max-width: 230px; z-index: 8; }
#tooltip.show { opacity: 1; }
#tooltip b { display: block; font-weight: 600; }
#tooltip span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
#toast { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); background: var(--paper-solid); padding: 8px 17px; border-radius: 20px; font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none; box-shadow: var(--shadow); }
#toast.show { opacity: 1; }

#help { position: fixed; right: 20px; top: 74px; width: min(340px, calc(100vw - 40px)); max-height: calc(100vh - 190px); overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 15px; padding: 19px 21px; box-shadow: var(--shadow); backdrop-filter: blur(12px); opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity .25s, transform .25s; }
#help.open { opacity: 1; transform: none; pointer-events: auto; }
#help h2 { margin: 0 0 9px; font-size: 20px; font-weight: 500; }
#help p { font-size: 13px; line-height: 1.55; margin: 0 0 12px; }
#help dl { display: grid; grid-template-columns: 92px 1fr; gap: 5px 12px; font-size: 12.5px; margin: 0 0 12px; }
#help dt { font-weight: 700; }
#help dd { margin: 0; color: var(--muted); }
#help .small { font-size: 11.5px; color: var(--muted); margin-bottom: 0; }
#help-close { position: absolute; top: 9px; right: 11px; border: 0; background: transparent; font-size: 21px; color: var(--muted); cursor: pointer; }

#entry { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, rgba(18,22,32,.34), rgba(10,12,18,.78)); z-index: 20; transition: opacity .8s; }
#entry.gone { opacity: 0; pointer-events: none; }
.entry-card { text-align: center; color: #f5ecd7; max-width: 480px; padding: 30px; }
.mon { width: 70px; height: 70px; margin: 0 auto 22px; border: 2px solid rgba(245,236,215,.8); border-radius: 10px; display: grid; place-items: center; font-size: 40px; background: rgba(165,59,39,.9); }
.eyebrow { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; opacity: .8; }
h1 { font-size: 52px; font-weight: 400; margin: 10px 0 14px; letter-spacing: .04em; }
.lede { font-size: 15.5px; line-height: 1.65; opacity: .92; margin: 0 auto 26px; max-width: 420px; }
#enter { font-family: inherit; font-size: 16px; padding: 13px 34px; border-radius: 30px; border: 1px solid rgba(245,236,215,.6); background: var(--vermilion); color: #fff8e9; cursor: pointer; letter-spacing: .04em; }
#enter:hover { background: #b94833; }
.hint { font-size: 11.5px; opacity: .66; margin-top: 20px; letter-spacing: .04em; }

#loading { position: fixed; inset: 0; display: grid; place-items: center; background: #10141c; color: #d8cbae; font-size: 14px; letter-spacing: .14em; z-index: 30; transition: opacity .6s; }
#loading.done { opacity: 0; pointer-events: none; }

#joy-base { display: none; position: fixed; left: 26px; bottom: 176px; width: 104px; height: 104px; border-radius: 50%; background: rgba(246,240,222,.16); border: 1.5px solid rgba(255,255,255,.4); touch-action: none; z-index: 6; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: rgba(246,240,222,.6); border: 1px solid rgba(255,255,255,.7); }
#look-hint { display: none; position: fixed; right: 26px; bottom: 186px; color: rgba(255,255,255,.75); font-size: 11px; letter-spacing: .1em; text-shadow: 0 1px 5px rgba(0,0,0,.6); }
body.touch #joy-base { display: block; }
body.touch #look-hint { display: block; }
body.touch #reticle { opacity: .6; }

@media (max-width: 760px) {
  #brand { top: 12px; left: 12px; }
  #brand .seal { width: 33px; height: 33px; font-size: 19px; }
  #brand strong { font-size: 16px; }
  #brand span { font-size: 10.5px; }
  #actions { top: 12px; right: 12px; }
  #actions button { padding: 8px 10px; }
  #actions span { display: none; }
  #time-panel { bottom: calc(12px + env(safe-area-inset-bottom)); padding: 10px 12px; width: calc(100vw - 24px); }
  .clock span { font-size: 24px; }
  .clock { min-width: 75px; }
  .speeds button { padding: 6px 7px; }
  .presets { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .presets::-webkit-scrollbar { display: none; }
  .presets button { flex: none; min-width: 58px; min-height: 34px; }
  #caption { bottom: 184px; max-width: 88vw; overflow: hidden; text-overflow: ellipsis; }
  #help { top: 62px; right: 12px; max-height: calc(100vh - 200px); }
  #joy-base { bottom: 200px; }
  #look-hint { bottom: 214px; }
  h1 { font-size: 40px; }
  .entry-card { padding: 22px; }
}
@media (max-width: 430px) {
  .lede { font-size: 14px; }
  .clock-row { gap: 8px; }
  .clock small { font-size: 9px; }
  .speeds button { font-size: 11px; padding: 6px 6px; }
}

/* catalogue peek: keep the frame composed, let the village lead */
.peek .presets button:not(.active) { display: none; }
.peek .presets { justify-content: center; }
@media (max-width: 760px) {
  .peek #time-panel { opacity: 0; pointer-events: none; }
  .peek #joy-base, .peek #look-hint { display: none; }
}
