/* ═══════════════════════════════════════════════════
   BLEADERINO SLIDE v2 — ICQ Retro Arcade
   ═══════════════════════════════════════════════════ */

:root {
  --bg:        #0a0618;
  --bg2:       #130a28;
  --panel:     #1a0e38;
  --panel2:    #221248;
  --border:    #3a2070;
  --border2:   #5a3898;
  --accent:    #ff8c00;
  --accent2:   #ffd700;
  --purple:    #9b59b6;
  --teal:      #00d4aa;
  --red:       #ff4466;
  --text:      #ede0ff;
  --text-dim:  #9878c8;
  --text-mute: #5a4080;

  /* Tile colours */
  --tile-light: #f2ead8;
  --tile-light2:#e4d8b8;
  --tile-border:#c4a860;
  --tile-empty: #180e30;

  --cell: 72px;
  --gap:  5px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCREENS ── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hidden { display: none !important; }

/* ════════════════════════════════
   HOME
════════════════════════════════ */
#screen-home { position: relative; padding: 40px 20px; }

.home-glow {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 25% 25%, rgba(155,89,182,0.2) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 75%, rgba(255,140,0,0.14) 0%, transparent 55%);
}

.home-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  width: 100%; max-width: 420px;
}

.logo { text-align: center; }
.logo-fruits {
  font-size: 36px; letter-spacing: 4px;
  filter: drop-shadow(0 0 12px rgba(255,140,0,0.5));
  animation: bounce 2s ease-in-out infinite;
  display: block; margin-bottom: 10px;
}
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }

.logo h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(26px, 7vw, 46px); font-weight: 900; line-height: 1.1;
  text-shadow: 0 0 28px rgba(155,89,182,0.8);
  letter-spacing: 2px;
}
.logo h1 span { color: var(--accent); text-shadow: 0 0 20px rgba(255,140,0,0.9); }
.logo-sub { font-size: 11px; letter-spacing: 3px; color: var(--text-dim); margin-top: 6px; text-transform: uppercase; }

.home-form { width: 100%; }
.home-form label { display: block; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }

input[type="text"] {
  width: 100%; background: var(--panel); border: 1.5px solid var(--border);
  border-radius: 10px; color: var(--text); font-family: 'Exo 2', sans-serif;
  font-size: 16px; padding: 12px 16px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input[type="text"]:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(155,89,182,0.2); }
input[type="text"]::placeholder { color: var(--text-mute); }

.home-buttons { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 18px; border: none; border-radius: 10px;
  font-family: 'Exo 2', sans-serif; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .18s; letter-spacing: .4px;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), #d97000); color: #fff; box-shadow: 0 4px 18px rgba(255,140,0,0.3); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(255,140,0,0.5); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }

