:root {
  --bg: #0b0f19; --surface: rgba(255,255,255,0.06); --border: rgba(255,255,255,0.1);
  --text: #e2e8f0; --accent: #38bdf8; --success: #4ade80; --warn: #facc15;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, sans-serif; overflow-x: hidden; min-height: 100vh; display: flex; justify-content: center; }
#app { width: 100%; max-width: 480px; min-height: 100vh; position: relative; display: flex; flex-direction: column; padding: 16px; }
canvas#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.brand { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.5px; }
.dot { color: var(--accent); margin: 0 4px; }
.stats { display: flex; gap: 12px; align-items: center; font-size: 0.85rem; font-weight: 600; }
.level-box { display: flex; flex-direction: column; width: 70px; }
.xp-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.xp-bar div { height: 100%; background: linear-gradient(90deg, var(--accent), #a78bfa); width: 0%; transition: width 0.5s ease; }
.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.lc { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 6px; text-align: center; cursor: pointer; transition: transform 0.2s, background 0.2s; }
.lc:hover { transform: translateY(-2px); background: rgba(255,255,255,0.1); border-color: var(--accent); }
.lg { font-size: 1.6rem; display: block; margin-bottom: 4px; color: var(--c); }
.ln { font-size: 0.7rem; color: rgba(255,255,255,0.5); }
#back-btn { align-self: flex-start; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.card-wrap { perspective: 800px; margin: 20px auto; width: 200px; height: 260px; }
.card { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; cursor: pointer; }
.card.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(160deg, rgba(30,41,59,0.9), rgba(15,23,42,0.95)); border: 1px solid var(--border); border-radius: 16px; backface-visibility: hidden; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.face.back { transform: rotateY(180deg); }
.num { font-size: 1.2rem; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.glyph { font-size: 3.5rem; color: var(--text); line-height: 1; margin-bottom: 12px; }
.icon { font-size: 1.8rem; }
.b-name { font-size: 1.4rem; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.b-phon { font-size: 0.9rem; color: rgba(255,255,255,0.6); margin-bottom: 12px; }
.b-mean { font-size: 0.85rem; text-align: center; color: rgba(255,255,255,0.8); }
.flap-btn { align-self: center; background: linear-gradient(135deg, var(--accent), #3b82f6); color: #0f172a; border: none; padding: 10px 20px; border-radius: 99px; font-weight: 700; margin: 16px 0; cursor: pointer; box-shadow: 0 4px 12px rgba(56,189,248,0.3); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: auto; }
.choice { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align: center; cursor: pointer; transition: 0.2s; }
.choice:hover { background: rgba(255,255,255,0.12); border-color: var(--accent); }
.choice span:first-child { display: block; font-weight: 600; font-size: 0.9rem; }
.choice span:last-child { display: block; font-size: 0.75rem; color: rgba(255,255,255,0.6); margin-top: 2px; }
.reveal-info { text-align: center; padding: 12px; background: rgba(255,255,255,0.05); border-radius: 10px; margin-top: 12px; font-size: 0.85rem; opacity: 0; transform: translateY(10px); transition: 0.3s; color: rgba(255,255,255,0.7); }
.reveal-info.show { opacity: 1; transform: translateY(0); }
.bottom { display: flex; justify-content: space-between; padding: 16px 0 8px; }
.pill { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 99px; font-size: 0.85rem; cursor: pointer; }
.pill.ghost { color: rgba(255,255,255,0.5); }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: rgba(15,23,42,0.9); color: #fff; padding: 8px 16px; border-radius: 99px; font-size: 0.85rem; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 60; border: 1px solid var(--border); white-space: nowrap; }
#pause-overlay { position: fixed; inset: 0; background: rgba(11,15,25,0.85); display: flex; align-items: center; justify-content: center; z-index: 100; color: var(--text); font-size: 1.2rem; font-weight: 600; visibility: hidden; backdrop-filter: blur(4px); }
#bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 10%, #1e293b 0%, #0b0f19 70%); }
@media (max-width: 380px) { .grid { grid-template-columns: repeat(3, 1fr); } .card-wrap { width: 160px; height: 210px; } .glyph { font-size: 2.8rem; } }
