/* ═══════════════════════════════════════════════════════
   TEMPLE RUN — Αρχαία Αγορά  ·  game.css  (v2 revamp)
   Modern "Neon Antiquity" visual language
═══════════════════════════════════════════════════════ */

/* ── Custom properties ───────────────────────────── */
#tr-root {
  --gold:        #D4A017;
  --gold-light:  #F5C842;
  --gold-glow:   rgba(212,160,23,0.55);
  --blue:        #00B4FF;
  --blue-glow:   rgba(0,180,255,0.45);
  --red:         #EF4444;
  --green:       #22C55E;
  --text:        #EAD898;
  --text-dim:    rgba(234,216,152,0.45);
  --bg:          rgba(4,2,18,0.92);
  --border:      rgba(212,160,23,0.3);
  --radius:      12px;
  --radius-lg:   18px;
}

/* ── Root & canvas ───────────────────────────────── */
#tr-root {
  width: 100%; height: 100%;
  position: relative;
  overflow: hidden;
  background: #03010C;
  user-select: none;
  font-family: 'Inter', system-ui, sans-serif;
  touch-action: none;
}
#tr-canvas {
  display: block;
  width: 100%; height: 100%;
}

/* ── Question card ───────────────────────────────── */
#tr-question-wrap {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  pointer-events: none;
  transform: translateY(-110%);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 10px 12px 0;
}
#tr-question-wrap.visible {
  transform: translateY(0);
}
.tr-qcard {
  background: rgba(3,1,20,0.94);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 14px 16px 16px;
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.7), 0 0 40px rgba(212,160,23,0.06);
  position: relative;
}

/* Gold shimmer top edge */
.tr-qcard::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%, var(--gold) 30%, var(--gold-light) 50%, var(--gold) 70%, transparent 100%);
  opacity: 0.7;
}

/* Timer bar */
.tr-q-timer {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-bottom: 11px;
  overflow: hidden;
  position: relative;
}
.tr-q-timer-bar {
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--green) 0%, var(--gold) 40%, var(--red) 100%);
  transform-origin: left;
  transition: width 0.1s linear;
  box-shadow: 0 0 6px rgba(255,200,50,0.5);
}

/* Question text */
.tr-q-text {
  font-size: clamp(13px, 2vw, 16px);
  color: var(--text);
  text-align: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 12px;
  text-shadow: 0 0 20px rgba(212,160,23,0.2);
}

/* Options grid */
.tr-q-opts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.tr-q-opt {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 10px;
  padding: 9px 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  position: relative;
  overflow: hidden;
}
.tr-q-opt::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 100%);
  border-radius: inherit;
}
.tr-q-opt.active {
  border-color: var(--gold);
  background: rgba(212,160,23,0.10);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212,160,23,0.2), inset 0 0 0 1px rgba(212,160,23,0.2);
}
.tr-q-opt.result-correct {
  border-color: var(--green);
  background: rgba(34,197,94,0.12);
  box-shadow: 0 0 16px rgba(34,197,94,0.25);
}
.tr-q-opt.result-wrong {
  border-color: var(--red);
  background: rgba(239,68,68,0.10);
}
.tr-q-lbl {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
  min-width: 18px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  line-height: 1.2;
}
.tr-q-opt-text {
  font-size: clamp(11px, 1.5vw, 13px);
  color: rgba(234,216,152,0.8);
  line-height: 1.35;
}

/* ENTER hint */
.tr-q-enter-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tr-q-enter-hint kbd {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 11px;
  font-family: 'Inter', monospace;
  color: var(--text);
}

/* ── Answer flash ────────────────────────────────── */
#tr-answer-flash {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  font-size: clamp(26px, 4.5vw, 46px);
  font-weight: 800;
  font-family: 'Cormorant Garamond', Georgia, serif;
  padding: 12px 32px;
  border-radius: var(--radius);
  z-index: 30;
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 1px;
}
#tr-answer-flash.flash-correct {
  background: rgba(34,197,94,0.14);
  color: var(--green);
  border: 2px solid rgba(34,197,94,0.4);
  text-shadow: 0 0 24px rgba(34,197,94,0.6);
  animation: tr-flash 0.9s ease forwards;
}
#tr-answer-flash.flash-wrong {
  background: rgba(239,68,68,0.14);
  color: var(--red);
  border: 2px solid rgba(239,68,68,0.4);
  text-shadow: 0 0 24px rgba(239,68,68,0.6);
  animation: tr-flash 0.9s ease forwards;
}
@keyframes tr-flash {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(0.5); }
  20%  { opacity: 1; transform: translate(-50%,-50%) scale(1.12); }
  60%  { opacity: 1; transform: translate(-50%,-50%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(0.88); }
}

/* ── In-game action labels (JUMP! / DUCK!) ───────── */
.tr-action-label {
  position: absolute;
  pointer-events: none;
  z-index: 12;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 800;
  font-size: clamp(16px, 2.5vw, 22px);
  letter-spacing: 2px;
  text-transform: uppercase;
  animation: tr-action-pulse 0.4s ease-in-out infinite alternate;
}
.tr-action-label.jump { color: #FF9520; text-shadow: 0 0 12px rgba(255,149,32,0.7); }
.tr-action-label.duck { color: var(--blue); text-shadow: 0 0 12px var(--blue-glow); }
@keyframes tr-action-pulse {
  from { opacity: 0.7; transform: translateY(0) scale(1); }
  to   { opacity: 1;   transform: translateY(-4px) scale(1.06); }
}

/* ── Danger vignette ─────────────────────────────── */
#tr-danger {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.5s;
  background: radial-gradient(ellipse 90% 80% at 50% 50%,
    transparent 38%, rgba(180,15,15,0.6) 100%);
}
#tr-danger.d1 { opacity: 0.4; }
#tr-danger.d2 { opacity: 0.72; animation: tr-danger-pulse 0.5s ease-in-out infinite alternate; }
@keyframes tr-danger-pulse { from { opacity: 0.5; } to { opacity: 0.85; } }

