/* ============================================================================
   Abobaku: Escape from Old Ife — stylesheet
   Warm, hand-painted, historical aesthetic. Earth tones, terracotta, ochre,
   deep indigo night tones. Responsive (desktop + tablet).
   ========================================================================== */

:root {
  --bg: #1a140d;
  --panel: #2a2013;
  --panel-2: #332817;
  --line: #c8924a;
  --line-dim: #7a5c2e;
  --gold: #e0b45c;
  --gold-bright: #f3d08a;
  --text: #efe3c8;
  --text-dim: #bfae86;
  --danger: #c24b3a;
  --ok: #7da05c;
  --indigo: #2b3a54;
  --ink: #14100a;
  --shadow: 0 6px 24px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Georgia", "Palatino Linotype", "Book Antiqua", serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hidden { display: none !important; }

/* ---------------------------------------------------------------------------
   Title screen
   ------------------------------------------------------------------------- */
#title-screen {
  background:
    radial-gradient(120% 90% at 50% 0%, #3a2b18 0%, #22180e 55%, #14100a 100%);
}
.title-inner { text-align: center; padding: 24px; max-width: 560px; }
.title-sigil { margin: 0 auto 8px; opacity: .9; filter: drop-shadow(0 4px 12px rgba(224,180,92,.35)); }
.title-name {
  font-size: clamp(40px, 9vw, 76px);
  letter-spacing: .18em;
  margin: 0;
  color: var(--gold);
  text-shadow: 0 3px 0 #6b4b1f, 0 8px 24px rgba(0,0,0,.6);
}
.title-sub {
  font-size: clamp(16px, 3.4vw, 22px);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 4px 0 16px;
}
.title-desc {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-dim);
  font-style: italic;
  margin: 0 auto 28px;
  max-width: 420px;
}
.title-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.title-note { font-size: 12px; color: var(--text-dim); margin-top: 16px; min-height: 16px; }

.name-input {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: rgba(0,0,0,.35);
  border: 1px solid var(--line-dim);
  border-radius: 8px;
  padding: 10px 14px;
  width: min(300px, 90%);
  text-align: center;
  margin: 0 auto 20px;
  display: block;
}
.name-input::placeholder { color: var(--text-dim); }
.name-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 10px rgba(224,180,92,.3); }

/* ---------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.btn {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: linear-gradient(180deg, #4a3a20, #352a16);
  border: 1px solid var(--line-dim);
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, border-color .12s ease;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
}
.btn:hover { border-color: var(--gold); box-shadow: 0 4px 14px rgba(224,180,92,.25); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #a8792f, #7d591f);
  border-color: var(--gold);
  color: #fff7e2;
  font-weight: bold;
}
.btn-secondary { background: linear-gradient(180deg, #45341c, #2f2412); }
.btn-ghost { background: transparent; border-color: var(--line-dim); color: var(--text-dim); }
.btn-danger { background: linear-gradient(180deg, #7c3528, #592319); border-color: #c24b3a; }
.btn-icon {
  padding: 6px 12px;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--line-dim);
}

/* ---------------------------------------------------------------------------
   Help overlay
   ------------------------------------------------------------------------- */
.overlay-screen { background: rgba(10,8,4,.75); z-index: 50; }
.help-card {
  background: var(--panel);
  border: 1px solid var(--line-dim);
  border-radius: 12px;
  max-width: 560px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.help-card h2 { color: var(--gold); margin-top: 0; }
.help-card li { margin: 8px 0; line-height: 1.45; color: var(--text); }
.help-card p { line-height: 1.5; color: var(--text); }
.close-help { margin-top: 12px; width: 100%; }

/* ---------------------------------------------------------------------------
   HUD
   ------------------------------------------------------------------------- */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: linear-gradient(180deg, rgba(20,15,8,.95), rgba(20,15,8,.75));
  border-bottom: 1px solid var(--line-dim);
  z-index: 20;
  gap: 10px;
}
#hud-objective {
  font-size: 13px;
  font-style: italic;
  color: var(--gold-bright);
  max-width: 34%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#hud-center { position: absolute; left: 0; right: 0; text-align: center; pointer-events: none; }
