:root {
  --bg-abyss: #08050b;
  --panel-dark: rgba(18, 12, 23, 0.92);
  --panel-card: #191121;
  --parchment: #efe3cc;
  --parchment-dim: #bfae93;
  --crimson: #e02844;
  --crimson-bright: #ff3b58;
  --crimson-deep: #6b1120;
  --gold: #d9a756;
  --gold-soft: rgba(217, 167, 86, 0.32);
  --violet-uv: #9d4edd;
  --safe-green: #4cc98a;
  --font-display: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  --font-title: 'Cinzel', Georgia, serif;
  --font-body: 'Crimson Pro', Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-abyss);
  color: var(--parchment);
  font-family: var(--font-body);
  touch-action: none;
}

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

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #07040a;
}

.hidden {
  display: none !important;
}

.pointer-none {
  pointer-events: none !important;
}

/* ==================== HORROR OVERLAYS ==================== */
#horrorOverlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
}

#sanityVignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 48%, rgba(10, 3, 14, 0.65) 85%, rgba(5, 1, 8, 0.95) 100%);
  transition: opacity 0.4s ease;
  opacity: 0.4;
}

#huntVignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 40%, rgba(165, 12, 35, 0.42) 82%, rgba(95, 4, 18, 0.85) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

#huntVignette.hunting {
  animation: huntPulse 0.65s infinite alternate ease-in-out;
}

@keyframes huntPulse {
  0% { opacity: 0.35; }
  100% { opacity: 0.88; }
}

/* Closet Hiding Wooden Slats Effect */
#hidingSlats {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  background: radial-gradient(circle at center, rgba(0,0,0,0.2) 25%, rgba(0,0,0,0.92) 80%);
}

#hidingSlats .slat {
  width: 100%;
  height: 13vh;
  background: linear-gradient(180deg, #09050c 0%, #140b16 50%, #070409 100%);
  border-top: 2px solid #261626;
  border-bottom: 2px solid #261626;
  box-shadow: 0 10px 28px rgba(0,0,0,0.95);
}

.hiding-badge {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 9, 19, 0.92);
  border: 1.5px solid var(--gold);
  color: var(--parchment);
  font-family: var(--font-title);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  padding: 6px 16px;
  border-radius: 999px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(0,0,0,0.8);
  white-space: nowrap;
}

/* ==================== SCREENS (MENU & RESULT) ==================== */
.screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at center, rgba(16, 9, 22, 0.62) 0%, rgba(7, 4, 10, 0.92) 100%);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}

.menu-card, .result-card {
  width: 100%;
  max-width: 560px;
  background: linear-gradient(180deg, rgba(26, 16, 33, 0.96) 0%, rgba(14, 9, 19, 0.98) 100%);
  border: 2px solid var(--gold);
  outline: 4px solid rgba(11, 7, 15, 0.9);
  box-shadow: 0 0 0 6px var(--crimson-deep), 0 24px 60px rgba(0, 0, 0, 0.9);
  border-radius: 14px;
  padding: 24px 26px;
  text-align: center;
  position: relative;
}

.cult-emblem {
  width: 96px;
  height: 96px;
  margin: 0 auto 8px;
  filter: drop-shadow(0 0 14px rgba(224, 40, 68, 0.45));
  animation: floatCrest 3.6s ease-in-out infinite;
}

@keyframes floatCrest {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.lamb-crest {
  width: 100%;
  height: 100%;
}

.subtitle-eyebrow {
  font-family: var(--font-title);
  font-size: 0.74rem;
  letter-spacing: 0.28em;
  color: var(--crimson-bright);
  margin-bottom: 4px;
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4.8vw, 2.5rem);
  color: var(--parchment);
  text-shadow: 0 2px 0 #4d0c18, 0 0 22px rgba(224, 40, 68, 0.55);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.game-tagline {
  font-size: 1.05rem;
  line-height: 1.42;
  color: var(--parchment-dim);
  margin-bottom: 18px;
}

.game-tagline strong {
  color: var(--parchment);
}

.difficulty-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.diff-btn {
  background: rgba(12, 8, 16, 0.85);
  border: 1.5px solid rgba(217, 167, 86, 0.28);
  border-radius: 9px;
  padding: 9px 6px;
  color: var(--parchment-dim);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.diff-btn:hover {
  border-color: var(--gold);
  color: var(--parchment);
}

.diff-btn.selected {
  background: linear-gradient(180deg, rgba(112, 18, 35, 0.58), rgba(45, 10, 20, 0.85));
  border-color: var(--crimson-bright);
  color: var(--parchment);
  box-shadow: 0 0 14px rgba(224, 40, 68, 0.35);
}

.diff-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.88rem;
}

