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

/* css/style.css — LEXBLITZ arcade neon theme */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&family=Exo+2:wght@800&family=Rajdhani:wght@400;600;700&display=swap');

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --bg:        #07070f;
  --surface:   #0e0e1c;
  --surface2:  #151528;
  --border:    #242438;

  --accent:    #00d4ff;
  --accent2:   #ffd60a;
  --success:   #00ff88;
  --danger:    #ff3860;
  --text:      #e8e8f4;
  --muted:     #5a5a7a;

  --tile-bg:   #131326;
  --tile-sel:  #002233;

  --r:         14px;

  --f-game: 'Orbitron', monospace;
  --f-tile: 'Exo 2', sans-serif;
  --f-ui:   'Rajdhani', sans-serif;
}

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

html, body {
  height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--f-ui);
  -webkit-tap-highlight-color: transparent;
  user-select: none; touch-action: manipulation;
}

/* ── Screens ────────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.screen.active { opacity: 1; pointer-events: all; }

/* ── HOME ───────────────────────────────────────────────────── */
#screen-home {
  justify-content: center; gap: 28px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,212,255,.14) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 90% 90%,  rgba(255,214,10,.06) 0%, transparent 60%),
    var(--bg);
}
.home-content {
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  padding: 0 32px;
}
.logo {
  font-family: var(--f-game);
  font-size: clamp(52px, 16vw, 88px);
  font-weight: 900; letter-spacing: -2px; line-height: 1;
}
.logo-lex   { color: var(--text); }
.logo-blitz {
  color: var(--accent);
  text-shadow: 0 0 32px rgba(0,212,255,.7), 0 0 64px rgba(0,212,255,.3);
}
.tagline {
  font-size: 13px; color: var(--muted);
  letter-spacing: 2px; text-transform: uppercase; font-weight: 600;
}
.home-best {
  display: flex; gap: 8px; align-items: baseline;
  font-family: var(--f-game); font-size: 14px; color: var(--accent2);
}
#home-best-label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }
#home-best-value { font-size: 22px; font-weight: 700; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent); color: var(--bg);
  border: none; border-radius: var(--r);
  font-family: var(--f-game); font-weight: 700;
  font-size: 17px; letter-spacing: 4px;
  padding: 18px 52px; cursor: pointer;
  box-shadow: 0 0 28px rgba(0,212,255,.45);
  transition: transform .12s, box-shadow .12s;
}
.btn-primary:active { transform: scale(.95); box-shadow: 0 0 12px rgba(0,212,255,.3); }

/* ── GAME SCREEN ────────────────────────────────────────────── */
#screen-game {
  justify-content: space-between; background: var(--bg);
  padding-bottom: 0;
}

.btn-stop {
  background: var(--surface2); color: var(--danger);
  border: 1px solid var(--danger);
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 28px 24px;
  display: flex; flex-direction: column; gap: 20px;
  width: calc(100% - 48px); max-width: 340px;
}
.modal-text {
  font-size: 16px; font-weight: 600; color: var(--text);
  text-align: center; line-height: 1.5;
}
.modal-buttons { display: flex; gap: 12px; }
.btn-modal-cancel  {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); flex: 1;
}
.btn-modal-confirm {
  background: var(--danger); color: #fff;
  border: none; flex: 1;
  box-shadow: 0 0 14px rgba(255,56,96,.3);
}

