/* ================================================================
   RUNEFALLS — Style Sheet
   Dark mystical ancient Egyptian temple theme
   ================================================================ */

@font-face {
  font-family: 'Aztecs Icons';
  src: url('aztecs_icons/aztecs_icons/Aztecs Icons.otf') format('opentype');
  font-weight: normal;
  font-style:  normal;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:       #FFD93D;
  --gold-dim:   #c9a820;
  --gold-hot:   #FFE87A;
  --teal:       #00CED1;
  --purple:     #6600AA;
  --bg:         #100c08;
  --card-bg:    rgba(14, 9, 4, 0.93);
  --card-border: rgba(180, 130, 50, 0.40);
  --text:       #e8d9a0;
  --text-dim:   #8a7a50;
  --red:        #ff4466;
  --sand:       #C9A870;
  --font-title: 'Cinzel Decorative', 'Cinzel', serif;
  --font-ui:    'Cinzel', serif;
  --font-rune:  'Noto Sans Egyptian Hieroglyphs', 'Segoe UI Historic', serif;
  --font-aztec: 'Aztecs Icons', serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #04060c;
  font-family: var(--font-ui);
  color: var(--text);
  user-select: none;
}

/* ── Canvas ── */
#game-canvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ================================================================
   HUD
   ================================================================ */
#hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
}

.hud-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ── Carved shrine — compact centered slab at top ── */
#target-panel {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 210px;
  max-width: 360px;
  text-align: center;
  padding: 10px 44px 8px;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.0) 40%),
    radial-gradient(ellipse at 30% 0%, rgba(255,140,40,0.14) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 0%, rgba(255,140,40,0.14) 0%, transparent 55%),
    linear-gradient(135deg, #2e1e08 0%, #1e1208 45%, #28180a 70%, #2e1e08 100%);
  border-bottom: 2px solid rgba(40,20,5,0.6);
  border-left:   2px solid rgba(40,20,5,0.5);
  border-right:  2px solid rgba(40,20,5,0.5);
  border-radius: 0 0 14px 14px;
  box-shadow:
    inset 0  2px 0   rgba(255,200,100,0.12),
    inset 0 -1px 0   rgba(0,0,0,0.6),
    inset 4px 0 12px rgba(255,120,30,0.08),
    inset -4px 0 12px rgba(255,120,30,0.08),
    0 6px 28px rgba(200,100,20,0.22),
    0 0  60px rgba(200,100,20,0.10);
  white-space: nowrap;
}

/* Torch glow from sides */
#target-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; width: 80px;
  background: radial-gradient(ellipse at 0% 60%, rgba(255,100,20,0.22) 0%, transparent 70%);
  pointer-events: none;
}
#target-panel::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; width: 80px;
  background: radial-gradient(ellipse at 100% 60%, rgba(255,100,20,0.22) 0%, transparent 70%);
  pointer-events: none;
}

/* Carved stone label */
.hud-label.shrine-label {
  font-size: 7px;
  letter-spacing: 4px;
  color: rgba(180,140,60,0.65);
  margin-bottom: 1px;
}

/* Sacred hieroglyphs */
#target-display {
  font-family: var(--font-rune);
  font-size: 38px;
  letter-spacing: 12px;
  color: #FFE87A;
  text-shadow:
    0 0 10px rgba(255,235,100,0.95),
    0 0 25px rgba(255,200,60,0.70),
    0 0 55px rgba(255,155,20,0.40),
    0 0 90px rgba(255,120,0,0.20);
  line-height: 1.1;
  min-height: 44px;
  animation: glyph-breathe 3.5s ease-in-out infinite;
}

@keyframes glyph-breathe {
  0%, 100% { text-shadow:
    0 0 10px rgba(255,235,100,0.95),
    0 0 25px rgba(255,200,60,0.70),
    0 0 55px rgba(255,155,20,0.40),
    0 0 90px rgba(255,120,0,0.20); }
  50% { text-shadow:
    0 0 14px rgba(255,245,120,1.0),
    0 0 35px rgba(255,215,80,0.85),
    0 0 70px rgba(255,170,30,0.55),
    0 0 110px rgba(255,130,0,0.28); }
}

#pack-progress {
  font-size: 8px;
  letter-spacing: 2px;
  color: rgba(180,140,60,0.60);
  margin-top: 3px;
}

