:root {
  --sand: #e8d2a6;
  --sand-dark: #c9ad76;
  --ink: #2b1d10;
  --gold: #e0a93a;
  --coffee: #3b2414;
  --bg: #1a120b;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background: radial-gradient(circle at 50% 20%, #2a1c10, var(--bg) 70%);
  background-attachment: fixed;
  color: var(--sand);
  font-family: 'Georgia', 'Times New Roman', serif;
  overflow-x: hidden;
}

#bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.mute-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 18, 11, 0.6);
  border: 1px solid rgba(224, 169, 58, 0.4);
  border-radius: 50%;
  color: var(--gold);
  cursor: pointer;
  padding: 0;
}

.mute-btn:hover {
  background: rgba(26, 18, 11, 0.85);
}

.mute-btn svg {
  width: 18px;
  height: 18px;
}

.bg-frieze {
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='16'%3E%3Cpath d='M4 16 L4 6 L12 6 L12 16 M8 6 L8 0' stroke='%23e0a93a' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
}

.bg-frieze-top { top: 0; }
.bg-frieze-bottom { bottom: 0; }

.bg-column {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  opacity: 0.16;
  background-image:
    linear-gradient(#e0a93a, #e0a93a),
    linear-gradient(#e0a93a, #e0a93a);
  background-repeat: no-repeat;
  background-size: 2px 100%, 2px 100%;
}

.bg-column-left {
  left: 18px;
  background-position: 0 0, 10px 0;
}

.bg-column-right {
  right: 18px;
  background-position: 0 0, 10px 0;
}

.bg-stars {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image:
    radial-gradient(1.2px 1.2px at 15% 8%, #e0a93a, transparent),
    radial-gradient(1px 1px at 85% 12%, #e0a93a, transparent),
    radial-gradient(1.3px 1.3px at 75% 20%, #e0a93a, transparent),
    radial-gradient(1px 1px at 92% 6%, #e0a93a, transparent),
    radial-gradient(0.9px 0.9px at 50% 4%, #e0a93a, transparent),
    radial-gradient(1px 1px at 25% 18%, #e0a93a, transparent),
    radial-gradient(1.1px 1.1px at 8% 22%, #e0a93a, transparent);
}

.bg-lamp {
  position: absolute;
  top: 0;
  width: 60px;
  height: 90px;
}

.bg-lamp-left { left: 24px; }
.bg-lamp-right { right: 24px; }

.bg-counter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  height: 90px;
  background: linear-gradient(180deg, #5a3a22, #2a1a0e);
  border-top: 3px solid rgba(224,169,58,0.5);
}

.bg-counter::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0, transparent 99px,
    rgba(0,0,0,0.3) 99px, rgba(0,0,0,0.3) 101px
  );
}

.screen {
  position: relative;
  z-index: 1;
  display: none;
  min-height: 100vh;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
  padding: 2rem 1rem 4rem;
  margin: 0 auto;
}

.screen.active {
  display: flex;
}

#screen-intro, #screen-howto, #screen-end {
  justify-content: center;
}

.intro-box {
  max-width: 480px;
  text-align: center;
  padding: 2rem;
}

h1 {
  font-size: clamp(1.5rem, 7.2vw, 2.4rem);
  letter-spacing: 0.04em;
  color: var(--gold);
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(224, 169, 58, 0.3);
}

.subtitle {
  color: var(--sand-dark);
  font-style: italic;
  margin: 0 0 1.5rem;
}

.blurb {
  line-height: 1.5;
  margin-bottom: 2rem;
  color: var(--sand);
}

.btn-primary, .btn-secondary {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.8rem 1.8rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  letter-spacing: 0.05em;
}

.btn-primary {
  background: var(--gold);
  color: var(--ink);
  font-weight: bold;
}

.btn-primary:hover {
  background: #f0bb4f;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  margin-top: 1.5rem;
}

.btn-secondary:hover {
  background: rgba(224, 169, 58, 0.1);
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.stage.hidden, .hidden {
  display: none;
}

#swirl-canvas {
  border-radius: 50%;
  box-shadow: 0 0 0 10px #4a3118, 0 0 40px rgba(0,0,0,0.6) inset, 0 10px 30px rgba(0,0,0,0.5);
  cursor: grab;
  touch-action: none;
}

#swirl-canvas:active {
  cursor: grabbing;
}

.swirl-hint {
  color: var(--sand-dark);
  font-style: italic;
  font-size: 0.95rem;
}

.swirl-timer-track {
  width: 260px;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.swirl-timer-fill {
  height: 100%;
  width: 100%;
  background: var(--gold);
  transform-origin: left;
  transition: transform 0.1s linear;
}

#btn-again.hidden {
  display: none;
}

/* ---- Game screen ---- */

#screen-game {
  width: 100%;
  max-width: 480px;
  gap: 1.2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.9rem;
  color: var(--sand-dark);
  border-bottom: 1px solid rgba(224,169,58,0.2);
  padding-bottom: 0.6rem;
}

.topbar .stat.gold {
  color: var(--gold);
  font-weight: bold;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: -2px;
}

.end-stats .stat-icon {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

.god-card {
  text-align: center;
}

.god-portrait {
  width: 84px;
  height: 84px;
  margin: 0 auto 0.3rem;
  color: var(--gold);
  filter: drop-shadow(0 0 10px rgba(224,169,58,0.3));
  position: relative;
}

.god-portrait::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(224,169,58,0.3);
  box-shadow: inset 0 0 0 4px rgba(224,169,58,0.08);
}

.god-portrait svg {
  width: 100%;
  height: 100%;
}

.god-name {
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.god-title {
  font-size: 0.85rem;
  color: var(--sand-dark);
  font-style: italic;
  margin-bottom: 0.6rem;
}

.speech-bubble {
  background: rgba(224,169,58,0.08);
  border: 1px solid rgba(224,169,58,0.25);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* ---- Manual + dialogue ---- */

.manual-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.manual-stage.hidden {
  display: none;
}

.manual-header {
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--sand-dark);
  text-transform: uppercase;
}

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

.symbol-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: transparent;
  border: 1px solid rgba(224,169,58,0.35);
  color: var(--sand-dark);
  border-radius: 8px;
  cursor: pointer;
  padding: 0.4rem;
}

.symbol-tile-icon {
  display: block;
  width: 100%;
  height: 100%;
}

.symbol-tile-icon svg {
  width: 100%;
  height: 100%;
}

.symbol-tile.active {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}

.manual-body {
  background: linear-gradient(160deg, #e9d4a8, #c9a872);
  border: 1px solid rgba(59,36,20,0.35);
  border-radius: 4px 12px 6px 14px;
  padding: 1rem 1.1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  min-height: 70px;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35), inset 0 0 24px rgba(59,36,20,0.18);
  position: relative;
}

.manual-body-hint {
  font-style: italic;
  color: #6a5133;
}

.manual-body .manual-body-title {
  color: #7a2e14;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.manual-body-icon {
  display: inline-block;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.manual-body-icon svg {
  width: 100%;
  height: 100%;
}

.dialogue-prompt {
  text-align: center;
  color: var(--sand-dark);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.dialogue-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dialogue-option {
  font-family: inherit;
  text-align: left;
  background: rgba(224,169,58,0.06);
  border: 1px solid rgba(224,169,58,0.3);
  color: var(--sand);
  padding: 0.7rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.4;
}

.dialogue-option:hover {
  background: rgba(224,169,58,0.15);
}

.dialogue-option:disabled {
  opacity: 0.4;
  cursor: default;
}

.reaction-box {
  background: rgba(224,169,58,0.08);
  border: 1px solid rgba(224,169,58,0.3);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.reaction-box.hidden {
  display: none;
}

.reaction-text {
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.reaction-accuracy {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  font-style: italic;
}

.reaction-accuracy.accurate {
  color: #8fb87a;
}

.reaction-accuracy.inaccurate {
  color: #c97a5a;
}

.reaction-outcome {
  margin: 0 0 1rem;
  font-weight: bold;
  color: var(--gold);
}

.end-stats {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.howto-list {
  text-align: left;
  line-height: 1.6;
  padding-left: 1.2rem;
  margin-bottom: 2rem;
}