.join-box, .create-box {
  width: 100%; display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
}
.join-box { flex-direction: row; flex-wrap: wrap; }
.join-box input { flex: 1; min-width: 120px; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
.join-box .btn { width: auto; padding: 12px 18px; }

.rounds-selector { display: flex; gap: 8px; }
.rnd-btn {
  flex: 1; padding: 8px; background: var(--panel2); border: 1.5px solid var(--border);
  border-radius: 8px; color: var(--text-dim); font-family: 'Exo 2', sans-serif;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.rnd-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(255,140,0,0.1); }
.rnd-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ════════════════════════════════
   LOBBY
════════════════════════════════ */
#screen-lobby { background: var(--bg2); }
.lobby-inner {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  padding: 40px 20px; max-width: 400px; width: 100%;
}
.lobby-inner h2 { font-family: 'Orbitron', sans-serif; font-size: 22px; color: var(--accent2); }

.room-code-box {
  font-size: 14px; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px;
}
.room-code-box strong { font-family: 'Orbitron', sans-serif; font-size: 18px; color: var(--teal); letter-spacing: 3px; }
.copy-btn { background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px 4px; border-radius: 4px; }
.copy-btn:hover { background: var(--panel2); }

.lobby-players { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.lobby-player {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px;
}
.lobby-player-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.lobby-player-name { font-weight: 600; flex: 1; }
.lobby-player-host { font-size: 11px; color: var(--accent); letter-spacing: 1px; text-transform: uppercase; }

.lobby-wait { font-size: 13px; color: var(--text-mute); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ════════════════════════════════
   GAME SCREEN
════════════════════════════════ */
#screen-game {
  justify-content: flex-start;
  padding: 0;
  overflow: hidden;
}

.game-wrap {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 12px 0;
  gap: 12px;
  align-items: flex-start;
}

/* ── PLAYER PANELS ── */
.player-panel {
  flex: 0 0 200px;
  display: flex; flex-direction: column; gap: 14px;
}

.player-header {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border: 1.5px solid var(--border); border-radius: 12px; padding: 12px;
}

.player-arrow {
  font-size: 22px; text-align: center;
  color: var(--text-mute);
  transition: color .3s, text-shadow .3s;
}
.player-arrow.active {
  color: var(--accent);
  text-shadow: 0 0 14px var(--accent);
  animation: throb 1s ease-in-out infinite;
}
@keyframes throb { 0%,100%{opacity:1} 50%{opacity:.6} }

.player-name {
  font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 700;
  text-align: center; color: var(--text); letter-spacing: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.player-score-box { text-align: center; }
.score-label { display: block; font-size: 9px; letter-spacing: 2px; color: var(--text-dim); text-transform: uppercase; }
.player-score {
  font-family: 'Orbitron', sans-serif; font-size: 26px; font-weight: 900;
  color: var(--accent2); text-shadow: 0 0 14px rgba(255,215,0,0.5);
  display: block;
}

/* Score table */
.score-table {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.score-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-dim); text-align: center; margin-bottom: 4px; }
.score-row { display: flex; align-items: center; gap: 6px; }
.score-row img { width: 28px; height: 28px; object-fit: contain; border-radius: 4px; }
.score-row span { font-size: 12px; color: var(--text-dim); }
.score-row span b { color: var(--accent2); font-weight: 700; }
.score-note { font-size: 10px; color: var(--text-mute); text-align: center; margin-top: 4px; line-height: 1.4; }

/* Queue panel (right) */
.queue-panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.queue-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-dim); }
.queue-current img { width: 54px; height: 54px; border-radius: 8px; border: 2px solid var(--accent); }
.queue-next { display: flex; gap: 6px; }
.queue-next img { width: 36px; height: 36px; border-radius: 6px; border: 1.5px solid var(--border2); opacity: .85; }

/* ── CENTER BOARD AREA ── */
.center-col {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}

.game-status-bar {
  display: flex; justify-content: space-between; align-items: center;
  width: calc(5 * var(--cell) + 4 * var(--gap) + 2 * 40px);
  padding: 6px 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; color: var(--text-dim);
}
.turn-indicator { font-weight: 700; color: var(--accent); font-family: 'Orbitron', sans-serif; font-size: 12px; }

/* Top insert row */
.insert-top { width: calc(5 * var(--cell) + 4 * var(--gap) + 2 * 40px); display: flex; justify-content: center; }
.insert-arrow-row { display: flex; gap: var(--gap); margin-left: 40px; margin-right: 40px; }

/* Board row = left arrows + grid + right arrows */
.board-row { display: flex; align-items: center; gap: 6px; }

.insert-side { display: flex; flex-direction: column; gap: var(--gap); }