/* ── Start screen ────────────────────────────────── */
#tr-start {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2,1,12,0.85);
  backdrop-filter: blur(8px);
  z-index: 50;
}
.tr-start-box {
  text-align: center;
  padding: 40px 36px;
  max-width: 500px;
  width: 92%;
  animation: tr-fadein 0.5s ease;
}
@keyframes tr-fadein { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.tr-start-icon { font-size: 52px; margin-bottom: 8px; filter: drop-shadow(0 0 16px rgba(212,160,23,0.4)); }
.tr-start-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(38px, 7.5vw, 58px);
  font-weight: 700;
  color: transparent;
  background: linear-gradient(180deg, #F5C842 0%, #D4A017 55%, #8A6010 100%);
  -webkit-background-clip: text; background-clip: text;
  letter-spacing: 5px;
  filter: drop-shadow(0 0 24px rgba(212,160,23,0.4));
  line-height: 1;
  margin-bottom: 4px;
}
.tr-start-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.tr-start-game-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(15px, 2.5vw, 20px);
  color: rgba(234,216,152,0.7);
  margin-bottom: 22px;
  font-style: italic;
}

/* Controls grid */
.tr-ctrl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 28px;
  text-align: left;
}
.tr-ctrl-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tr-ctrl-icon { font-size: 18px; }
.tr-ctrl-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}
.tr-ctrl-desc strong { color: var(--text); font-weight: 600; display: block; font-size: 11px; letter-spacing: 0.5px; }

/* Start button */
.tr-start-btn {
  background: linear-gradient(135deg, #C9A020, #E8C040);
  color: #180C00;
  border: none;
  padding: 14px 52px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3px;
  border-radius: 9px;
  cursor: pointer;
  font-family: 'Cormorant Garamond', Georgia, serif;
  transition: transform 0.14s, box-shadow 0.14s, opacity 0.14s;
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 4px 20px rgba(200,160,32,0.25);
}
.tr-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(200,160,32,0.38);
}
.tr-start-btn:active { transform: translateY(0); opacity: 0.9; }

/* ── Game over ───────────────────────────────────── */
#tr-gameover {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(2,1,12,0.92);
  backdrop-filter: blur(12px);
  z-index: 50;
}
#tr-gameover.visible { display: flex; animation: tr-fadein 0.4s ease; }
.tr-go-box {
  text-align: center;
  padding: 44px 36px;
  background: rgba(8,4,26,0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 420px; width: 90%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.75), 0 0 0 1px rgba(212,160,23,0.06);
  position: relative;
  overflow: hidden;
}
.tr-go-box::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.tr-go-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(40px, 8vw, 60px);
  font-weight: 700;
  color: transparent;
  background: linear-gradient(180deg, #F5C842, #D4A017);
  -webkit-background-clip: text; background-clip: text;
  margin-bottom: 6px; line-height: 1;
}
.tr-go-reason { font-size: 13px; color: var(--text-dim); margin-bottom: 28px; }
.tr-go-stats {
  display: flex; justify-content: center; gap: 28px; margin-bottom: 28px;
}
.tr-go-stat .val {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 32px; font-weight: 700; color: var(--gold);
}
.tr-go-stat .lbl {
  display: block; font-size: 9px;
  color: var(--text-dim); letter-spacing: 2.5px; text-transform: uppercase; margin-top: 2px;
}
.tr-go-btns { display: flex; flex-direction: column; gap: 9px; }
.tr-go-btn {
  padding: 12px 24px; border-radius: 9px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid rgba(255,255,255,0.12);
  background: transparent; color: rgba(234,216,152,0.55);
  transition: all 0.14s; letter-spacing: 1px;
  font-family: 'Inter', sans-serif;
}
.tr-go-btn.primary {
  background: linear-gradient(135deg, #C9A020, #E8C040);
  color: #180C00; border: none; font-weight: 700; font-size: 14px;
  box-shadow: 0 4px 16px rgba(200,160,32,0.2);
}
.tr-go-btn:hover { opacity: 0.84; transform: translateY(-1px); }

/* ── Touch zones ─────────────────────────────────── */
#tr-touch-zones {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 50%; display: flex; z-index: 15;
}
.tr-tz { flex: 1; cursor: pointer; opacity: 0; }

/* ── Jump / slide ripple feedback ───────────────── */
@keyframes tr-ripple {
  from { transform: translate(-50%,-50%) scale(0.2); opacity: 0.8; }
  to   { transform: translate(-50%,-50%) scale(2.5); opacity: 0; }
}
.tr-ripple {
  position: absolute; border-radius: 50%;
  width: 60px; height: 60px;
  border: 2px solid;
  pointer-events: none; z-index: 6;
  animation: tr-ripple 0.5s ease-out forwards;
}
.tr-ripple.jump  { border-color: #FF9520; }
.tr-ripple.slide { border-color: var(--blue); }