.game-header {
  width: 100%; padding: 14px 20px 10px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.stat-block { display: flex; flex-direction: column; min-width: 64px; }
.stat-block.right { align-items: flex-end; }
.stat-label { font-size: 10px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; font-weight: 700; }
.stat-value {
  font-family: var(--f-game); font-size: 30px; font-weight: 700;
  color: var(--text); line-height: 1;
  transition: color .15s, transform .15s;
}
.stat-value.bump { color: var(--success); transform: scale(1.18); }

.timer-block { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.timer-value {
  font-family: var(--f-game); font-size: 38px; font-weight: 900;
  color: var(--accent); line-height: 1; min-width: 58px; text-align: center;
  transition: color .3s;
}
.timer-value.danger { color: var(--danger); animation: blink .5s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }

.timer-bar-wrap {
  width: 90px; height: 4px;
  background: var(--border); border-radius: 2px; overflow: hidden;
}
.timer-bar {
  height: 100%; background: var(--accent); border-radius: 2px;
  transition: width 1s linear, background .4s;
}
.timer-bar.danger { background: var(--danger); }

/* Word display area */
.word-display-area {
  width: 100%; padding: 10px 16px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.current-word {
  width: 100%; min-height: 48px;
  display: flex; align-items: center; justify-content: center;
  padding: 4px 16px;
}
#word-placeholder { display: none; }
.word-letters {
  font-family: var(--f-game); font-size: 26px; font-weight: 700;
  color: var(--accent); letter-spacing: 5px;
}
.word-letters.shake {
  animation: shake .35s ease;
}
@keyframes shake {
  0%,100%{transform:translateX(0)}
  20%{transform:translateX(-6px)}
  40%{transform:translateX(6px)}
  60%{transform:translateX(-4px)}
  80%{transform:translateX(4px)}
}

.feedback-row {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; height: 26px; /* hauteur fixe — aucun layout shift */
}

.combo-badge {
  background: var(--accent2); color: var(--bg);
  font-family: var(--f-game); font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; letter-spacing: 2px;
  white-space: nowrap;
}
.combo-badge.hidden { display: none; }
.combo-badge.flash  { animation: comboflash .3s ease 3; }
@keyframes comboflash { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }

.feedback-message {
  font-size: 14px; font-weight: 700; letter-spacing: 1px;
  opacity: 0; transition: opacity .2s; white-space: nowrap;
}
.feedback-message.visible { opacity: 1; }
.feedback-message.success { color: var(--success); }
.feedback-message.error   { color: var(--danger);  }

/* Found words strip */
.found-words-strip {
  width: 100%; overflow-x: auto; padding: 0 16px;
  scrollbar-width: none; flex-shrink: 0;
}
.found-words-strip::-webkit-scrollbar { display: none; }
.found-words {
  display: flex; gap: 8px; white-space: nowrap;
  padding: 4px 0; min-height: 32px; align-items: center;
}
.found-word {
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface2); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 20px;
  animation: wordpop .2s ease;
}
@keyframes wordpop { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:none} }

/* Letter pool */
.letter-pool {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 16px;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  flex-shrink: 0;
}
.tile {
  width: 100%;
  aspect-ratio: 1;
  background: var(--tile-bg); border: 2px solid var(--border);
  border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  transition: transform .12s, border-color .12s, background .12s, box-shadow .12s;
}
.tile:active { transform: scale(.9); }
.tile.selected {
  background: var(--tile-sel);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(0,212,255,.4), inset 0 0 10px rgba(0,212,255,.08);
  transform: translateY(-4px);
}
.tile-letter {
  font-family: var(--f-tile); font-size: 32px; font-weight: 800;
  color: var(--text); line-height: 1;
}
.tile.selected .tile-letter { color: var(--accent); }
.tile-value {
  position: absolute; bottom: 5px; right: 7px;
  font-family: var(--f-game); font-size: 10px; color: var(--muted); font-weight: 700;
}
.tile.selected .tile-value { color: var(--accent); }

/* Action buttons */
.action-buttons {
  display: flex; gap: 12px; padding: 12px 16px 24px;
  width: 100%; flex-shrink: 0;
}
.btn-action {
  flex: 1; padding: 16px; border: none; border-radius: var(--r);
  font-family: var(--f-game); font-weight: 700; font-size: 13px;
  letter-spacing: 2px; cursor: pointer;
  transition: transform .12s, opacity .12s;
}
.btn-action:active { transform: scale(.95); }
.btn-stop     { flex: 1; }
.btn-clear    { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); flex: 2; }
.btn-validate { background: var(--accent); color: var(--bg); box-shadow: 0 0 18px rgba(0,212,255,.35); flex: 3; }
.btn-validate.btn-disabled {
  background: var(--surface2); color: var(--muted);
  box-shadow: none; border: 1px solid var(--border);
}