#hud-location {
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
}
#hud-right { display: flex; align-items: center; gap: 10px; }
#hud-time, #hud-suspicion {
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--line-dim);
  border-radius: 20px;
  background: rgba(0,0,0,.35);
  white-space: nowrap;
}
#hud-time .dot, #hud-suspicion .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* ---------------------------------------------------------------------------
   Stage / scene
   ------------------------------------------------------------------------- */
#stage {
  position: absolute;
  top: 52px; bottom: 64px; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c0a06;
}
#scene {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0c0a06;
}
#scene-svg { position: absolute; inset: 0; }
#scene-svg svg { width: 100%; height: 100%; display: block; }
#hotspots { position: absolute; inset: 0; }

/* Hotspot overlays — always outlined so they are discoverable by touch. */
.hotspot {
  position: absolute;
  cursor: pointer;
  border-radius: 6px;
  border: 1.5px dashed rgba(224,180,92,.5);
  box-shadow: 0 0 8px rgba(224,180,92,.12), inset 0 0 12px rgba(224,180,92,.08);
  transition: box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.hotspot:hover, .hotspot:focus-visible, .hotspot:active {
  border-style: solid;
  border-color: var(--gold-bright);
  box-shadow: inset 0 0 0 2px var(--gold-bright), 0 0 18px rgba(224,180,92,.5);
  background: rgba(224,180,92,.12);
  outline: none;
}
.hotspot-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: rgba(15,11,6,.95);
  border: 1px solid var(--line);
  color: var(--gold-bright);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
}
.hotspot:hover .hotspot-label, .hotspot:focus-visible .hotspot-label, .hotspot:active .hotspot-label { opacity: 1; }

/* Scene description card */
.scene-desc {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: 620px;
  width: calc(100% - 40px);
  background: rgba(15,11,6,.86);
  border: 1px solid var(--line-dim);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  pointer-events: none;
  backdrop-filter: blur(3px);
}

/* ---------------------------------------------------------------------------
   Dialogue box
   ------------------------------------------------------------------------- */
#dialogue-box {
  position: absolute;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 760px;
  background: linear-gradient(180deg, rgba(38,29,16,.97), rgba(24,18,9,.97));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  z-index: 40;
  box-shadow: var(--shadow);
}
#dialogue-speaker {
  color: var(--gold-bright);
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 6px;
  letter-spacing: .04em;
}
#dialogue-text { font-size: 16px; line-height: 1.5; margin-bottom: 12px; }
#dialogue-choices { display: flex; flex-direction: column; gap: 8px; }
#dialogue-choices .btn { text-align: left; font-size: 14px; }
#dialogue-continue { display: block; margin-left: auto; }

/* ---------------------------------------------------------------------------
   Interaction prompt
   ------------------------------------------------------------------------- */
#interaction-prompt {
  position: absolute;
  left: 50%;
  bottom: 30%;
  transform: translateX(-50%);
  background: rgba(15,11,6,.9);
  border: 1px solid var(--line);
  color: var(--gold-bright);
  padding: 8px 16px;
  border-radius: 8px;
  z-index: 35;
  font-size: 14px;
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
   Bottom bar
   ------------------------------------------------------------------------- */
#bottombar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px;
  background: linear-gradient(0deg, rgba(20,15,8,.96), rgba(20,15,8,.8));
  border-top: 1px solid var(--line-dim);
  z-index: 20;
}

/* ---------------------------------------------------------------------------
   Panels (inventory / menu)
   ------------------------------------------------------------------------- */
.panel {
  position: absolute;
  top: 60px;
  right: 12px;
  width: min(380px, calc(100vw - 24px));
  max-height: calc(100% - 140px);
  overflow-y: auto;
  background: linear-gradient(180deg, #332817, #241b0e);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 45;
  padding: 0 16px 16px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-dim);
  padding: 14px 0 10px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: #332817;
}
.panel-header h3 { margin: 0; color: var(--gold); letter-spacing: .05em; }

.inventory-list { display: flex; flex-direction: column; gap: 8px; }
.inv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-dim);
  border-radius: 8px;
  cursor: pointer;
  background: rgba(0,0,0,.2);
  transition: border-color .12s ease;
}
.inv-item:hover { border-color: var(--gold); }
.inv-item .inv-icon { font-size: 22px; width: 28px; text-align: center; }
.inv-item .inv-name { font-weight: bold; font-size: 14px; }
.inv-item .inv-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.inv-item.selected { border-color: var(--gold-bright); box-shadow: 0 0 10px rgba(224,180,92,.35); }