/* Progress crack glow — diagonal fissures that light up as sequences are cleared */
#shrine-crack-overlay {
  position: absolute;
  inset: 0;
  border-radius: 0 0 14px 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease;
  background:
    linear-gradient(124deg, transparent 44%, rgba(255,185,55,0.38) 45%, rgba(255,210,80,0.28) 46%, transparent 47%),
    linear-gradient(141deg, transparent 38%, rgba(255,165,40,0.22) 39%, transparent 40%),
    linear-gradient(62deg,  transparent 53%, rgba(255,185,55,0.32) 54%, rgba(255,205,70,0.24) 55%, transparent 56%),
    linear-gradient(38deg,  transparent 29%, rgba(255,155,35,0.18) 30%, transparent 31%),
    linear-gradient(108deg, transparent 61%, rgba(255,170,45,0.20) 62%, transparent 63%);
  mix-blend-mode: screen;
}

/* Aztec ornaments flanking the shrine */
.shrine-ornament {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-aztec);
  font-size: 18px;
  color: rgba(180,130,50,0.32);
  pointer-events: none;
  letter-spacing: -2px;
}
.shrine-ornament-left  { left:  8px; }
.shrine-ornament-right { right: 8px; }

/* ── Bottom-left corner: controls + music toggle ── */
#hud-corner {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: all;
}

#controls-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 13px;
  background: linear-gradient(135deg, rgba(30,18,6,0.82) 0%, rgba(20,12,4,0.88) 100%);
  border: 1px solid rgba(140,100,40,0.28);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255,200,100,0.08),
    0 2px 12px rgba(0,0,0,0.55),
    0 0 20px rgba(180,100,20,0.10);
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-key {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 1px;
  color: #c8a84a;
  background: rgba(255,200,80,0.08);
  border: 1px solid rgba(180,130,40,0.35);
  border-radius: 4px;
  padding: 1px 5px;
  min-width: 36px;
  text-align: center;
}

.ctrl-label {
  font-family: var(--font-ui);
  font-size: 8px;
  letter-spacing: 2px;
  color: rgba(160,130,70,0.65);
  text-transform: uppercase;
}

#music-btn {
  pointer-events: all;
  cursor: pointer;
  font-size: 14px;
  color: rgba(180,140,60,0.75);
  background: linear-gradient(135deg, rgba(30,18,6,0.82) 0%, rgba(20,12,4,0.88) 100%);
  border: 1px solid rgba(140,100,40,0.28);
  border-radius: 8px;
  padding: 6px 12px;
  letter-spacing: 2px;
  font-family: var(--font-ui);
  box-shadow:
    inset 0 1px 0 rgba(255,200,100,0.08),
    0 2px 12px rgba(0,0,0,0.55);
  transition: color 0.3s, border-color 0.3s, box-shadow 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

#music-btn:hover {
  color: rgba(255,210,80,0.95);
  border-color: rgba(200,150,50,0.50);
  box-shadow:
    inset 0 1px 0 rgba(255,200,100,0.12),
    0 2px 16px rgba(0,0,0,0.6),
    0 0 12px rgba(200,130,20,0.20);
}

#music-btn.muted {
  color: rgba(120,100,60,0.45);
  border-color: rgba(100,80,30,0.20);
}

#music-btn .music-label {
  font-size: 7px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ================================================================
   SCREENS (shared base)
   ================================================================ */
#start-screen,
#gameover-screen,
#intro-screen,
#howto-screen,
#treasure-screen,
#finale-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  /* Theme image backdrop */
  background-image: url('game_images/theme_image_horizontal.png');
  background-size: cover;
  background-position: center 30%;
}

/* Dark vignette over the image so cards remain readable */
#start-screen::before,
#gameover-screen::before,
#intro-screen::before,
#howto-screen::before,
#treasure-screen::before,
#finale-screen::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.82) 100%);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.screen-card {
  position: relative; /* sits above ::before overlay */
  background: linear-gradient(160deg, rgba(10,8,4,0.94) 0%, rgba(6,5,2,0.96) 100%);
  border: 1px solid rgba(180,130,50,0.38);
  border-radius: 4px;
  padding: 40px 48px;
  max-width: 560px;
  width: 92%;
  text-align: center;
  /* Stone-carved shadow with amber glow */
  box-shadow:
    0 0 0 3px rgba(100,70,20,0.25),
    0 0 40px rgba(200,140,30,0.20),
    0 0 100px rgba(0,180,220,0.08),
    inset 0 1px 0 rgba(255,200,100,0.08);
  max-height: 90vh;
  overflow-y: auto;
}

.win-card {
  border-color: rgba(255,210,61,0.55);
  box-shadow:
    0 0 0 3px rgba(180,130,30,0.20),
    0 0 50px rgba(255,200,50,0.25),
    0 0 120px rgba(255,200,50,0.10);
}