.diff-desc {
  font-size: 0.76rem;
  opacity: 0.85;
  line-height: 1.15;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(180deg, #d6243f 0%, #8f1125 100%);
  color: #fff7eb;
  border: 1.5px solid #ff758a;
  border-radius: 10px;
  padding: 13px 20px;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.09em;
  cursor: pointer;
  box-shadow: 0 5px 0 #4a0712, 0 8px 24px rgba(224, 40, 68, 0.45);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #4a0712;
}

.btn-secondary {
  background: rgba(29, 19, 38, 0.9);
  color: var(--parchment);
  border: 1.5px solid var(--gold-soft);
  border-radius: 10px;
  padding: 10px 16px;
  font-family: var(--font-title);
  font-size: 0.84rem;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--gold);
  background: rgba(46, 30, 60, 0.95);
}

.small-btn {
  padding: 8px 14px;
  font-size: 0.8rem;
}

.platform-hint {
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid rgba(217, 167, 86, 0.18);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--parchment-dim);
}

/* ==================== MODALS & GRIMÓRIO ==================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(5, 3, 8, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-box, .grimoire-book {
  width: 100%;
  max-width: 820px;
  max-height: 92dvh;
  background: linear-gradient(180deg, #1d1324 0%, #120b17 100%);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 4px #3c121e, 0 24px 60px rgba(0, 0, 0, 0.95);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header, .grimoire-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(10, 6, 14, 0.75);
  border-bottom: 1.5px solid rgba(217, 167, 86, 0.3);
}

.modal-header h2, .grimoire-header h2 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--parchment);
  letter-spacing: 0.06em;
}

.grimoire-kicker {
  font-family: var(--font-title);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--crimson-bright);
  display: block;
}

.icon-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(217, 167, 86, 0.35);
  color: var(--parchment);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
}

.icon-close:hover {
  background: var(--crimson-deep);
  border-color: var(--crimson-bright);
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  touch-action: pan-y;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.guide-card {
  background: rgba(11, 7, 15, 0.7);
  border: 1px solid rgba(217, 167, 86, 0.25);
  border-radius: 10px;
  padding: 13px 15px;
}

.guide-card.danger-card {
  border-color: rgba(224, 40, 68, 0.55);
  background: rgba(65, 10, 22, 0.32);
}

.guide-card h3 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--gold);
  margin-bottom: 6px;
}

.guide-card.danger-card h3 {
  color: var(--crimson-bright);
}

.guide-card p, .guide-card li {
  font-size: 0.94rem;
  line-height: 1.38;
  color: var(--parchment-dim);
}

.guide-card ul {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-footer, .grimoire-footer {
  padding: 12px 20px;
  background: rgba(10, 6, 14, 0.85);
  border-top: 1px solid rgba(217, 167, 86, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Grimoire Split Layout */
.grimoire-content {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 16px;
  padding: 16px 20px;
  overflow-y: auto;
  touch-action: pan-y;
}

.grimoire-page h3 {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 4px;
}

.page-hint {
  font-size: 0.86rem;
  color: var(--parchment-dim);
  margin-bottom: 10px;
}

.evidence-checklist {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.ev-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(10, 6, 14, 0.72);
  border: 1.5px solid rgba(217, 167, 86, 0.24);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ev-item:hover {
  border-color: var(--gold);
}

.ev-item.state-yes {
  border-color: var(--crimson-bright);
  background: rgba(112, 16, 34, 0.38);
}

.ev-item.state-no {
  opacity: 0.52;
  text-decoration: line-through;
}

.ev-box {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--font-title);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.ev-item.state-yes .ev-box {
  background: var(--crimson);
  border-color: #ff8597;
  color: #fff;
}

.ev-text-wrap {
  display: flex;
  flex-direction: column;
}

.ev-title {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--parchment);
}

.ev-desc {
  font-size: 0.8rem;
  color: var(--parchment-dim);
}

.objectives-box {
  background: rgba(10, 6, 14, 0.58);
  border: 1px dashed rgba(217, 167, 86, 0.35);
  border-radius: 9px;
  padding: 10px 12px;
}

.objectives-box h4 {
  font-family: var(--font-title);
  font-size: 0.83rem;
  color: var(--gold);
  margin-bottom: 6px;
}

.obj-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.88rem;
  color: var(--parchment-dim);
}

.obj-list li.done {
  color: var(--safe-green);
}

