:root {
  --ink: #10251f;
  --paper: #f8fbf4;
  --leaf: #4ade80;
  --aqua: #67e8f9;
  --gold: #facc15;
  --wrong: #fb7185;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; touch-action: manipulation; }

body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'Outfit', 'M PLUS Rounded 1c', sans-serif;
  color: var(--paper);
  background:
    radial-gradient(circle at 18% 12%, rgba(74, 222, 128, 0.22), transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(103, 232, 249, 0.2), transparent 28%),
    linear-gradient(145deg, #10251f, #15332e 54%, #263f36);
}

#app { width: 100%; min-height: 100vh; display: flex; justify-content: center; padding: 16px; }
.back-link {
  position: fixed; top: 15px; left: 15px; z-index: 20;
  padding: 8px 14px; border: 1px solid rgba(248, 251, 244, 0.28); border-radius: 999px;
  color: var(--paper); background: rgba(16, 37, 31, 0.72); text-decoration: none; font-weight: 900; font-size: 0.78rem; backdrop-filter: blur(12px);
}

.app-shell { width: min(520px, 100%); min-height: calc(100vh - 32px); display: flex; flex-direction: column; justify-content: center; gap: 14px; padding-top: 40px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.eyebrow { color: var(--gold); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.12em; }
h1 { font-size: 2.55rem; line-height: 1; font-weight: 900; letter-spacing: 0; }
h1 span { color: var(--leaf); }
.wallet { min-width: 118px; padding: 10px 12px; border: 1px solid rgba(103, 232, 249, 0.28); border-radius: 8px; background: rgba(255,255,255,0.07); text-align: right; }
.wallet span, .stats span, .category { display: block; color: rgba(255,255,255,0.66); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.08em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { padding: 10px 8px; border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; background: rgba(255,255,255,0.06); text-align: center; }
.stats b { display: block; margin-top: 3px; font-size: 1.15rem; }

.quiz-card, .mini-guide {
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.11), rgba(255,255,255,0.045));
  box-shadow: 0 22px 42px rgba(0,0,0,0.24);
}

.quiz-card { min-height: 374px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.category { color: var(--aqua); }
h2 { font-size: 1.38rem; line-height: 1.25; letter-spacing: 0; }
.answers { display: grid; gap: 9px; margin-top: auto; }
.answers button, .actions button {
  border: 0; border-radius: 8px; min-height: 54px; padding: 11px 12px;
  color: var(--ink); background: var(--paper); font-family: inherit; font-size: 0.9rem; font-weight: 900;
  box-shadow: 0 8px 0 rgba(0,0,0,0.24);
}
.answers button.correct { background: var(--leaf); }
.answers button.wrong { background: var(--wrong); color: #fff; }
.answers button:disabled { opacity: 0.82; }
#explain { min-height: 46px; color: rgba(255,255,255,0.78); font-size: 0.94rem; line-height: 1.45; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions button:first-child { background: var(--gold); }
.actions button:disabled { opacity: 0.48; box-shadow: none; }
.mini-guide { padding: 14px 16px; }
.mini-guide h2 { font-size: 1.05rem; margin-bottom: 6px; }
.mini-guide p { color: rgba(255,255,255,0.76); font-size: 0.88rem; line-height: 1.55; }

@media (max-width: 520px) {
  #app { padding: 12px; }
  .app-shell { min-height: calc(100vh - 24px); gap: 11px; }
  h1 { font-size: 2rem; }
  .topbar { align-items: stretch; }
  .wallet { min-width: 106px; }
  .quiz-card { min-height: 350px; padding: 14px; }
  h2 { font-size: 1.16rem; }
  .actions button, .answers button { min-height: 50px; }
}