/* ── Start Screen ── */
.game-title {
  font-family: var(--font-title);
  font-size: 52px;
  letter-spacing: 6px;
  color: var(--gold);
  text-shadow:
    0 0 20px rgba(255,217,61,0.7),
    0 0 50px rgba(255,160,20,0.35),
    0 2px 4px rgba(0,0,0,0.8);
  line-height: 1;
}

.game-sub {
  font-size: 11px;
  letter-spacing: 5px;
  color: var(--text-dim);
  margin: 8px 0 28px;
}

.choose-label {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* Pack buttons */
#pack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.pack-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,217,61,0.2);
  border-radius: 10px;
  padding: 14px 20px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-family: var(--font-ui);
  text-align: left;
  width: 100%;
}

.pack-btn:hover, .pack-btn:focus {
  background: rgba(255,217,61,0.08);
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(255,217,61,0.15);
  transform: translateY(-1px);
  outline: none;
}

.pack-icon {
  font-size: 26px;
  font-family: var(--font-rune);
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.pack-name {
  font-size: 13px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--gold);
  flex: 1;
}

.pack-desc {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Leaderboard panel */
#lb-panel {
  border-top: 1px solid rgba(255,217,61,0.15);
  padding-top: 20px;
  text-align: left;
}

.lb-title {
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 12px;
}

#lb-list {
  font-size: 12px;
  line-height: 1.8;
}

.lb-loading {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 2px;
  display: block;
  text-align: center;
  padding: 8px 0;
}

.lb-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.lb-entry:hover { background: rgba(255,217,61,0.05); }

.lb-rank  { width: 24px; color: var(--text-dim); font-size: 11px; }
.lb-name  { flex: 1; color: var(--text); font-size: 12px; letter-spacing: 1px; }
.lb-score { color: var(--gold); font-size: 13px; font-weight: 700; }
.lb-pack  { color: var(--text-dim); font-size: 10px; letter-spacing: 1px; }

.lb-entry.is-me { background: rgba(255,217,61,0.08); }
.lb-entry.is-me .lb-name { color: var(--gold); }

.lb-unavailable {
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
  letter-spacing: 2px;
  padding: 8px 0;
}

/* ── End Screens ── */
.end-title {
  font-family: var(--font-title);
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 10px;
}

.end-title.gold { color: var(--gold); text-shadow: 0 0 20px rgba(255,217,61,0.4); }

.end-sub {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.final-score-row {
  font-size: 16px;
  letter-spacing: 4px;
  color: var(--text);
  margin-bottom: 24px;
}

.final-score-row span {
  font-size: 36px;
  font-weight: 700;
  color: var(--gold);
  margin-left: 12px;
}

.final-score-row.gold span { text-shadow: 0 0 20px rgba(255,217,61,0.5); }

.name-prompt {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

input[type="text"] {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,217,61,0.3);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: 2px;
  padding: 10px 16px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  text-align: center;
  margin-bottom: 12px;
}

input[type="text"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(255,217,61,0.15);
}

input[type="text"]::placeholder { color: var(--text-dim); }

.action-btn {
  display: inline-block;
  background: rgba(255,217,61,0.12);
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 3px;
  padding: 12px 28px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-bottom: 8px;
}

.action-btn:hover {
  background: rgba(255,217,61,0.22);
  box-shadow: 0 0 20px rgba(255,217,61,0.2);
  transform: translateY(-1px);
}

.action-btn.gold-btn {
  background: rgba(255,217,61,0.2);
}

.action-btn.secondary {
  background: transparent;
  border-color: rgba(255,255,255,0.15);
  color: var(--text-dim);
  font-size: 11px;
}

.action-btn.secondary:hover {
  border-color: rgba(255,255,255,0.35);
  color: var(--text);
  box-shadow: none;
}

#go-lb-result, #win-lb-result {
  margin: 12px 0;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
  padding: 8px;
  border: 1px solid rgba(255,217,61,0.15);
  border-radius: 6px;
}

/* ── Score bump animation ── */
@keyframes scoreBump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); color: #fff; }
  100% { transform: scale(1); }
}

.score-bump { animation: scoreBump 0.35s ease; }

/* ════════════════════════════════════════════════════════════════
   INTRO SCREEN
   ════════════════════════════════════════════════════════════════ */
.intro-card {
  border-color: rgba(255,217,61,0.25);
  text-align: center;
}

.intro-rune-glyph {
  font-family: var(--font-rune);
  font-size: 56px;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255,217,61,0.6), 0 0 60px rgba(255,217,61,0.3);
  margin-bottom: 10px;
  display: block;
  animation: runeGlow 3s ease-in-out infinite;
}

@keyframes runeGlow {
  0%, 100% { text-shadow: 0 0 30px rgba(255,217,61,0.6), 0 0 60px rgba(255,217,61,0.3); }
  50%       { text-shadow: 0 0 50px rgba(255,217,61,0.9), 0 0 90px rgba(255,217,61,0.5); }
}