.entity-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entity-card {
  background: rgba(10, 6, 14, 0.78);
  border: 1.5px solid rgba(217, 167, 86, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.entity-card:hover {
  border-color: var(--gold);
}

.entity-card.ruled-out {
  opacity: 0.28;
  filter: grayscale(0.8);
}

.entity-card.selected-suspect {
  border: 2px solid var(--crimson-bright);
  background: linear-gradient(90deg, rgba(125, 17, 36, 0.5), rgba(22, 12, 28, 0.9));
  box-shadow: 0 0 16px rgba(224, 40, 68, 0.4);
}

.entity-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.entity-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--parchment);
}

.entity-circle-tag {
  font-family: var(--font-title);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--crimson);
  color: #fff;
}

.entity-lore {
  font-size: 0.84rem;
  color: var(--parchment-dim);
  line-height: 1.28;
  margin-bottom: 6px;
}

.entity-ev-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ev-pill {
  font-size: 0.73rem;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(217, 167, 86, 0.22);
  color: var(--parchment-dim);
}

.ev-pill.matched {
  background: rgba(224, 40, 68, 0.3);
  border-color: var(--crimson-bright);
  color: #fff;
}

.grimoire-footer-btns {
  display: flex;
  gap: 8px;
}

/* ==================== IN-GAME HUD ==================== */
#hudLayer {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.hud-top {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hud-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.sanity-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel-dark);
  border: 1.5px solid var(--gold-soft);
  border-radius: 11px;
  padding: 6px 11px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.65);
}

.sanity-eye {
  width: 28px;
  height: 20px;
  border-radius: 50%;
  background: #f2e5ce;
  border: 2.5px solid #160c1c;
  box-shadow: 0 0 0 1.5px var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.sanity-pupil {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1a0d22;
  border: 2px solid var(--crimson);
  transition: transform 0.2s ease, background-color 0.3s ease;
}

.sanity-info {
  display: flex;
  flex-direction: column;
  min-width: 92px;
}

.stat-label {
  font-family: var(--font-title);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--parchment-dim);
}

.stat-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
  margin: 2px 0;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #c9243f, #e8b45a);
  transition: width 0.25s ease;
}

.stat-num {
  font-family: var(--font-title);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--parchment);
}

.room-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--panel-dark);
  border: 1.5px solid rgba(217, 167, 86, 0.28);
  border-radius: 999px;
  padding: 6px 13px;
  font-family: var(--font-title);
  font-size: 0.8rem;
  color: var(--parchment);
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}

.room-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--safe-green);
  box-shadow: 0 0 8px var(--safe-green);
}

.room-dot.danger {
  background: var(--crimson-bright);
  box-shadow: 0 0 8px var(--crimson-bright);
}

.stamina-mini {
  width: 68px;
  height: 5px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 99px;
  overflow: hidden;
}

.stamina-fill {
  height: 100%;
  background: #edd9a3;
  transition: width 0.1s linear;
}

.hud-actions-top {
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: auto;
}

.hud-top-btn {
  background: var(--panel-dark);
  border: 1.5px solid var(--gold-soft);
  color: var(--parchment);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: var(--font-title);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 14px rgba(0,0,0,0.65);
}

.hud-top-btn:hover {
  border-color: var(--gold);
}

.hud-top-btn.icon-only {
  padding: 8px 10px;
}

.suspect-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--crimson-bright);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.btn-finish-ritual {
  background: linear-gradient(180deg, #e02844 0%, #8c1124 100%);
  border: 1.5px solid #ff94a4;
  color: #fff;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(224, 40, 68, 0.7);
  animation: pulseSeal 1.4s infinite alternate;
}

@keyframes pulseSeal {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

/* Active Tool Live Readout Widget */
.tool-readout {
  position: absolute;
  top: 68px;
  left: max(12px, env(safe-area-inset-left));
  width: 210px;
  background: var(--panel-dark);
  border: 1.5px solid rgba(217, 167, 86, 0.34);
  border-radius: 11px;
  padding: 9px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.7);
  pointer-events: auto;
}

.readout-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
}

#activeToolName {
  font-family: var(--font-title);
  font-size: 0.84rem;
  color: var(--gold);
  font-weight: 700;
}

.readout-sub {
  font-size: 0.75rem;
  color: var(--parchment-dim);
}

.emf-leds {
  display: flex;
  gap: 6px;
  align-items: center;
}

.emf-led {
  flex: 1;
  height: 14px;
  border-radius: 4px;
  background: #221929;
  border: 1px solid rgba(255,255,255,0.12);
  transition: all 0.08s ease;
}

