/* ============================================================
   Tizomer Games — Enhanced Design System (Oficina + Arcade)
   Visual upgrade: glass, neon glow, animations, 3D cards
   ============================================================ */

:root {
  --bg-0: #070a10;
  --bg-1: #0b1018;
  --bg-2: #121926;
  --bg-3: #182235;
  --border: rgba(120, 160, 220, 0.18);
  --border-strong: rgba(120, 160, 220, 0.32);
  --text-1: #eaf2ff;
  --text-2: #a8b3c7;
  --text-3: #7b879b;
  --accent: #00d4aa;
  --accent-2: #58a6ff;
  --accent-dim: rgba(0, 212, 170, 0.16);
  --accent-glow: rgba(0, 212, 170, 0.35);
  --success: #3fb950;
  --danger: #f85149;
  --warning: #d29922;
  --info: #58a6ff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 4px 14px rgba(0,0,0,0.35);
  --shadow-md: 0 12px 32px rgba(0,0,0,0.45);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.55);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
  touch-action: manipulation;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(0,212,170,0.10) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 100%, rgba(88,166,255,0.10) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 50%, rgba(99,102,241,0.06) 0%, transparent 50%),
    var(--bg-0);
}

/* Container */
.game-container {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, rgba(18,25,38,0.92), rgba(13,17,23,0.94));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.04);
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px) saturate(120%);
}
.game-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.8;
}
.game-container::after {
  content: '';
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 30% 20%, rgba(88,166,255,0.08), transparent 40%),
              radial-gradient(circle at 70% 80%, rgba(0,212,170,0.08), transparent 40%);
  pointer-events: none;
  animation: bgFloat 14s ease-in-out infinite alternate;
}
@keyframes bgFloat { from { transform: translate3d(0,0,0);} to { transform: translate3d(2%, -2%, 0);} }
.game-container > * { position: relative; z-index: 1; }

/* Header */
.game-header { margin-bottom: 16px; }
.game-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  background: linear-gradient(90deg, #fff, #bfe9ff, #bfffee);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(88,166,255,0.15);
}
.game-header .subtitle { color: var(--text-2); font-size: 0.88rem; }

/* Stats */
.stats, .stats-bar, .credits-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(24,34,53,0.7);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}
.stats strong, .stats-bar strong, .credits-bar strong { color: var(--text-1); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Canvas */
canvas {
  display: block;
  margin: 0 auto 14px;
  border: 1px solid rgba(88,166,255,0.25);
  border-radius: var(--radius-md);
  background: #0a0f18;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 18px 40px rgba(0,0,0,0.5), 0 0 40px rgba(88,166,255,0.08);
}

/* Buttons */
.btn, .tc-btn, .action-btn, .option-btn { font-family: var(--font); transition: all .18s ease; }
.btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--accent), #2ee6c4);
  color: #04130f;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,212,170,0.25);
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 10px 24px rgba(0,212,170,0.32); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: rgba(24,34,53,0.9); color: var(--text-1); border: 1px solid var(--border); box-shadow: none; }
.btn-danger { background: linear-gradient(135deg, #f85149, #ff6b63); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #d29922, #f0c36d); color: #1a1202; }

/* Touch controls */
.touch-controls { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.tc-btn {
  flex: 1; padding: 12px 4px;
  background: rgba(24,34,53,0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 1.1rem; cursor: pointer; user-select: none;
}
.tc-btn:active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,212,170,0.12) inset; }
.tc-btn.jump { background: rgba(0,212,170,0.12); border-color: rgba(0,212,170,0.45); color: var(--accent); flex: 2; }
.tc-btn.drop { background: rgba(248,81,73,0.12); border-color: rgba(248,81,73,0.45); color: #ff8a84; }
.joystick { width: 96px; height: 96px; background: rgba(24,34,53,0.8); border: 1px solid var(--border); border-radius: 50%; position: relative; touch-action: none; flex-shrink: 0; }
.stick { width: 36px; height: 36px; background: linear-gradient(135deg,var(--accent),var(--accent-2)); border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 0 18px var(--accent-glow); }
.action-btns { display: flex; gap: 8px; }
.action-btn { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--border); background: rgba(24,34,53,0.8); color: var(--text-1); font-size: 1.3rem; cursor: pointer; display:flex; align-items:center; justify-content:center; }
.action-btn:active { border-color: var(--accent); }
.touch-controls.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }

/* Overlay */
.overlay {
  position: fixed; inset: 0;
  background: rgba(6, 10, 16, 0.88);
  backdrop-filter: blur(10px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 100; color: var(--text-1); padding: 24px;
}
.overlay h2 { font-size: 1.9rem; font-weight: 800; margin-bottom: 8px; }
.overlay p { font-size: 1rem; color: var(--text-2); margin-bottom: 6px; }
.overlay .btn { margin-top: 16px; }

/* Ranking */
.ranking {
  margin-top: 12px; text-align: left;
  background: rgba(24,34,53,0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}
.ranking h2 { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-2); margin-bottom: 8px; }
.ranking ol { padding-left: 18px; font-size: 0.78rem; color: var(--text-2); }
.ranking li { padding: 3px 0; font-variant-numeric: tabular-nums; }
.ranking li:first-child { color: var(--accent); font-weight: 700; }

.hint { font-size: 0.72rem; color: var(--text-3); margin-top: 10px; }

/* Memory cards - 3D flip */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; perspective: 800px; }
.card {
  aspect-ratio: 1;
  background: linear-gradient(180deg, rgba(30,42,66,0.95), rgba(20,28,44,0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; cursor: pointer;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), border-color .25s ease, box-shadow .25s ease, background .25s ease;
  user-select: none; position: relative; overflow: hidden;
  transform-style: preserve-3d;
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
}
.card::before { content:''; position:absolute; inset:0; background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.08), transparent 50%); pointer-events:none; }
.card:hover { border-color: rgba(88,166,255,0.5); transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,0.35), 0 0 0 1px rgba(88,166,255,0.08); }
.card.flipped { background: linear-gradient(180deg, rgba(20,40,55,0.98), rgba(16,30,45,0.98)); border-color: rgba(0,212,170,0.55); transform: rotateY(0deg) scale(1.02); box-shadow: 0 0 0 1px rgba(0,212,170,0.2), 0 10px 24px rgba(0,212,170,0.12); }
.card.matched { background: linear-gradient(180deg, rgba(0,212,170,0.18), rgba(0,212,170,0.08)); border-color: rgba(0,212,170,0.7); pointer-events: none; animation: matchPop .45s ease; box-shadow: 0 0 18px rgba(0,212,170,0.18); }
@keyframes matchPop { 0%{transform:scale(1)} 40%{transform:scale(1.08)} 100%{transform:scale(1)} }

