/* =================================================================
   The Quiet Hour — styles.css
   A calm, modern study escape room.
   Palette: muted sage walls, warm oak, cream paper, soft ink.
   ================================================================= */

:root {
  --wall: #cdded7;
  --wall-2: #bdd2ca;
  --oak: #c39a63;
  --oak-dark: #9c7544;
  --cream: #f4efe2;
  --paper: #faf6ea;
  --ink: #36433d;
  --ink-soft: #5d6b63;
  --accent: #c98a5e;     /* warm amber accent */
  --accent-2: #6a9b8a;   /* muted teal */
  --gold: #cdb15e;
  --danger: #c2614f;
  --ok: #5f9e74;
  --shadow: rgba(40, 55, 50, 0.22);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* The [hidden] attribute must always win over the display rules below. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 50% -10%, #e9efe8, #d6e0da 55%, #c7d4cc 100%);
}

button { font-family: inherit; }

/* ---------- Screens ---------- */
.screen { min-height: 100%; }

#title-screen, .win-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
}

.title-card, .win-card {
  background: linear-gradient(180deg, #fbf8f0, #f1ece0);
  border: 1px solid #e0d8c4;
  border-radius: 22px;
  box-shadow: 0 24px 60px var(--shadow);
  max-width: 560px;
  width: 100%;
  padding: 40px 38px 30px;
  text-align: center;
}

.title-emblem { margin-bottom: 6px; }

.title-card h1, .win-card h1 {
  font-size: 2.5rem;
  margin: 8px 0 6px;
  letter-spacing: 0.5px;
  color: var(--ink);
  font-weight: 600;
}

.subtitle {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 1.05rem;
  font-style: italic;
}

.blurb, .win-blurb {
  color: var(--ink-soft);
  line-height: 1.6;
  font-size: 1rem;
  margin: 0 auto 26px;
  max-width: 460px;
}

.title-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.title-foot {
  color: #8a9690;
  font-size: 0.82rem;
  margin: 6px 0 0;
}

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid #d8cdb4;
  background: #fbf7ec;
  color: var(--ink);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: 0 3px 0 #e3d9c2;
}
.btn:hover { background: #fffdf6; transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #e3d9c2; }
.btn:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(180deg, #d89a6a, #c98a5e);
  border-color: #b97c4f;
  color: #fff;
  box-shadow: 0 3px 0 #a96e44;
}
.btn-primary:hover { background: linear-gradient(180deg, #e0a173, #cf9163); }

.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: rgba(255,255,255,0.5); }

/* ---------- Game shell ---------- */
#game {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px clamp(8px, 2vw, 18px) 18px;
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 4px 12px;
}
.topbar-left, .topbar-right { flex: 1; display: flex; align-items: center; gap: 10px; }
.topbar-right { justify-content: flex-end; }
.topbar-center { display: flex; align-items: center; gap: 10px; }

.wall-name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--ink);
}
.compass {
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.55);
  border: 1px solid #d7e0d8;
  border-radius: 20px;
  padding: 3px 10px;
  letter-spacing: 2px;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.55);
  border: 1px solid #d7e0d8;
  border-radius: 20px;
  padding: 4px 12px;
}

.icon-btn {
  border: 1px solid #d7e0d8;
  background: rgba(255,255,255,0.7);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.15s ease, transform 0.08s ease;
}
.icon-btn:hover { background: #fff; transform: translateY(-1px); }
.icon-btn:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

/* ---------- Stage ---------- */
#stage-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#stage {
  position: relative;
  width: 100%;
  max-width: 1000px;
  aspect-ratio: 1000 / 640;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 50px var(--shadow), inset 0 0 0 1px rgba(255,255,255,0.4);
  background: var(--wall);
}

#scene, #scene svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#hotspots { position: absolute; inset: 0; }

/* Hotspot buttons sit transparently over the art; subtle hover reveal */
.hotspot {
  position: absolute;
  border: 2px solid transparent;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
}
.hotspot:hover,
.hotspot:focus-visible {
  background: rgba(255, 248, 225, 0.16);
  border-color: rgba(255, 245, 210, 0.85);
  box-shadow: 0 0 18px rgba(255, 240, 200, 0.45);
  outline: none;
}
.hotspot.solved-spot:hover { border-color: rgba(150, 220, 170, 0.85); }
/* a gentle pulsing dot to hint interactivity without spelling out the target */
.hotspot .dot {
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.0);
  transition: background 0.2s ease;
}
.hotspot:hover .dot { background: rgba(255,255,255,0.0); }