.inventory-combine {
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed var(--line-dim);
  border-radius: 8px;
  min-height: 40px;
  color: var(--text-dim);
  font-size: 13px;
}
.inventory-detail { margin-top: 12px; font-size: 13px; color: var(--text); line-height: 1.5; }

.menu-buttons { display: flex; flex-direction: column; gap: 10px; }
.menu-note { margin-top: 12px; font-size: 12px; color: var(--text-dim); min-height: 16px; }

/* ---------------------------------------------------------------------------
   Toast
   ------------------------------------------------------------------------- */
.toast {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,11,6,.95);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  padding: 10px 18px;
  border-radius: 8px;
  z-index: 60;
  font-size: 14px;
  max-width: 80vw;
  text-align: center;
  animation: toast-in .25s ease;
}
.toast.warn { border-color: var(--danger); color: #f0a79b; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------------------------------------------------------------------------
   Exits (scene-to-scene travel buttons)
   ------------------------------------------------------------------------- */
.exit {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(15,11,6,.6);
  border: 1.5px solid var(--gold);
  border-radius: 10px;
  padding: 6px 10px;
  color: var(--text);
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 0 8px rgba(224,180,92,.15);
  transition: border-color .12s ease, background .12s ease;
  font-family: inherit;
}
.exit:hover, .exit:active { border-color: var(--gold-bright); background: rgba(224,180,92,.18); }
.exit-arrow { font-size: 16px; color: var(--gold-bright); }
.exit-label { font-size: 11px; white-space: nowrap; }

/* ---------------------------------------------------------------------------
   Inventory panel extras
   ------------------------------------------------------------------------- */
.inv-empty { color: var(--text-dim); font-style: italic; padding: 12px 0; }
.inv-item .inv-desc { display: block; }

/* ---------------------------------------------------------------------------
   Ending screen
   ------------------------------------------------------------------------- */
.ending-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 0%, #3a2b18 0%, #1a120a 60%, #0e0a05 100%);
}
.ending-card {
  max-width: 560px;
  width: calc(100% - 40px);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 30px;
  box-shadow: var(--shadow);
}
.ending-title { font-size: 32px; margin: 0 0 6px; letter-spacing: .04em; }
.ending-sub { color: var(--text-dim); font-style: italic; margin: 0 0 18px; }
.ending-text { font-size: 15px; line-height: 1.6; color: var(--text); }
.ending-stats { font-size: 12px; color: var(--text-dim); margin: 18px 0; }
.ending-stats span { margin: 0 6px; }
.ending-card .btn { margin: 6px; }

/* ---------------------------------------------------------------------------
   Responsive tweaks
   ------------------------------------------------------------------------- */
@media (max-width: 640px) {
  #hud { height: 48px; padding: 4px 8px; }
  #stage { top: 48px; bottom: 58px; }
  #hud-objective { display: none; }
  #hud-center { text-align: left; padding-left: 4px; }
  #hud-location { font-size: 12px; }
  #hud-time, #hud-suspicion { font-size: 11px; padding: 3px 7px; }
  #btn-menu { padding: 4px 9px; font-size: 16px; }

  #bottombar { height: 58px; gap: 6px; padding: 6px 8px; }
  #bottombar .btn { font-size: 12px; padding: 8px 10px; }

  #dialogue-box { width: calc(100% - 16px); bottom: 66px; padding: 12px 14px; }
  #dialogue-text { font-size: 15px; }
  .scene-desc { font-size: 12px; bottom: 8px; width: calc(100% - 16px); padding: 7px 10px; }

  .panel { top: 54px; right: 8px; width: calc(100vw - 16px); }

  .toast { top: 56px; font-size: 13px; }
}

/* Small landscape phones / short viewports: keep scene from dominating. */
@media (max-height: 480px) {
  #hud { height: 42px; }
  #stage { top: 42px; bottom: 50px; }
  #bottombar { height: 50px; }
  #bottombar .btn { padding: 6px 8px; }
  .scene-desc { display: none; }
}

/* Touch devices: labels stay visible, targets get a tap highlight. */
@media (hover: none) {
  .hotspot { border: 2px solid rgba(224,180,92,.55); }
  .hotspot-label { opacity: 0.9; }
  .exit { border-width: 2px; }
  .btn, .inv-item { -webkit-tap-highlight-color: rgba(224,180,92,.3); }
}