/* Quiz */
.question-card { background: rgba(24,34,53,0.75); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; margin-bottom: 16px; text-align: left; }
.question-card h2 { font-size: 1.02rem; font-weight: 600; line-height: 1.55; color: var(--text-1); }
.options { display: flex; flex-direction: column; gap: 8px; }
.option-btn { padding: 12px 14px; background: rgba(24,34,53,0.8); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-1); font-size: 0.88rem; cursor: pointer; transition: all .18s ease; text-align: left; }
.option-btn:hover { background: rgba(30,42,66,0.95); border-color: rgba(88,166,255,0.45); transform: translateX(2px); }
.option-btn.correct { background: rgba(63,185,80,0.18); border-color: var(--success); color: #7ee787; box-shadow: 0 0 0 1px rgba(63,185,80,0.15) inset; }
.option-btn.wrong { background: rgba(248,81,73,0.18); border-color: var(--danger); color: #ffa198; }
.option-btn:disabled { cursor: not-allowed; opacity: 0.7; }
.progress-wrap { height: 8px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; margin: 8px 0 14px; border: 1px solid var(--border); }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0%; transition: width .3s ease; }

.result { min-height: 24px; margin: 14px 0; font-size: 0.95rem; font-weight: 700; color: var(--text-2); }
.result.win { color: #7ee787; }
.result.lose { color: #ffa198; }

/* Roleta */
.slots { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
.reel { width: 96px; height: 112px; background: linear-gradient(180deg,#182235,#121926); border: 1px solid var(--border-strong); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; box-shadow: inset 0 0 20px rgba(0,0,0,0.35), 0 8px 18px rgba(0,0,0,0.25); }
.reel::before, .reel::after { content:''; position:absolute; left:0; right:0; height:26px; pointer-events:none; z-index:2; }
.reel::before { top:0; background: linear-gradient(180deg, rgba(18,25,38,0.95), transparent); }
.reel::after { bottom:0; background: linear-gradient(0deg, rgba(18,25,38,0.95), transparent); }
.symbol { font-size: 3rem; transition: transform .1s; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4)); }
.reel.spinning { border-color: rgba(0,212,170,0.5); box-shadow: 0 0 0 1px rgba(0,212,170,0.15) inset, 0 0 18px rgba(0,212,170,0.12); }
.reel.spinning .symbol { animation: spin .08s linear infinite; }
@keyframes spin { 0%{transform:translateY(-18px);opacity:.35;filter:blur(1px);} 50%{transform:translateY(0);opacity:1;} 100%{transform:translateY(18px);opacity:.35;filter:blur(1px);} }
.reel.win-flash { animation: winFlash .6s ease; }
@keyframes winFlash { 0%,100%{box-shadow:0 0 0 0 rgba(0,212,170,0);} 50%{box-shadow:0 0 0 4px rgba(0,212,170,0.18), 0 0 24px rgba(0,212,170,0.25);} }

.controls { margin: 16px 0; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(0,212,170,0);} 50%{box-shadow:0 0 0 8px rgba(0,212,170,0.08);} }

@media (max-width: 480px) {
  .game-container { padding: 14px; border-radius: var(--radius-lg); }
  .game-header h1 { font-size: 1.2rem; }
  .stats, .stats-bar, .credits-bar { font-size: 0.74rem; padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