.intro-text {
  margin: 20px 0 24px;
  line-height: 2;
}

.intro-text p {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.intro-emphasis {
  font-size: 15px !important;
  letter-spacing: 3px !important;
  color: var(--gold) !important;
  font-style: italic;
}

/* ════════════════════════════════════════════════════════════════
   HOW TO PLAY SCREEN
   ════════════════════════════════════════════════════════════════ */
.howto-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.howto-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(255,217,61,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  font-size: 12px;
  letter-spacing: 0.5px;
  line-height: 1.6;
  color: var(--text-dim);
}

.howto-item b { color: var(--text); }

.howto-icon {
  font-family: var(--font-rune);
  font-size: 18px;
  color: var(--gold);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  line-height: 1.4;
}

.clr-gold { color: var(--gold); }
.clr-dim  { color: var(--text-dim); }

/* ════════════════════════════════════════════════════════════════
   TREASURE PIECE SCREEN
   ════════════════════════════════════════════════════════════════ */
.treasure-card {
  border-color: rgba(255,217,61,0.5);
  box-shadow: 0 0 60px rgba(255,217,61,0.25), 0 0 120px rgba(255,217,61,0.08);
  text-align: center;
}

.treasure-path-complete {
  font-size: 10px;
  letter-spacing: 5px;
  color: var(--gold);
  margin-bottom: 10px;
}

.treasure-reveal-line {
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 20px;
}

.treasure-chapter-heading {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255,217,61,0.5);
  margin: 14px 0 16px;
  animation: piecePop 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}

.treasure-chapter-text {
  font-size: 13px;
  line-height: 2;
  letter-spacing: 0.4px;
  color: var(--text);
  text-align: left;
  padding: 16px 18px;
  border: 1px solid rgba(255,217,61,0.15);
  border-radius: 10px;
  background: rgba(255,217,61,0.03);
  font-style: italic;
  margin-bottom: 20px;
  animation: piecePop 0.6s 0.1s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes piecePop {
  0%   { transform: scale(0.85) translateY(10px); opacity: 0; }
  100% { transform: scale(1)    translateY(0);    opacity: 1; }
}

.treasure-progress-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 8px;
}

.ch-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255,217,61,0.35);
  background: transparent;
  display: inline-block;
  transition: background 0.3s, box-shadow 0.3s;
}

.ch-dot.filled {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(255,217,61,0.7);
  border-color: var(--gold);
}

.treasure-paths-left {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════════
   FINALE SCREEN
   ════════════════════════════════════════════════════════════════ */
.finale-card {
  border-color: rgba(255,217,61,0.7);
  box-shadow: 0 0 80px rgba(255,217,61,0.35), 0 0 160px rgba(255,217,61,0.15);
  text-align: center;
}

.finale-header-glyphs {
  font-family: var(--font-rune);
  font-size: 32px;
  letter-spacing: 12px;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255,217,61,0.5);
  margin-bottom: 14px;
}

.finale-story {
  text-align: left;
  margin-bottom: 8px;
}

.finale-chapter {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.finale-chapter.revealed {
  opacity: 1;
  transform: translateY(0);
}

.finale-chapter-heading {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255,217,61,0.4);
  margin-bottom: 10px;
}

.finale-chapter--last .finale-chapter-heading {
  font-size: 13px;
  text-shadow: 0 0 22px rgba(255,217,61,0.7);
}

.finale-chapter-text {
  font-size: 13px;
  line-height: 2;
  letter-spacing: 0.4px;
  color: var(--text);
  font-style: italic;
  padding: 14px 18px;
  border: 1px solid rgba(255,217,61,0.12);
  border-radius: 10px;
  background: rgba(255,217,61,0.02);
}

.finale-chapter--last .finale-chapter-text {
  border-color: rgba(255,217,61,0.3);
  background: rgba(255,217,61,0.05);
  color: #e8d9b0;
  box-shadow: 0 0 30px rgba(255,217,61,0.08);
}

.finale-chapter-divider {
  text-align: center;
  font-size: 16px;
  color: rgba(255,217,61,0.25);
  margin: 14px 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.finale-chapter-divider.revealed {
  opacity: 1;
}

/* ── Mobile tweaks ── */
@media (max-width: 480px) {
  .screen-card     { padding: 28px 20px; }
  .game-title      { font-size: 36px; }
  #target-display  { font-size: 30px; }
  .intro-rune-glyph { font-size: 40px; }
  .treasure-chapter-text { font-size: 12px; }
  .finale-chapter-text   { font-size: 12px; }
}
