@font-face { font-family: "Anton"; src: url(fonts/anton-latin-400-normal.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "Dela"; src: url(fonts/dela-gothic-one-subset.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "Yomogi"; src: url(fonts/yomogi-subset.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "DotGothic"; src: url(fonts/dotgothic16-subset.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "Caveat"; src: url(fonts/caveat-latin-400-normal.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "Inter"; src: url(fonts/inter-latin-400-normal.woff2) format("woff2"); font-weight: 400; }
@font-face { font-family: "Inter"; src: url(fonts/inter-latin-700-normal.woff2) format("woff2"); font-weight: 700; }

:root {
  --paper: #f3ead6;
  --paper-2: #e9dec5;
  --ink: #2a2420;
  --muted: #7a6a58;
  --red: #b8322a;
  --red-2: #9e2a23;
  --wood: #6b4426;
  --wood-dark: #3a2414;
  --indigo: #25375a;
  --line: rgba(42, 36, 32, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1a130d; color: var(--ink); font-family: Inter, system-ui, sans-serif; overflow: hidden; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.screen { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10; padding: 20px; }
.hidden { display: none !important; }

/* wooden wall behind the lobby card */
#lobby {
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.18) 0 2px, transparent 2px 96px),
    repeating-linear-gradient(0deg, rgba(255,220,170,0.035) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #5a3a22, #3f2817 70%, #2e1d10);
  overflow-y: auto;
}

.lobby-card {
  position: relative;
  width: min(560px, 100%);
  background: var(--paper);
  background-image: radial-gradient(rgba(120, 90, 50, 0.08) 1px, transparent 1px);
  background-size: 5px 5px;
  border: 10px solid var(--wood);
  border-image: linear-gradient(135deg, #7a5232, #5a3a22 40%, #7a5232 70%, #4a2f1b) 1;
  padding: 34px 32px 24px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.55), inset 0 0 40px rgba(120, 90, 50, 0.12);
  text-align: center;
}
.lobby-card.small { width: min(420px, 100%); }

.logo { display: inline-flex; align-items: stretch; gap: 14px; }
.logo h1 { font-family: Dela, sans-serif; font-weight: 400; font-size: clamp(40px, 8.5vw, 62px); margin: 0; color: var(--ink); letter-spacing: 1px; line-height: 1.05; }
.logo-tag { writing-mode: vertical-rl; background: var(--red); color: var(--paper); font-family: Dela, sans-serif; font-size: 17px; padding: 8px 6px; letter-spacing: 3px; }
.jp-sub { font-family: Dela, sans-serif; color: var(--red); margin: 8px 0 4px; font-size: 14px; letter-spacing: 3px; }
.tagline { color: var(--muted); margin: 0 0 24px; font-size: 15px; }

.row { display: flex; align-items: stretch; background: #fffaf0; border: 2px solid var(--ink); overflow: hidden; }
.row:focus-within { box-shadow: 0 0 0 3px rgba(184, 50, 42, 0.2); }
.at { display: grid; place-items: center; padding: 0 2px 0 12px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.row input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--ink); font-size: 16px; padding: 13px 6px; outline: none; font-family: inherit; }

.btn { font-family: inherit; font-size: 15px; font-weight: 700; border: 2px solid var(--ink); padding: 11px 18px; cursor: pointer; color: var(--ink); background: transparent; transition: transform .08s ease, background .15s ease; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); color: var(--paper); border-color: var(--red); }
.row .btn.primary { border: 0; border-left: 2px solid var(--ink); }
.btn.primary:hover { background: var(--red-2); }
.btn.ghost { margin-top: 14px; }
.btn.ghost:hover { background: rgba(42,36,32,0.06); }
.btn.wide { width: 100%; margin-top: 10px; }

.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; line-height: 1.5; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; margin: 24px 0 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 0; border-top: 2px dashed var(--line); }

.drop { display: flex; flex-direction: column; gap: 6px; padding: 20px 16px; border: 2px dashed var(--muted); cursor: pointer; background: rgba(255, 250, 240, 0.5); transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { background: #fffaf0; border-color: var(--red); }
.drop strong { font-size: 16px; }
.drop span { color: var(--muted); font-size: 13px; }
.drop small { color: #9a8a76; font-size: 11.5px; }

.get-export { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.get-export a { color: var(--red); font-weight: 700; }
.privacy { margin-top: 14px; text-align: left; font-size: 12.5px; line-height: 1.55; color: #4a3f36; background: #fffaf0; border: 1px solid var(--line); border-left: 4px solid #2f6b3a; padding: 10px 12px; }
.privacy p { margin: 0 0 6px; }
.privacy .share { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; color: var(--ink); cursor: pointer; }
.privacy .share input { margin-top: 3px; accent-color: var(--red); }
.settings { margin-top: 18px; text-align: left; font-size: 13px; color: var(--muted); }
.settings summary { cursor: pointer; text-align: center; }
.settings label { display: block; margin-top: 12px; }
.settings em { font-style: normal; opacity: 0.8; font-size: 11.5px; }
.settings input, .sel select, #searchInput {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 2px solid var(--line);
  background: #fffaf0; color: var(--ink); font: inherit; outline: none;
}
.settings input:focus, #searchInput:focus, .sel select:focus { border-color: var(--red); }

.badge { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }
.badge.ok { color: #2f6b3a; font-weight: 700; }
.badge.err { color: var(--red); font-weight: 700; }
.badge.warn { color: #8a5a00; text-align: left; line-height: 1.5; background: #fff4d6; border: 1px dashed #c99a3a; padding: 8px 10px; }
.poster-setup { display: flex; margin-top: 8px; border: 2px solid var(--ink); background: #fffaf0; }
.poster-setup input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 12px; font: inherit; color: var(--ink); outline: none; }
.poster-setup .btn { border: 0; border-left: 2px solid var(--ink); }
.status { min-height: 20px; margin: 8px 0 0; font-size: 13.5px; color: var(--indigo); font-weight: 700; }
.status.err { color: var(--red); }

/* loading: a VCR on-screen display */
#loading { background: #101820; }
.vcr { font-family: DotGothic, monospace; color: #e8f0ff; text-align: left; }
.vcr-text { font-size: 56px; letter-spacing: 4px; }
.vcr-sub { font-size: 22px; opacity: 0.8; margin-top: 6px; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-family: DotGothic, monospace; color: #fff7e8; }
#hud::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 22%, rgba(20, 12, 6, 0.78) 100%); opacity: 0; transition: opacity .35s; }
body.inspecting #hud::before { opacity: 1; }
body.inspecting #keysHint, body.inspecting #crosshair { opacity: 0; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255, 247, 232, 0.9); box-shadow: 0 0 4px rgba(0,0,0,0.8); transition: transform .12s, background .12s; }
#crosshair.on { transform: scale(2); background: #ff7a5c; }
#hoverLabel { position: absolute; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); font-size: 20px; text-shadow: 0 2px 5px #000, 0 0 2px #000; white-space: nowrap; }
#hoverLabel .stars { color: #ff9a7a; }
#hoverLabel .sub { display: block; text-align: center; font-size: 14px; color: #e6d9c2; }
#inspectHelp { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); font-size: 16px; background: rgba(243, 234, 214, 0.94); color: var(--ink); padding: 8px 16px; white-space: nowrap; border: 2px solid var(--ink); }
#inspectHelp kbd { color: var(--ink); background: #fffaf0; border-color: var(--ink); }
#minimap { position: absolute; right: 16px; top: 16px; width: 200px; height: 200px; background: rgba(243, 234, 214, 0.92); border: 6px solid var(--wood); }
#storeTag { position: absolute; left: 16px; top: 14px; font-family: Dela, sans-serif; font-size: 20px; background: var(--paper); color: var(--ink); padding: 8px 14px 9px; border-left: 8px solid var(--red); }
#storeTag small { display: block; font-family: DotGothic, monospace; font-size: 13px; color: var(--muted); margin-top: 2px; }
#toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-left: 8px solid var(--red); padding: 8px 16px; font-size: 16px; }
#keysHint { position: absolute; left: 16px; bottom: 16px; font-size: 14px; color: #fff7e8; text-shadow: 0 1px 3px #000; }
kbd { font-family: DotGothic, monospace; background: rgba(255, 247, 232, 0.16); border: 1px solid rgba(255, 247, 232, 0.4); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; font-size: 0.95em; }
.lobby-card kbd { background: #fffaf0; border-color: var(--line); color: var(--ink); }

#pause, #search { background: rgba(26, 19, 13, 0.55); backdrop-filter: blur(3px); }
.pause-title { font-family: Dela, sans-serif; font-weight: 400; font-size: 30px; margin: 0 0 18px; color: var(--ink); }
.pause-title small { display: block; font-family: DotGothic, monospace; font-size: 14px; color: var(--red); letter-spacing: 4px; margin-top: 4px; }
.sel { display: block; text-align: left; font-size: 13px; color: var(--muted); margin-top: 18px; }
.sel select { cursor: pointer; }

.search-card { text-align: left; padding: 22px; }
#searchInput { font-size: 18px; margin: 0; }
#searchResults { list-style: none; margin: 12px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
#searchResults li { padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; border-bottom: 1px dashed var(--line); }
#searchResults li .meta { color: var(--muted); white-space: nowrap; }
#searchResults li .meta b { color: var(--red); font-weight: 400; }
#searchResults li.active, #searchResults li:hover { background: #fffaf0; box-shadow: inset 4px 0 0 var(--red); }
#searchResults li.empty { color: var(--muted); cursor: default; background: none; box-shadow: none; }

@media (max-width: 700px) {
  #minimap { width: 130px; height: 130px; }
  #keysHint { display: none; }
}
