/* ═══════════════════════════════════════════════════════════
   OLYMPUS REBORN IDLE — main.css
   Variables globales, reset, typographie
════════════════════════════════════════════════════════════ */

:root {
  /* Palette divine */
  --col-bg:         #0a0812;
  --col-bg2:        #110e1f;
  --col-bg3:        #1a1530;
  --col-gold:       #c8951a;
  --col-gold-light: #f0c040;
  --col-gold-dim:   #7a5510;
  --col-amber:      #e8832a;
  --col-divine:     #7b5ea7;
  --col-divine-light:#b08fd4;
  --col-chaos:      #5a1a7a;
  --col-corruption: #3d0f5a;
  --col-text:       #e8dfc8;
  --col-text-dim:   #8a7d60;
  --col-border:     #3a3020;
  --col-border-gold:#6a5028;

  /* Ressources */
  --col-drachmes:   #f0c040;
  --col-bois:       #7a9a3a;
  --col-nourr:      #5aaa5a;
  --col-fer:        #7aaad4;
  --col-ether:      #c080f0;

  /* Typo */
  --font-title:  'Cinzel Decorative', serif;
  --font-ui:     'Cinzel', serif;
  --font-body:   'Crimson Text', serif;

  /* Tailles */
  --hud-top-h:    68px;
  --hud-bottom-h: 52px;
  --radius:       8px;
  --radius-sm:    4px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--col-bg);
  color: var(--col-text);
  font-family: var(--font-body);
  font-size: 18px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button { cursor: pointer; border: none; background: none; font-family: var(--font-ui); }
.hidden { display: none !important; }

/* ── Scrollbar custom ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--col-bg2); }
::-webkit-scrollbar-thumb { background: var(--col-border-gold); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════
   ÉCRAN DE CHARGEMENT
════════════════════════════════════════════════════════════ */
#loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(ellipse at center, #1a1030 0%, #0a0812 70%);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}

.loading-content {
  text-align: center;
  animation: loadingFadeIn 0.8s ease forwards;
}

.loading-emblem {
  font-size: 75px;
  display: block;
  margin-bottom: 24px;
  filter: drop-shadow(0 0 30px var(--col-gold));
  animation: floatGlow 2s ease-in-out infinite;
}

.loading-title {
  font-family: var(--font-title);
  font-size: clamp(31px, 5vw, 55px);
  color: var(--col-gold-light);
  letter-spacing: 0.15em;
  text-shadow:
    0 0 20px var(--col-gold),
    0 0 60px rgba(200,149,26,0.4);
  margin-bottom: 40px;
}

.loading-bar-container {
  width: 320px; max-width: 80vw;
  height: 6px;
  background: var(--col-bg3);
  border-radius: 3px;
  border: 1px solid var(--col-border-gold);
  overflow: hidden;
  margin: 0 auto 16px;
}

.loading-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--col-gold-dim), var(--col-gold-light));
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 12px var(--col-gold);
}