.emf-led.on-1 { background: #4cc98a; box-shadow: 0 0 8px #4cc98a; }
.emf-led.on-2 { background: #9be564; box-shadow: 0 0 8px #9be564; }
.emf-led.on-3 { background: #f4d35e; box-shadow: 0 0 8px #f4d35e; }
.emf-led.on-4 { background: #f77f00; box-shadow: 0 0 10px #f77f00; }
.emf-led.on-5 { background: #ff1e42; box-shadow: 0 0 14px #ff1e42; }

.thermo-readout {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--parchment);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.thermo-readout.cold { color: #8ad8ff; }
.thermo-readout.freezing {
  color: #48cae4;
  text-shadow: 0 0 12px rgba(72, 202, 228, 0.75);
}

.thermo-tag {
  font-size: 0.74rem;
  font-weight: 600;
  opacity: 0.9;
}

.box-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.box-freq {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: #e0aaff;
}

.box-ask-btn {
  background: rgba(157, 78, 221, 0.25);
  border: 1px solid #c77dff;
  color: #f3d5ff;
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--font-title);
  font-size: 0.72rem;
  cursor: pointer;
}

.box-ask-btn:hover {
  background: rgba(157, 78, 221, 0.45);
}

/* Floating Toasts & Whispers */
.toast-container {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 90%;
  max-width: 440px;
  z-index: 20;
}

.event-toast {
  background: rgba(14, 8, 19, 0.92);
  border: 1.5px solid var(--gold-soft);
  color: var(--parchment);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.92rem;
  text-align: center;
  box-shadow: 0 8px 25px rgba(0,0,0,0.85);
  animation: toastIn 0.25s ease-out;
}

.event-toast.whisper-toast {
  border-color: var(--crimson-bright);
  color: #ffb3c0;
  font-family: var(--font-title);
  letter-spacing: 0.12em;
  font-size: 1rem;
  text-shadow: 0 0 10px var(--crimson);
}

.event-toast.danger-toast {
  background: rgba(88, 9, 22, 0.94);
  border-color: #ff4d67;
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Desktop Interact Prompt */
.interact-prompt {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 9, 20, 0.92);
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  padding: 6px 15px;
  font-size: 0.9rem;
  color: var(--parchment);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.8);
}

.interact-prompt kbd {
  background: var(--gold);
  color: #120b17;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 2px 7px;
  border-radius: 5px;
}

/* Bottom Hotbar */
.hud-bottom {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(13, 8, 18, 0.92);
  border: 1.5px solid rgba(217, 167, 86, 0.35);
  border-radius: 14px;
  padding: 6px 8px;
  pointer-events: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.85);
  z-index: 18;
}

.hotbar-divider {
  width: 1px;
  height: 38px;
  background: rgba(217, 167, 86, 0.25);
  margin: 0 2px;
}

.tool-slots {
  display: flex;
  gap: 5px;
}

.hotbar-slot {
  position: relative;
  width: 62px;
  height: 58px;
  background: rgba(26, 17, 34, 0.85);
  border: 1.5px solid rgba(217, 167, 86, 0.22);
  border-radius: 10px;
  color: var(--parchment-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.hotbar-slot:hover {
  border-color: var(--gold);
}

.hotbar-slot.selected {
  background: linear-gradient(180deg, rgba(112, 18, 35, 0.65), rgba(34, 14, 29, 0.95));
  border-color: var(--crimson-bright);
  color: var(--parchment);
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(224, 40, 68, 0.38);
}

.lantern-slot.active {
  border-color: #f6bd60;
  color: #fff3d6;
  background: linear-gradient(180deg, rgba(120, 78, 18, 0.55), rgba(28, 19, 14, 0.92));
}

.lantern-state-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #55485d;
}

.lantern-slot.active .lantern-state-dot {
  background: #ffca64;
  box-shadow: 0 0 7px #ffca64;
}

.slot-key {
  position: absolute;
  top: 3px;
  left: 5px;
  font-family: var(--font-title);
  font-size: 0.62rem;
  opacity: 0.65;
}

.slot-ico {
  font-size: 1.15rem;
  line-height: 1;
}

.slot-name {
  font-family: var(--font-title);
  font-size: 0.62rem;
  font-weight: 700;
}

.slot-mini {
  font-size: 0.6rem;
  color: var(--gold);
  font-weight: 700;
}

/* ==================== TOUCH CONTROLS (MOBILE / TABLET) ==================== */
#touchControlsLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 16;
  display: none;
}

/* Show touch layer on touch-capable devices or narrow viewports */
body.touch-enabled #touchControlsLayer {
  display: block;
}

body.touch-enabled .slot-key,
body.touch-enabled #desktopInteractPrompt {
  display: none !important;
}

.joystick-zone {
  position: absolute;
  top: 70px;
  bottom: 82px;
  pointer-events: auto;
  touch-action: none;
}

.left-zone {
  left: 0;
  width: 48%;
}

.right-zone {
  right: 0;
  width: 52%;
}

.joy-base {
  position: absolute;
  width: 108px;
  height: 108px;
  margin-left: -54px;
  margin-top: -54px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 167, 86, 0.14) 0%, rgba(14, 8, 20, 0.45) 100%);
  border: 2px solid rgba(217, 167, 86, 0.45);
  pointer-events: none;
}