/* Arrow buttons */
.arr-btn {
  width: 34px; height: var(--cell);
  background: var(--panel2); border: 1.5px solid var(--border);
  border-radius: 8px; color: var(--text-dim);
  font-size: 14px; cursor: pointer; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.insert-arrow-row .arr-btn {
  width: var(--cell); height: 34px;
}
.arr-btn:hover:not(:disabled) {
  border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 12px rgba(255,140,0,0.3);
  transform: scale(1.08);
}
.arr-btn:disabled { opacity: .25; cursor: not-allowed; }

/* ── BOARD ── */
.board {
  display: grid;
  grid-template-columns: repeat(5, var(--cell));
  grid-template-rows: repeat(5, var(--cell));
  gap: var(--gap);
  padding: 10px;
  background: #100830;
  border: 2px solid var(--border2);
  border-radius: 14px;
  box-shadow: 0 0 0 4px var(--bg), 0 0 40px rgba(155,89,182,0.2), inset 0 0 30px rgba(0,0,0,0.4);
}

.cell {
  width: var(--cell); height: var(--cell);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  transition: transform .2s;
}

.cell.filled {
  background: linear-gradient(145deg, var(--tile-light), var(--tile-light2));
  border: 2px solid var(--tile-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), inset 0 -2px 0 rgba(150,110,0,.2), 0 3px 8px rgba(120,80,0,.25);
}
.cell.filled::before {
  content: ''; position: absolute; top: 0; left: 0; width: 60%; height: 45%;
  background: linear-gradient(135deg, rgba(255,255,255,.5) 0%, transparent 100%);
  border-radius: 8px 0 0 0; pointer-events: none;
}
.cell.empty {
  background: var(--tile-empty);
  border: 1.5px solid rgba(58,32,112,.35);
  box-shadow: inset 0 0 12px rgba(0,0,0,.5);
}

.cell img { width: 82%; height: 82%; object-fit: contain; pointer-events: none; }

/* Flash animations */
.cell.match-flash { animation: matchFlash .6s ease forwards; }
@keyframes matchFlash {
  0%   { filter: brightness(1); }
  30%  { filter: brightness(2.2) saturate(2); transform: scale(1.12); }
  70%  { filter: brightness(1.5); transform: scale(1.05); }
  100% { filter: brightness(1); transform: scale(1); opacity: 0; }
}

.cell.drop-in { animation: dropIn .25s ease; }
@keyframes dropIn { from { transform: translateY(-20px); opacity: .5; } to { transform: none; opacity: 1; } }

/* ── MY TILE BAR ── */
.my-tile-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-top: 1.5px solid var(--border2);
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 10px 20px; font-size: 13px; color: var(--text-dim);
  z-index: 50;
}
.my-tile-img img { width: 48px; height: 48px; border-radius: 8px; border: 2px solid var(--accent); }
.my-tile-next { display: flex; gap: 6px; }
.my-tile-next img { width: 36px; height: 36px; border-radius: 6px; border: 1.5px solid var(--border2); }

/* ── SCORE POPUP ── */
.score-popup {
  position: absolute; top: -28px; left: 50%; transform: translateX(-50%);
  background: var(--accent2); color: #000; font-family: 'Orbitron', sans-serif;
  font-size: 13px; font-weight: 900; padding: 3px 10px; border-radius: 20px;
  pointer-events: none; white-space: nowrap;
  animation: popUp .9s ease forwards;
}
@keyframes popUp { 0%{opacity:1;transform:translateX(-50%) translateY(0)} 100%{opacity:0;transform:translateX(-50%) translateY(-40px)} }

/* ── MODAL ── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  backdrop-filter: blur(6px);
}
.modal-box {
  background: var(--bg2); border: 1.5px solid var(--purple); border-radius: 20px;
  padding: 40px 32px; text-align: center; max-width: 360px; width: 90%;
  box-shadow: 0 0 60px rgba(155,89,182,.4);
  animation: popIn .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn { from{transform:scale(.7);opacity:0} to{transform:scale(1);opacity:1} }
.modal-trophy { font-size: 60px; margin-bottom: 10px; }
.modal-box h2 { font-family: 'Orbitron', sans-serif; font-size: 22px; color: var(--accent2); margin-bottom: 20px; }

.final-scores { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.final-score-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel); border-radius: 10px; padding: 10px 16px;
}
.final-score-row .fn { font-weight: 700; }
.final-score-row .fs { font-family: 'Orbitron', sans-serif; font-size: 18px; color: var(--accent2); }
.final-score-row.winner { border: 1.5px solid var(--accent2); }

.modal-buttons { display: flex; gap: 10px; justify-content: center; }
.modal-buttons .btn { width: auto; padding: 11px 24px; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--border2); border-radius: 10px;
  padding: 10px 20px; font-size: 14px; color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  animation: slideUp .3s ease;
  z-index: 300;
}
@keyframes slideUp { from{transform:translateX(-50%) translateY(20px);opacity:0} to{transform:translateX(-50%) translateY(0);opacity:1} }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  :root { --cell: 58px; }
  .player-panel { flex: 0 0 160px; }
  .score-table { display: none; }
}
@media (max-width: 680px) {
  :root { --cell: 52px; }
  .player-panel { flex: 0 0 130px; }
  .queue-panel { display: none; }
  .game-wrap { padding: 8px 6px 0; gap: 6px; }
}
@media (max-width: 520px) {
  :root { --cell: 44px; --gap: 4px; }
  .player-panel { flex: 0 0 100px; }
  .arr-btn { width: 28px; }
  .insert-arrow-row .arr-btn { height: 28px; }
}
