/* The Lighthouse — retro terminal + scene layout */
:root {
  --bg:        #0b0d10;
  --panel:     #12161b;
  --panel2:    #0e1216;
  --amber:     #e8c26a;
  --amber-dim: #b8954a;
  --green:     #79d18b;
  --text:      #cfd6dc;
  --dim:       #8b96a0;
  --echo:      #6fb0c9;
  --hint:      #d3a8e0;
  --dark:      #6b7682;
  --ending:    #f0d9a0;
  --rule:      #46505a;
  --border:    #2a323b;
  --crt:       #0a0c0f;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background:
    radial-gradient(120% 90% at 50% 0%, #161b21 0%, var(--bg) 70%);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 14px;
}

/* --- status bar --- */
#status {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  align-items: center;
  background: linear-gradient(180deg, #1b222a, #11161b);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: "DejaVu Sans Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--amber);
}
#status .pill { color: var(--dim); }
#status .pill b { color: var(--amber); font-weight: 600; }
#status .spacer { flex: 1; }
#status .badge {
  padding: 2px 9px; border-radius: 20px; border: 1px solid var(--border);
  font-size: 0.74rem;
}
.badge.day   { color: #ffe9a8; border-color: #6a5a2a; background: #211d10; }
.badge.night { color: #aebde6; border-color: #2c3656; background: #121726; }
.badge.tide-low  { color: #8fe0c0; border-color: #2a5a48; background: #0f1f1a; }
.badge.tide-high { color: #8fb6d0; border-color: #28465c; background: #0f1a22; }

/* --- main split: scene + transcript --- */
#main {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 12px;
  min-height: 0;
}
@media (max-width: 820px) {
  #main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #scene-wrap { max-height: 38vh; }
}

#scene-wrap {
  background: var(--crt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex; flex-direction: column;
  min-height: 0;
  align-self: start;            /* don't stretch to the transcript's full height */
}
#scene {
  /* Hold the artwork's own 8:5 shape so the image never has to be cropped to
     fill a mismatched box. Whatever the window width, the pane keeps this ratio. */
  width: 100%;
  aspect-ratio: 8 / 5;
  max-height: 62vh;            /* never taller than the viewport on wide/short screens */
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
}
/* contain = the whole picture is always visible (letterboxed if a file isn't
   exactly 8:5); cover would crop. Scene art should never be cropped. */
.scene-svg { width: 100%; height: 100%; display: block; image-rendering: auto; }
.scene-img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 6px; }
#scene-caption {
  margin-top: 8px;
  font-family: "DejaVu Sans Mono", monospace;
  font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--amber-dim); text-align: center;
}

/* --- transcript --- */
#log {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-y: auto;
  font-size: 1.02rem;
  line-height: 1.5;
  min-height: 0;
  scroll-behavior: smooth;
}
#log .line { margin: 0 0 0.55em; white-space: pre-wrap; }
#log .title    { color: var(--amber); font-weight: 700; letter-spacing: 0.06em;
                 font-family: "DejaVu Sans Mono", monospace; font-size: 1.05rem; }
#log .system   { color: var(--dim); font-family: "DejaVu Sans Mono", monospace; font-size: 0.9rem; }
#log .room-title { color: var(--amber); font-weight: 700; letter-spacing: 0.08em;
                 font-family: "DejaVu Sans Mono", monospace; font-size: 0.92rem; margin-top: 0.3em; }
#log .echo     { color: var(--echo); font-family: "DejaVu Sans Mono", monospace; }
#log .hint     { color: var(--hint); font-style: italic; }
#log .dark     { color: var(--dark); font-style: italic; }
#log .exits    { color: var(--amber-dim); font-family: "DejaVu Sans Mono", monospace; font-size: 0.85rem; letter-spacing: 0.03em; }
#log .ending   { color: var(--ending); }
#log .rule     { color: var(--rule); font-family: "DejaVu Sans Mono", monospace; }
#log .room-title { border-top: 1px dashed var(--border); padding-top: 0.5em; }

/* --- input --- */
#input-row {
  display: flex; gap: 10px; align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
#prompt { color: var(--green); font-family: "DejaVu Sans Mono", monospace; font-size: 1.1rem; }
#cmd {
  flex: 1;
  background: transparent; border: none; outline: none;
  color: var(--text);
  font-family: "DejaVu Sans Mono", monospace; font-size: 1.05rem;
  letter-spacing: 0.02em;
}
#cmd::placeholder { color: #4a545e; }
.btn {
  background: #1c242d; color: var(--amber); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; cursor: pointer;
  font-family: "DejaVu Sans Mono", monospace; font-size: 0.82rem;
}
.btn:hover { background: #243039; }

/* subtle scanline flavor over the scene */
#scene::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
}
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #28323b; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