/* ── GAME OVER ───────────────────────────────────────────────── */
#screen-gameover {
  justify-content: center; padding: 24px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(0,212,255,.1) 0%, transparent 70%),
    var(--bg);
}
.gameover-content {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  width: 100%; max-width: 400px;
}
#gameover-title {
  font-family: var(--f-game); font-size: 28px; font-weight: 900;
  letter-spacing: 5px; color: var(--text);
}
.record-badge {
  background: linear-gradient(135deg, var(--accent2), #ff8c00);
  color: var(--bg); font-family: var(--f-game); font-size: 13px;
  font-weight: 700; padding: 8px 20px; border-radius: 20px; letter-spacing: 1px;
  animation: recordpop .5s ease;
}
.record-badge.hidden { display: none; }
@keyframes recordpop { 0%{transform:scale(.5);opacity:0} 70%{transform:scale(1.1)} 100%{transform:scale(1);opacity:1} }

.final-stats { display: flex; gap: 12px; width: 100%; }
.final-stat {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 8px;
}
.final-stat-label { font-size: 10px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; font-weight: 700; }
.final-stat-value { font-family: var(--f-game); font-size: 30px; font-weight: 700; color: var(--accent); }

#found-list-label { font-size: 11px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; font-weight: 700; align-self: flex-start; }
.gameover-words {
  display: flex; flex-wrap: wrap; gap: 8px; width: 100%; max-height: 130px;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.gameover-word {
  font-size: 13px; font-weight: 600; color: #a0a0c0;
  background: var(--surface2); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px;
}

/* ── HOME TOPBAR ────────────────────────────────────────────── */
.home-topbar {
  position: absolute; top: 16px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 10;
}
.home-topbar-left { display: flex; gap: 8px; align-items: center; }
.btn-icon {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px; font-size: 14px;
  color: var(--text); cursor: pointer; font-family: var(--f-ui);
  font-weight: 600; transition: border-color .15s;
}
.btn-icon:hover { border-color: var(--accent); }
.btn-pseudo {
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: 20px; padding: 6px 14px; font-size: 13px;
  color: var(--accent); cursor: pointer; font-family: var(--f-ui);
  font-weight: 600; letter-spacing: 1px;
}
.btn-login-home {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
}

/* ── JOKER TILE ─────────────────────────────────────────────── */
.tile.joker {
  border-color: var(--accent2);
  box-shadow: 0 0 14px rgba(255,214,10,.35);
}
.tile.joker .tile-letter { color: var(--accent2); }
.tile.joker .tile-value  { color: var(--accent2); }
.tile.joker.selected {
  background: #1a1200;
  border-color: var(--accent2);
  box-shadow: 0 0 20px rgba(255,214,10,.5);
}

/* ── LETTER PICKER ──────────────────────────────────────────── */
.letter-picker {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.85); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.letter-picker.hidden { display: none; }
.letter-picker-inner { padding: 24px; width: 100%; max-width: 380px; }
.letter-picker-title {
  font-family: var(--f-game); font-size: 13px; color: var(--accent2);
  letter-spacing: 3px; text-align: center; margin-bottom: 16px;
  text-transform: uppercase;
}
.letter-picker-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
}
.letter-btn {
  font-family: var(--f-tile); font-size: 18px; font-weight: 800;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 12px 0;
  cursor: pointer; transition: all .12s; text-align: center;
}
.letter-btn:hover, .letter-btn:active {
  background: var(--accent2); color: var(--bg); border-color: var(--accent2);
  transform: scale(1.08);
}

/* ── AUTH SCREEN ────────────────────────────────────────────── */
#screen-auth {
  justify-content: center; padding: 24px;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(0,212,255,.08) 0%, transparent 70%), var(--bg);
}
.auth-content {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  width: 100%; max-width: 380px;
}
.logo-sm {
  font-family: var(--f-game); font-size: 28px; font-weight: 900;
  letter-spacing: -1px; margin-bottom: 4px;
}
.btn-back {
  align-self: flex-start; background: none; border: none;
  color: var(--muted); font-size: 20px; cursor: pointer;
  padding: 0; font-family: var(--f-ui); font-weight: 700;
  transition: color .15s;
}
.btn-back:hover { color: var(--text); }
.auth-tabs {
  display: flex; gap: 0; border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; width: 100%;
}
.auth-tab {
  flex: 1; padding: 12px; background: var(--surface2); border: none;
  color: var(--muted); font-family: var(--f-game); font-size: 12px;
  letter-spacing: 2px; cursor: pointer; transition: all .15s;
}
.auth-tab.active { background: var(--accent); color: var(--bg); }
.auth-form { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.auth-form.hidden { display: none; }
.auth-input {
  width: 100%; padding: 14px 16px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-size: 16px;
  font-family: var(--f-ui); outline: none;
  transition: border-color .2s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-input::placeholder { color: var(--muted); }
.auth-error {
  font-size: 13px; color: var(--danger); text-align: center;
  padding: 8px; background: rgba(255,56,96,.1);
  border-radius: 8px; border: 1px solid rgba(255,56,96,.3);
}
.auth-success {
  font-size: 13px; color: var(--success); text-align: center;
  padding: 8px; background: rgba(0,255,136,.08);
  border-radius: 8px; border: 1px solid rgba(0,255,136,.2);
}
.auth-error.hidden, .auth-success.hidden { display: none; }
.btn-auth-submit { width: 100%; }
.btn-text {
  background: none; border: none; color: #9090b8; font-size: 13px;
  cursor: pointer; padding: 4px; text-align: center; font-family: var(--f-ui);
  transition: color .15s; text-decoration: underline;
}
.btn-text:hover { color: var(--text); }
.btn-guest { color: #9090b8; margin-top: 8px; }
.auth-hint { font-size: 13px; color: #9090b8; text-align: center; line-height: 1.5; }

/* ── ACCOUNT SCREEN ─────────────────────────────────────────── */
#screen-account {
  justify-content: flex-start; overflow-y: auto;
  background: var(--bg);
}
.account-content {
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px; width: 100%; max-width: 500px; margin: 0 auto;
}
.account-topbar {
  display: flex; align-items: center; gap: 12px;
}
.account-title {
  flex: 1; font-family: var(--f-game); font-size: 18px; font-weight: 700;
  color: var(--text); letter-spacing: 2px;
}
.btn-logout { color: var(--danger); font-size: 12px; text-decoration: none; }
.account-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; transition: border-color .15s;
}
.stat-card:hover { border-color: var(--accent); }
.stat-card-locked {
  opacity: .35; cursor: default; filter: grayscale(1);
  border-style: dashed;
}
.stat-card-locked .stat-card-val { color: var(--muted); }
.stat-card-val {
  font-family: var(--f-game); font-size: 28px; font-weight: 700; color: var(--accent);
  line-height: 1;
}
.stat-card-lbl { font-size: 10px; color: #9090b8; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; }
.account-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.account-section-title {
  font-family: var(--f-game); font-size: 11px; color: var(--accent);
  letter-spacing: 3px; text-transform: uppercase;
}
.account-form-row { display: flex; gap: 8px; }
.account-form-row .auth-input { flex: 1; }
.btn-save {
  background: var(--accent); color: var(--bg);
  border: none; flex: 0 0 auto; padding: 14px 16px; white-space: nowrap;
  font-size: 11px; letter-spacing: 1px;
}
.account-hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.danger-zone { border-color: rgba(255,56,96,.3); }
.danger-zone .account-section-title { color: var(--danger); }
.btn-delete {
  background: var(--danger); color: #fff; border: none;
  flex: 0 0 auto; padding: 14px 16px; font-size: 11px; letter-spacing: 1px;
}
.achievements-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ach-chip {
  font-size: 12px; font-weight: 600; color: var(--accent2);
  background: rgba(255,214,10,.08); border: 1px solid rgba(255,214,10,.3);
  padding: 5px 12px; border-radius: 20px;
  cursor: pointer; transition: background .15s, transform .1s;
}
.ach-chip:hover {
  background: rgba(255,214,10,.18);
  transform: scale(1.04);
}
.ach-empty { font-size: 13px; color: var(--muted); font-style: italic; }

/* ── LEADERBOARD SCREEN ─────────────────────────────────────── */
#screen-leaderboard {
  justify-content: flex-start; background: var(--bg);
}
.lb-content {
  display: flex; flex-direction: column; width: 100%; height: 100%;
}
.lb-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 8px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.lb-title {
  font-family: var(--f-game); font-size: 18px; font-weight: 700;
  color: var(--text); letter-spacing: 2px; flex: 1;
}
.lb-tabs {
  display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.lb-tab {
  flex: 1; padding: 12px; background: none; border: none;
  color: var(--muted); font-family: var(--f-game); font-size: 10px;
  letter-spacing: 2px; cursor: pointer; transition: all .15s;
  border-bottom: 2px solid transparent;
}
.lb-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.lb-list {
  flex: 1; overflow-y: auto; padding: 8px 0;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .15s;
}
.lb-row.lb-me { background: rgba(0,212,255,.06); }
.lb-medal { width: 28px; text-align: center; font-size: 18px; }
.lb-rank-num { font-family: var(--f-game); font-size: 13px; color: #8888aa; }
.lb-pseudo { flex: 1; font-size: 15px; font-weight: 600; color: var(--text); }
.lb-me .lb-pseudo { color: var(--accent); }
.lb-score {
  font-family: var(--f-game); font-size: 16px; font-weight: 700; color: var(--accent2);
}
.lb-games { font-size: 11px; color: #8888aa; min-width: 36px; text-align: right; }
.lb-loading, .lb-error, .lb-empty {
  text-align: center; padding: 32px; color: #9090b8; font-size: 14px;
}

/* ── ACHIEVEMENT OVERLAY ────────────────────────────────────── */
.achievement-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.75); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.achievement-overlay.hidden { display: none; }
.achievement-modal {
  background: var(--surface); border: 1px solid var(--accent2);
  border-radius: calc(var(--r) * 1.5); padding: 36px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  max-width: 320px; width: 100%;
  box-shadow: 0 0 60px rgba(255,214,10,.2);
  animation: modalIn .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalIn {
  from { transform: scale(.8); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}
.achievement-icon  { font-size: 52px; line-height: 1; }
.achievement-title {
  font-family: var(--f-game); font-size: 18px; font-weight: 900;
  color: var(--accent2); text-align: center; letter-spacing: 1px;
}
.achievement-desc  {
  font-size: 14px; color: var(--text); text-align: center;
  line-height: 1.6; opacity: .85;
}
.btn-ach-continue  { width: 100%; margin-top: 8px; }

/* ── GAMEOVER HOME BUTTON ───────────────────────────────────── */
.btn-home-go {
  margin-top: 4px;
  font-size: 14px;
  color: #8888aa;
  text-decoration: none;
  letter-spacing: 1px;
}
.btn-home-go:hover { color: var(--text); }

/* ── GUEST ACCOUNT ──────────────────────────────────────────── */
.btn-guest-account { color: var(--muted); border-color: var(--border); }

.member-only-locked {
  opacity: .3;
  pointer-events: none;
  user-select: none;
  filter: grayscale(1);
}

.guest-cta {
  background: linear-gradient(135deg, rgba(0,212,255,.08), rgba(0,212,255,.03));
  border: 1px solid rgba(0,212,255,.25);
  border-radius: var(--r); padding: 24px 20px;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; text-align: center;
}
.guest-cta.hidden { display: none; }
.guest-cta-text { font-size: 14px; color: #b0b8d0; line-height: 1.6; }
.guest-cta .btn-primary { width: 100%; }
.guest-cta .btn-text    { color: #9090b8; }

/* ── BONUS BAR ──────────────────────────────────────────────── */
.bonus-bar {
  display: flex; gap: 8px; justify-content: center;
  padding: 4px 16px; flex-shrink: 0;
  width: 100%;
}

.bonus-btn {
  flex: 1; height: 60px; border-radius: 14px;
  border: 2px solid rgba(255,255,255,.18);
  font-size: 26px; cursor: pointer;
  position: relative; overflow: hidden;
  transition: transform .12s, border-color .2s;
  --fill: 0%; --clr: #444;
  background:
    linear-gradient(to top,
      var(--clr) var(--fill),
      rgba(255,255,255,.06) var(--fill)
    );
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

.bonus-btn.locked {
  cursor: pointer; /* Still clickable for info */
  opacity: .6;
}
.bonus-btn.locked:active { transform: scale(.95); }
.bonus-btn.ready {
  border-color: var(--clr);
  box-shadow: 0 0 12px var(--clr);
  animation: bonus-pulse 2s ease-in-out infinite;
}
.bonus-btn.active-mode {
  border-color: var(--clr);
  box-shadow: 0 0 20px var(--clr);
  transform: scale(1.08);
}
@keyframes bonus-pulse {
  0%,100% { box-shadow: 0 0 8px var(--clr); }
  50%     { box-shadow: 0 0 20px var(--clr); }
}

/* ── BONUS EFFECTS ──────────────────────────────────────────── */

/* Explosion mode — tiles glow orange when waiting for selection */
.explosion-target .tile {
  border-color: #ff6b35 !important;
  box-shadow: 0 0 8px rgba(255,107,53,.4);
  cursor: crosshair;
}
.tile.exploding {
  animation: tile-explode .4s ease-out forwards;
}
@keyframes tile-explode {
  0%   { transform: scale(1);   opacity: 1; background: #ff6b35; }
  50%  { transform: scale(1.4); opacity: .8; }
  100% { transform: scale(0);   opacity: 0; }
}
.tile.appearing {
  animation: tile-appear .3s ease-out;
}
@keyframes tile-appear {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  80%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

/* Freeze effect — blue frost on timer */
.freeze-active #timer-display {
  color: #00d4ff !important;
  text-shadow: 0 0 16px #00d4ff;
  animation: freeze-pulse 1s ease-in-out infinite;
}
.freeze-active .timer-bar { background: #00d4ff !important; }
@keyframes freeze-pulse {
  0%,100% { text-shadow: 0 0 8px #00d4ff; }
  50%     { text-shadow: 0 0 24px #00d4ff; }
}

/* Combo bonus — purple glow on score */
.combo-forced #score-display {
  color: #bf5fff !important;
  text-shadow: 0 0 16px #bf5fff;
}
.combo-forced .combo-badge {
  background: #bf5fff !important;
  animation: none;
  display: flex !important;
}

/* Shuffle — tiles flip */
.tile.shuffle-flip {
  animation: tile-flip .35s ease-in-out;
}
@keyframes tile-flip {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(90deg); opacity: .3; }
  100% { transform: rotateY(0deg); }
}

/* ── TUTORIAL MODAL ─────────────────────────────────────────── */
.tutorial-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.tutorial-overlay.hidden { display: none; }
.tutorial-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--r) * 1.5); padding: 32px 24px;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; max-width: 340px; width: 100%;
  animation: modalIn .35s cubic-bezier(.34,1.56,.64,1);
}
.tutorial-icon  { font-size: 40px; }
.tutorial-title {
  font-family: var(--f-game); font-size: 18px; font-weight: 900;
  color: var(--accent); letter-spacing: 2px;
}
.tutorial-body  { font-size: 13px; color: #b0b8d0; text-align: center; line-height: 1.7; }
.tutorial-locked { font-size: 12px; color: var(--muted); text-align: center; font-style: italic; }
.tutorial-bonuses {
  display: flex; gap: 10px; margin: 4px 0;
}
.t-bonus {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; border: 1px solid var(--c);
  box-shadow: 0 0 10px var(--c);
  background: rgba(255,255,255,.04);
}
.tutorial-modal .btn-primary { width: 100%; margin-top: 4px; }

/* ── BONUS GAUGES (account page) ────────────────────────────── */
.bonus-gauge-row { display: flex; flex-direction: column; gap: 6px; }
.bonus-gauge-header {
  display: flex; align-items: center; gap: 8px;
}
.bonus-gauge-icon  { font-size: 18px; width: 24px; text-align: center; }
.bonus-gauge-name  { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.bonus-gauge-count { font-size: 11px; color: #9090b8; font-family: var(--f-game); }
.bonus-gauge-track {
  height: 6px; background: rgba(255,255,255,.08);
  border-radius: 3px; overflow: hidden;
}
.bonus-gauge-fill  {
  height: 100%; border-radius: 3px;
  transition: width .4s ease;
  min-width: 2px;
}
#bonus-gauges-section { display: flex; flex-direction: column; gap: 14px; }

/* ── BONUS COUNTER BADGE ────────────────────────────────────── */
.bonus-count {
  position: absolute; bottom: 4px; right: 6px;
  font-size: 11px; font-family: var(--f-game);
  font-weight: 900; letter-spacing: 0;
  pointer-events: none; line-height: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

/* ── JOKER PLACEMENT MODE ───────────────────────────────────── */
.joker-placement-target .tile {
  border-color: #ffd60a !important;
  box-shadow: 0 0 8px rgba(255,214,10,.4);
  cursor: crosshair;
  animation: joker-pulse .8s ease-in-out infinite alternate;
}
@keyframes joker-pulse {
  from { box-shadow: 0 0 6px rgba(255,214,10,.3); }
  to   { box-shadow: 0 0 16px rgba(255,214,10,.6); }
}

/* ── STATS SCREEN ───────────────────────────────────────────── */
#screen-stats { justify-content: flex-start; background: var(--bg); }
.stats-content {
  display: flex; flex-direction: column; width: 100%; height: 100%;
}
.stats-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 8px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.stats-title {
  font-family: var(--f-game); font-size: 18px; font-weight: 700;
  color: var(--text); letter-spacing: 2px; flex: 1;
}
.stats-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
  max-width: 600px; width: 100%; margin: 0 auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.stats-loading, .stats-empty {
  text-align: center; padding: 40px 20px;
  color: #9090b8; font-size: 14px; line-height: 1.7;
}
.stats-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px; display: flex;
  flex-direction: column; gap: 12px;
}
.stats-section-title {
  font-family: var(--f-game); font-size: 11px;
  color: var(--accent); letter-spacing: 3px; text-transform: uppercase;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.stats-card {
  background: var(--surface2); border-radius: 10px;
  padding: 10px 6px; display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.stats-card-val {
  font-family: var(--f-game); font-size: 18px; font-weight: 700;
  color: var(--accent2); line-height: 1;
}
.stats-card-lbl {
  font-size: 9px; color: #9090b8; letter-spacing: 1px;
  text-transform: uppercase; text-align: center;
}

/* Top words */
.top-words-list { display: flex; flex-wrap: wrap; gap: 8px; }
.top-word {
  font-family: var(--f-game); font-size: 14px; font-weight: 700;
  color: var(--text); background: var(--surface2);
  padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border);
}
.top-word small { color: var(--accent); font-size: 10px; margin-left: 4px; }
.best-scorer {
  font-size: 13px; color: #b0b8d0;
  padding: 8px 0; border-top: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.best-scorer .bs-label { color: #9090b8; }
.best-scorer strong { color: var(--accent2); font-size: 15px; }
.best-scorer .bs-pts { color: #9090b8; }


/* Distribution bar chart */
.dist-chart { display: flex; flex-direction: column; gap: 6px; }
.dist-row { display: flex; align-items: center; gap: 8px; }
.dist-len { font-family: var(--f-game); font-size: 11px; color: var(--muted); width: 20px; }
.dist-bar-wrap { flex: 1; height: 8px; background: rgba(255,255,255,.06); border-radius: 4px; overflow: hidden; }
.dist-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s ease; min-width: 2px; }
.dist-cnt { font-size: 11px; color: #9090b8; width: 28px; text-align: right; }

/* ── CHALLENGE SCREENS ──────────────────────────────────────── */
#screen-challenge, #screen-challenge-history {
  justify-content: flex-start; background: var(--bg);
}
.challenge-content {
  display: flex; flex-direction: column; width: 100%; height: 100%;
}
.challenge-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 8px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.challenge-title {
  font-family: var(--f-game); font-size: 18px; font-weight: 700;
  color: var(--text); letter-spacing: 2px;
}
.challenge-body {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
  max-width: 480px; width: 100%; margin: 0 auto;
}
.challenge-loading, .challenge-error {
  text-align: center; padding: 40px; color: #9090b8; font-size: 14px;
}

/* Challenge card */
.challenge-card, .challenge-result-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px;
  display: flex; flex-direction: column; gap: 16px; align-items: center;
}
.challenge-challenger {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.ch-pseudo { font-family: var(--f-game); font-size: 18px; font-weight: 700; color: var(--accent); }
.ch-score  { font-family: var(--f-game); font-size: 28px; font-weight: 900; color: var(--accent2); }
.ch-bonus-label { font-size: 10px; color: var(--muted); letter-spacing: 2px; margin-top: 4px; }
.ch-bonus  { font-size: 18px; }

/* Pool preview */
.challenge-pool {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px; width: 160px;
}
.ch-tile {
  background: var(--tile-bg); border: 1px solid var(--border);
  border-radius: 10px; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-tile); font-size: 20px; font-weight: 800;
  color: var(--text);
}
.challenge-msg { font-size: 13px; color: #9090b8; text-align: center; }
.challenge-share { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.challenge-share-icon { font-size: 48px; }
.challenge-share-text { font-size: 14px; color: #b0b8d0; text-align: center; }
.challenge-url-box {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; width: 100%;
}
.challenge-url { font-size: 12px; color: var(--accent); word-break: break-all; }
.challenge-share .btn-primary { width: 100%; }

/* Challenge results */
.challenge-results { width: 100%; }
.challenge-results-title {
  font-family: var(--f-game); font-size: 11px; color: var(--accent);
  letter-spacing: 3px; margin-bottom: 10px;
}
.ch-result-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 13px;
}
.ch-result-pseudo { flex: 1; color: var(--text); font-weight: 600; }
.ch-result-score  { color: var(--accent2); font-family: var(--f-game); }
.ch-result-bonus  { font-size: 16px; }

/* Challenge game over result */
.challenge-verdict {
  font-family: var(--f-game); font-size: 20px; font-weight: 900;
  color: var(--accent); letter-spacing: 2px; text-align: center;
}
.challenge-scores {
  display: flex; align-items: center; gap: 16px; width: 100%;
  justify-content: center;
}
.ch-score-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ch-score-lbl   { font-size: 11px; color: #9090b8; letter-spacing: 1px; }
.ch-score-val   { font-family: var(--f-game); font-size: 32px; font-weight: 900; color: var(--text); }
.ch-score-val.won  { color: #00ff88; }
.ch-score-val.lost { color: #ff6b35; }
.ch-score-bonus { font-size: 16px; }
.ch-vs { font-family: var(--f-game); font-size: 14px; color: var(--muted); }
.challenge-result-card .btn-primary  { width: 100%; }
.challenge-result-card .btn-text     { margin-top: 4px; color: #9090b8; }

/* Challenge History */
.ch-hist-section { display: flex; flex-direction: column; gap: 8px; }
.ch-hist-title {
  font-family: var(--f-game); font-size: 11px; color: var(--accent);
  letter-spacing: 3px; text-transform: uppercase;
}
.ch-hist-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; font-size: 13px;
  margin-bottom: 8px;
}
.ch-hist-token { font-family: var(--f-game); font-size: 12px; color: var(--accent); flex: 1; }
.ch-hist-score { font-family: var(--f-game); font-size: 14px; font-weight: 700; }
.ch-hist-score.won  { color: #00ff88; }
.ch-hist-score.lost { color: #ff6b35; }
.ch-hist-count { font-size: 11px; color: #9090b8; }
.ch-share-btn  { background: none; border: none; font-size: 18px; cursor: pointer; padding: 0 4px; }
.ch-hist-empty { font-size: 13px; color: #9090b8; font-style: italic; padding: 8px 0; }

/* Game over challenge button */
.btn-secondary {
  width: 100%; padding: 14px; border-radius: var(--r);
  background: rgba(0,212,255,.1); border: 1px solid var(--accent);
  color: var(--accent); font-family: var(--f-game); font-size: 13px;
  letter-spacing: 2px; cursor: pointer; transition: background .15s;
}
.btn-secondary:hover { background: rgba(0,212,255,.2); }

/* Challenge history button in account */
.btn-challenge-hist {
  background: rgba(0,212,255,.08); border: 1px solid rgba(0,212,255,.25);
  color: var(--accent); font-size: 13px; letter-spacing: 1px;
  border-radius: var(--r); padding: 14px;
  cursor: pointer; transition: background .15s; width: 100%;
}
.btn-challenge-hist:hover { background: rgba(0,212,255,.15); }

/* ── CHALLENGE TABS ─────────────────────────────────────────── */
.ch-tabs {
  display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; margin-bottom: 12px;
}
.ch-tab {
  flex: 1; padding: 12px; background: none; border: none;
  color: var(--muted); font-family: var(--f-game); font-size: 10px;
  letter-spacing: 2px; cursor: pointer; transition: all .15s;
  border-bottom: 2px solid transparent;
}
.ch-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Challenge history row improvements */
.ch-hist-row { flex-wrap: wrap; }
.ch-hist-info { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.ch-hist-label { font-family: var(--f-game); font-size: 13px; color: var(--text); }
.ch-hist-sub   { font-size: 11px; color: #9090b8; }
.ch-hist-sub.ch-won  { color: #00ff88; }
.ch-hist-sub.ch-lost { color: #ff6b35; }

/* Share link — no underline */
.ch-share-link {
  background: none; border: none; font-size: 18px; cursor: pointer;
  padding: 0 4px; text-decoration: none; color: var(--text);
  display: flex; align-items: center;
}

/* Pool hidden hint */
.challenge-pool-hint {
  font-size: 12px; color: #9090b8; text-align: center; font-style: italic;
}

.btn-notif-on { background: rgba(0,255,136,.15); border-color: #00ff88; color: #00ff88; }

/* ── SHARE MODAL ────────────────────────────────────────────── */
.share-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.75); backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.share-overlay.hidden { display: none; }
.share-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px 24px 0 0; padding: 24px 20px 40px;
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 20px;
  animation: slideUp .25s ease-out;
  position: relative;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.share-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--surface2); border: none; border-radius: 50%;
  width: 28px; height: 28px; font-size: 14px; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.share-title {
  font-family: var(--f-game); font-size: 15px; font-weight: 700;
  color: var(--text); letter-spacing: 2px; text-align: center;
}
.share-networks {
  display: flex; justify-content: space-around; gap: 8px;
}
.share-net {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 8px; cursor: pointer;
  flex: 1; transition: border-color .15s, transform .1s;
  min-width: 0;
}
.share-net:hover, .share-net:active { border-color: var(--accent); transform: scale(1.04); }
.share-net-icon {
  font-size: 22px; line-height: 1;
  font-family: 'Segoe UI Emoji', sans-serif;
}
.share-net:nth-child(1) .share-net-icon { color: #25d366; }
.share-net:nth-child(2) .share-net-icon { color: #2aabee; }
.share-net:nth-child(3) .share-net-icon { color: var(--text); font-style: normal; font-weight: 900; font-size: 18px; }
.share-net:nth-child(4) .share-net-icon { color: #1877f2; font-weight: 900; font-size: 22px; font-style: normal; }
.share-net:nth-child(5) .share-net-icon { color: var(--accent); }
.share-net-label { font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.btn-copy-link {
  width: 100%; padding: 14px; border-radius: var(--r);
  background: rgba(0,212,255,.1); border: 1px solid var(--accent);
  color: var(--accent); font-family: var(--f-game); font-size: 13px;
  letter-spacing: 1px; cursor: pointer; transition: all .2s;
}
.btn-copy-link.copied {
  background: rgba(0,255,136,.15); border-color: #00ff88; color: #00ff88;
}

/* ── CHALLENGE HISTORY CARDS ────────────────────────────────── */
.ch-hist-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px; margin-bottom: 10px;
}
.ch-hist-card-header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 10px;
}
.ch-hist-token   { flex: 1; font-family: var(--f-game); font-size: 13px; color: var(--accent); }
.ch-hist-myscore { font-family: var(--f-game); font-size: 14px; color: var(--accent2); }
.ch-hist-results { display: flex; flex-direction: column; gap: 6px; }
.ch-result-detail {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 4px 0;
}
.ch-result-detail.won  .ch-rd-score { color: #00ff88; }
.ch-result-detail.lost .ch-rd-score { color: #ff6b35; }
.ch-rd-pseudo { flex: 1; color: var(--text); font-weight: 600; }
.ch-rd-score  { font-family: var(--f-game); font-size: 13px; color: var(--muted); }
.ch-rd-badge  { font-size: 16px; width: 20px; text-align: center; }
.ch-rd-empty  { font-size: 12px; color: #9090b8; font-style: italic; padding: 4px 0; }
.ch-rd-verdict {
  font-family: var(--f-game); font-size: 11px; letter-spacing: 2px;
  text-align: right; padding-top: 4px; margin-top: 2px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.ch-rd-verdict.won  { color: #00ff88; }
.ch-rd-verdict.lost { color: #ff6b35; }

/* ── CHALLENGE HISTORY CARD V2 ──────────────────────────────── */
.ch-hist-card2 {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px;
}
.ch-card2-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ch-card2-id   { font-family: var(--f-game); font-size: 12px; color: var(--accent); flex: 1; }
.ch-card2-date { font-size: 11px; color: #9090b8; }
.ch-card2-me   { font-family: var(--f-game); font-size: 13px; color: var(--accent2); }
.ch-card2-status {
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 10px;
}
.ch-status-open { color: #9090b8; background: rgba(255,255,255,.06); }
.ch-status-won  { color: #00ff88; background: rgba(0,255,136,.1); }
.ch-status-lost { color: #ff6b35; background: rgba(255,107,53,.1); }

.ch-card2-results {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; gap: 4px;
}
.ch-inline-result {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.ch-ir-pseudo { flex: 1; color: var(--text); }
.ch-ir-score  { font-family: var(--f-game); font-size: 12px; }
.ch-ir-score.won  { color: #00ff88; }
.ch-ir-score.lost { color: #ff6b35; }
.ch-ir-icon   { font-size: 14px; width: 18px; text-align: center; }

.ch-card2-scores {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; gap: 4px;
}
.ch-card2-score-row {
  display: flex; justify-content: space-between; font-size: 13px;
}
.ch-card2-score-row .won  { color: #00ff88; font-family: var(--f-game); font-weight: 700; }
.ch-card2-score-row .lost { color: #ff6b35; font-family: var(--f-game); }