/* When an item is "armed" for use, hotspots glow to invite a target */
#stage.using .hotspot {
  background: rgba(120, 200, 180, 0.10);
  border-color: rgba(120, 200, 180, 0.30);
}
#stage.using .hotspot:hover {
  background: rgba(120, 220, 190, 0.26);
  border-color: rgba(120, 220, 190, 0.9);
}
#stage.using { cursor: crosshair; }

/* ---------- Nav arrows ---------- */
.nav-arrow {
  flex: 0 0 auto;
  width: 52px;
  height: 84px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.65);
  color: var(--ink);
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--shadow);
  transition: background 0.15s ease, transform 0.08s ease;
}
.nav-arrow:hover { background: #fff; transform: translateY(-1px); }
.nav-arrow:active { transform: translateY(1px); }
.nav-arrow:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

/* ---------- Status line ---------- */
.status {
  min-height: 24px;
  text-align: center;
  margin: 12px auto 6px;
  color: var(--ink);
  font-size: 0.98rem;
  background: rgba(255,255,255,0.55);
  border-radius: 20px;
  padding: 6px 16px;
  max-width: 760px;
  transition: opacity 0.2s ease;
}
.status.flash { animation: flash 0.5s ease; }
.status.good { color: #2f6b46; }
.status.bad { color: #9a3b2b; }
@keyframes flash {
  0% { background: rgba(255, 244, 210, 0.95); }
  100% { background: rgba(255,255,255,0.55); }
}

/* ---------- Inventory ---------- */
#inventory-bar {
  margin-top: 14px;
  background: linear-gradient(180deg, #fbf8f0, #f0ebdd);
  border: 1px solid #e3dac6;
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.inv-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #9a8f78;
  flex: 0 0 auto;
}
.inventory {
  list-style: none;
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 56px;
  align-items: center;
  flex-wrap: wrap;
}
.inv-item {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid #ddd2bb;
  background: #fffdf6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 2px 6px rgba(60,70,60,0.12);
}
.inv-item:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(60,70,60,0.18); }
.inv-item:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.inv-item.selected {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(106, 155, 138, 0.4), 0 6px 14px rgba(60,70,60,0.18);
  background: #f1fbf6;
}
.inv-item svg { width: 38px; height: 38px; pointer-events: none; }
.inv-item .inspect-btn {
  position: absolute;
  top: -8px; right: -8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid #d8cdb4;
  background: #fff;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.inv-item:hover .inspect-btn, .inv-item:focus-within .inspect-btn { display: flex; }
.inv-empty { color: #b3aa95; font-style: italic; font-size: 0.9rem; }

.holding {
  flex: 0 0 auto;
  min-width: 120px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--accent-2);
}
.holding strong { color: var(--ink); }

/* ---------- Modal ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 40, 36, 0.55);
  backdrop-filter: blur(2px);
}
.modal {
  position: relative;
  background: linear-gradient(180deg, #fbf8f0, #f2ecde);
  border: 1px solid #e2d9c4;
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(20,30,26,0.5);
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  padding: 26px 26px 24px;
  animation: pop 0.16s ease;
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-wide { max-width: 640px; }
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid #ddd2bb;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.modal-close:hover { background: #f4efe2; }
.modal-close:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.modal-title { margin: 0 30px 14px 0; font-size: 1.45rem; font-weight: 600; }
.modal-body { color: var(--ink); line-height: 1.6; }
.modal-body p { margin: 0 0 12px; }
.modal-note {
  background: #fffdf4;
  border: 1px dashed #d8c9a3;
  border-radius: 10px;
  padding: 14px 16px;
  color: #4a463a;
  font-style: italic;
}
.modal-figure { display: flex; justify-content: center; margin: 6px 0 16px; }
.modal-figure svg { max-width: 100%; height: auto; border-radius: 10px; }

/* ---------- Lock / puzzle controls ---------- */
.lock-display {
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  letter-spacing: 12px;
  text-align: center;
  background: #2c3833;
  color: #f4efe2;
  border-radius: 10px;
  padding: 12px 8px 12px 20px;
  margin: 8px 0 16px;
  min-height: 30px;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 280px;
  margin: 0 auto 12px;
}
.keypad button {
  padding: 16px 0;
  font-size: 1.3rem;
  border-radius: 10px;
  border: 1px solid #d8cdb4;
  background: #fbf7ec;
  cursor: pointer;
}
.keypad button:hover { background: #fff; }
.keypad button:active { transform: translateY(1px); }
.keypad button:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.keypad .wide { grid-column: span 1; }

.lock-actions { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }

/* color sequence lock */
.color-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.swatch {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.7);
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.18);
  transition: transform 0.08s ease;
}
.swatch:hover { transform: translateY(-2px) scale(1.04); }
.swatch:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.seq-slots { display: flex; gap: 10px; justify-content: center; margin: 8px 0 16px; }
.seq-slot {
  width: 46px; height: 46px; border-radius: 10px;
  border: 2px dashed #c2b793; background: #fffdf4;
}
.seq-slot.filled { border-style: solid; }

/* symbol wheels (puzzle box) */
.wheels { display: flex; gap: 14px; justify-content: center; margin: 16px 0; }
.wheel { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wheel-face {
  width: 64px; height: 64px; border-radius: 12px;
  background: #2c3833; display: flex; align-items: center; justify-content: center;
  border: 1px solid #1f2823;
}
.wheel-face svg { width: 40px; height: 40px; }
.wheel button {
  width: 30px; height: 26px; border-radius: 7px;
  border: 1px solid #d8cdb4; background: #fbf7ec; cursor: pointer; font-size: 0.9rem;
}
.wheel button:hover { background: #fff; }

/* bookshelf reorder */
.book-slots { display: flex; gap: 10px; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
.book-slot {
  width: 58px; height: 120px; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 10px 0; cursor: pointer; color: #fff; position: relative;
  box-shadow: inset -6px 0 10px rgba(0,0,0,0.18), 0 4px 10px rgba(0,0,0,0.2);
  border: 1px solid rgba(0,0,0,0.15);
  transition: transform 0.1s ease, outline 0.1s ease;
  font-size: 0.7rem; letter-spacing: 1px;
}
.book-slot:hover { transform: translateY(-3px); }
.book-slot.picked { outline: 3px solid #fff; outline-offset: 2px; transform: translateY(-6px); }
.book-slot .book-icon { font-size: 1.3rem; }
.book-slot .book-season { writing-mode: vertical-rl; text-orientation: mixed; opacity: 0.9; }

/* combine modal */
.combine-row { display:flex; gap:12px; align-items:center; justify-content:center; margin:14px 0; flex-wrap: wrap; }
.combine-chip {
  border:1px solid #d8cdb4; background:#fffdf6; border-radius:10px; padding:8px 12px;
  display:flex; align-items:center; gap:8px; cursor:pointer;
}
.combine-chip svg { width: 28px; height: 28px; }
.combine-chip.selected { border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(106,155,138,0.4); }

/* menu list */
.menu-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 10px; }
.menu-list button { width: 100%; text-align: left; }

.win-time { font-size: 1.3rem; color: var(--accent); margin: 4px 0 18px; font-weight: 600; }
.win-emblem { font-size: 3rem; margin-bottom: 6px; }

.hint-tier { margin: 10px 0; }
.hint-tier .hint-q { font-weight: 600; color: var(--accent-2); margin-bottom: 4px; }
.kbd {
  display:inline-block; padding:1px 7px; border:1px solid #cfc6ae; border-bottom-width:2px;
  border-radius:6px; background:#fbf7ec; font-size:0.85rem; font-family:inherit;
}

.howto-grid { display:grid; grid-template-columns: 28px 1fr; gap:8px 12px; align-items:start; }
.howto-grid .ic { font-size:1.1rem; text-align:center; }

/* small helper text */
.muted { color: var(--ink-soft); font-size: 0.9rem; }
.center { text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .btn-text { display: none; }
  .title-card h1, .win-card h1 { font-size: 2rem; }
  .nav-arrow { width: 40px; height: 64px; font-size: 1.7rem; }
  .inv-label { display: none; }
  .holding { min-width: 0; }
  #game { padding: 6px 6px 12px; }
  .topbar-center .compass { display: none; }
}
@media (max-width: 460px) {
  .inv-item { width: 46px; height: 46px; }
  .inv-item svg { width: 30px; height: 30px; }
  .lock-display { font-size: 1.5rem; letter-spacing: 8px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