.joy-base.aim-base {
  border-color: rgba(224, 40, 68, 0.52);
}

.joy-stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  margin-top: -23px;
  border-radius: 50%;
  background: radial-gradient(circle, #f3dec0 0%, #b88746 100%);
  box-shadow: 0 4px 12px rgba(0,0,0,0.65);
}

.joy-stick.aim-stick {
  background: radial-gradient(circle, #ff7a8e 0%, #b81d35 100%);
}

.touch-action-cluster {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 78px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
  z-index: 19;
}

.touch-circle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(20, 12, 28, 0.88);
  border: 2px solid var(--gold);
  color: var(--parchment);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.75);
  touch-action: none;
}

.touch-circle-btn.action-btn {
  width: 68px;
  height: 68px;
  border-color: #ffca64;
  background: linear-gradient(180deg, rgba(130, 80, 20, 0.85), rgba(32, 18, 22, 0.92));
}

.touch-circle-btn.action-btn.disabled {
  opacity: 0.35;
  border-color: rgba(255,255,255,0.2);
  background: rgba(15, 10, 20, 0.65);
}

.touch-circle-btn.tool-use-btn {
  border-color: #c77dff;
  background: linear-gradient(180deg, rgba(96, 36, 148, 0.85), rgba(26, 14, 38, 0.92));
}

.touch-circle-btn:active, .touch-circle-btn.pressed {
  transform: scale(0.93);
  filter: brightness(1.2);
}

.t-ico {
  font-size: 1.2rem;
  line-height: 1;
}

.t-lbl {
  font-family: var(--font-title);
  font-size: 0.58rem;
  font-weight: 700;
}

/* ==================== RESULT SCREEN ==================== */
.result-stamp {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 99px;
  font-family: var(--font-title);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  margin-bottom: 8px;
}

.result-stamp.dead-stamp {
  border-color: var(--crimson-bright);
  color: var(--crimson-bright);
}

#resultTitle {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.result-desc {
  color: var(--parchment-dim);
  font-size: 1rem;
  margin-bottom: 16px;
}

.result-reveal-box {
  background: rgba(9, 5, 13, 0.78);
  border: 1px solid rgba(217, 167, 86, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.reveal-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  padding-bottom: 5px;
}

.reveal-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.crimson-text {
  color: var(--crimson-bright);
  font-family: var(--font-title);
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */
@media (max-width: 740px) {
  .guide-grid,
  .grimoire-content {
    grid-template-columns: 1fr;
  }

  .menu-card, .result-card {
    padding: 18px 16px;
  }

  .difficulty-selector {
    grid-template-columns: 1fr;
  }

  .diff-btn {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
  }

  .btn-txt {
    display: none;
  }

  .sanity-info {
    min-width: 72px;
  }

  .stamina-mini {
    display: none;
  }

  .tool-readout {
    top: 60px;
    width: 176px;
    padding: 7px 10px;
  }

  .hotbar-slot {
    width: 50px;
    height: 52px;
  }

  .slot-name {
    font-size: 0.54rem;
  }
}

@media (max-height: 480px) {
  /* Compact Mobile Landscape Mode */
  .tool-readout {
    top: 54px;
    width: 168px;
    padding: 6px 9px;
  }
  .hotbar-slot {
    width: 48px;
    height: 46px;
  }
  .slot-mini {
    display: none;
  }
  .touch-action-cluster {
    bottom: 62px;
    flex-direction: row;
    gap: 8px;
  }
  .touch-circle-btn {
    width: 52px;
    height: 52px;
  }
  .touch-circle-btn.action-btn {
    width: 58px;
    height: 58px;
  }
}