.loading-subtitle {
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--col-text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════
   CONTENEUR DU JEU
════════════════════════════════════════════════════════════ */
#game-container {
  display: grid;
  grid-template-rows: var(--hud-top-h) 1fr var(--hud-bottom-h);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   ÉCRAN TITRE
════════════════════════════════════════════════════════════ */
#title-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.ts-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(80,30,140,0.35) 0%, transparent 65%),
    radial-gradient(ellipse at center, #1a1030 0%, #060410 100%);
}
.ts-bg::before {
  content:'';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(200,149,26,0.07) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: ts-drift 60s linear infinite;
}
@keyframes ts-drift { from{background-position:0 0} to{background-position:40px 40px} }

.ts-content {
  position: relative; z-index: 1;
  text-align: center;
  animation: loadingFadeIn 0.9s ease forwards;
}
.ts-emblem {
  font-size: 90px;
  display: block;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 40px var(--col-gold));
  animation: floatGlow 2.5s ease-in-out infinite;
}
.ts-title {
  font-family: var(--font-title);
  font-size: clamp(34px, 6vw, 64px);
  color: var(--col-gold-light);
  letter-spacing: 0.18em;
  text-shadow: 0 0 24px var(--col-gold), 0 0 70px rgba(200,149,26,0.35);
  margin-bottom: 10px;
}
.ts-sub {
  font-family: var(--font-ui);
  font-size: 15px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 50px;
}
.ts-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.ts-btn {
  width: 260px;
  padding: 14px 24px;
  font-family: var(--font-title);
  font-size: 16px;
  letter-spacing: 0.12em;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.ts-btn-new {
  background: linear-gradient(135deg, rgba(140,80,10,0.5), rgba(200,149,26,0.3));
  border-color: rgba(200,149,26,0.6);
  color: #f5e090;
  box-shadow: 0 0 24px rgba(200,149,26,0.2), inset 0 1px 0 rgba(255,255,255,0.08);
}
.ts-btn-new:hover {
  background: linear-gradient(135deg, rgba(180,110,20,0.65), rgba(220,170,40,0.45));
  border-color: rgba(240,200,60,0.85);
  box-shadow: 0 0 36px rgba(220,180,40,0.35);
  transform: translateY(-2px);
}
.ts-btn-continue {
  background: rgba(20,15,40,0.6);
  border-color: rgba(140,100,200,0.4);
  color: #c0a0ff;
}
.ts-btn-continue:not(:disabled):hover {
  background: rgba(60,30,100,0.5);
  border-color: rgba(180,130,255,0.65);
  transform: translateY(-2px);
}
.ts-btn-continue:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}
.ts-save-info {
  font-size: 12px;
  color: rgba(255,255,255,0.28);
  font-style: italic;
  height: 18px;
}

/* ── Google Auth UI ─────────────────────────────────────── */
.ts-state { animation: loadingFadeIn 0.3s ease; }

.ts-btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 280px;
  padding: 13px 20px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-title);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 auto 0;
}
.ts-btn-google:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.4);
  transform: translateY(-1px);
}
.ts-btn-google:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.ts-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px auto;
  width: 260px;
  color: rgba(255,255,255,0.2);
  font-size: 12px;
}
.ts-divider::before, .ts-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.12);
}

.ts-btn-local {
  display: block;
  width: 260px;
  margin: 0 auto;
  padding: 12px 20px;
  background: rgba(200,149,26,0.12);
  border: 1px solid rgba(200,149,26,0.3);
  border-radius: 8px;
  color: #d0a830;
  font-family: var(--font-title);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.ts-btn-local:hover {
  background: rgba(200,149,26,0.22);
  border-color: rgba(200,149,26,0.55);
  transform: translateY(-1px);
}
.ts-btn-local-new {
  display: block;
  width: 260px;
  margin: 8px auto 0;
  padding: 11px 20px;
  background: transparent;
  border: 1px solid rgba(200,149,26,0.18);
  border-radius: 8px;
  color: rgba(200,149,26,0.5);
  font-family: var(--font-title);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.ts-btn-local-new:hover {
  border-color: rgba(200,149,26,0.4);
  color: #d0a830;
}

.ts-state-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.22);
  margin-top: 14px;
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
  font-style: italic;
}

/* Carte utilisateur */
.ts-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 280px;
  margin: 0 auto 14px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
}
.ts-user-pic {
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(200,149,26,0.4);
}
.ts-user-info { flex: 1; text-align: left; }
.ts-user-name  { font-family: var(--font-title); font-size: 13px; color: #e8d090; }
.ts-user-email { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }
.ts-signout-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: rgba(255,255,255,0.35);
  width: 26px; height: 26px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.ts-signout-btn:hover { background: rgba(200,60,60,0.25); border-color: rgba(200,60,60,0.5); color: #ff8080; }

/* Save status */
.ts-save-status {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 20px;
}

/* Boutons jeu */
.ts-play-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Spinners */
.ts-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(200,149,26,0.15);
  border-top-color: rgba(200,149,26,0.7);
  border-radius: 50%;
  animation: ts-spin 0.9s linear infinite;
  margin: 0 auto 12px;
}
.ts-spinner-sm {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: rgba(255,255,255,0.5);
  border-radius: 50%;
  animation: ts-spin 0.9s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes ts-spin { to { transform: rotate(360deg); } }
.ts-state-text { color: rgba(255,255,255,0.3); font-size: 13px; margin-top: 4px; }
