
:root {
  --bg: #0f172a;
  --panel: rgba(255,255,255,0.94);
  --text: #111827;
  --muted: #64748b;
  --accent: #0ea5e9;
  --accent2: #22c55e;
  --danger: #ef4444;
  --radius: 22px;
  --shadow: 0 20px 60px rgba(0,0,0,0.22);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(14,165,233,0.38), transparent 28%),
    radial-gradient(circle at 80% 20%, rgba(34,197,94,0.32), transparent 30%),
    linear-gradient(135deg, #0f172a 0%, #172554 52%, #052e16 100%);
  color: var(--text);
  min-height: 100vh;
}

.app-shell { width: min(1180px, 94vw); margin: 0 auto; padding: 24px 0 48px; }

.hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; color: white; padding: 22px 8px 28px;
}

.eyebrow {
  margin: 0 0 8px; color: #bae6fd; letter-spacing: 0.14em;
  font-weight: 700; font-size: 13px;
}

h1 { margin: 0; font-size: clamp(34px, 6vw, 64px); line-height: 1; letter-spacing: -0.05em; }
.lead { font-size: 17px; color: #dbeafe; margin: 14px 0 0; }

.player-card {
  min-width: 230px; display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.24);
  border-radius: 20px; padding: 14px; backdrop-filter: blur(10px);
}
.avatar {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 16px; background: linear-gradient(135deg, #38bdf8, #22c55e);
  font-size: 28px; font-weight: 900;
}
.small-label { margin: 0 0 4px; font-size: 12px; color: #dbeafe; }

.layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.main-panel { min-height: 680px; }

.mode-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.tab, button, select { font: inherit; }
.tab {
  border: 0; border-radius: 14px; padding: 12px 10px;
  background: #e2e8f0; font-weight: 800; cursor: pointer;
}
.tab.active { background: linear-gradient(135deg, #0ea5e9, #22c55e); color: white; }

.battle-top {
  display: flex; justify-content: space-between; gap: 18px; align-items: center;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 18px;
  padding: 16px; margin-bottom: 16px;
}
.stage-label { margin: 0 0 4px; color: var(--accent); font-weight: 900; }
h2, h3 { margin-top: 0; }
h2 { font-size: 28px; margin-bottom: 6px; }

.hp-box { width: min(300px, 45%); color: #475569; font-size: 13px; font-weight: 700; }
.hp-bar { height: 14px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 6px 0; }
.hp-bar div {
  height: 100%; width: 100%; background: linear-gradient(90deg, #22c55e, #f59e0b);
  transition: width .25s ease;
}

.question-card { background: white; border: 2px solid #e2e8f0; border-radius: 22px; padding: 22px; }
.question-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; color: #64748b; font-weight: 800; font-size: 13px; }
.kobun { font-size: clamp(24px, 4vw, 40px); font-weight: 900; margin: 10px 0; line-height: 1.35; color: #0f172a; }
.question { font-size: 18px; color: #334155; font-weight: 700; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px; }
.choice {
  border: 2px solid #dbeafe; background: #f8fafc; border-radius: 16px;
  padding: 16px; cursor: pointer; text-align: left; font-weight: 900;
  transition: transform .08s ease, border-color .12s ease;
}
.choice:hover { transform: translateY(-1px); border-color: #38bdf8; }
.choice.correct { background: #dcfce7; border-color: #22c55e; }
.choice.wrong { background: #fee2e2; border-color: #ef4444; }

.result-box { margin-top: 16px; padding: 16px; border-radius: 18px; background: #eff6ff; border: 1px solid #bfdbfe; }
.result-box.good { background: #ecfdf5; border-color: #86efac; }
.result-box.bad { background: #fff7ed; border-color: #fdba74; }

.action-row { display: flex; gap: 12px; margin-top: 16px; }
.primary-btn, .danger-btn {
  border: 0; border-radius: 16px; padding: 13px 18px; cursor: pointer; font-weight: 900;
}
.primary-btn { background: linear-gradient(135deg, #0ea5e9, #22c55e); color: white; }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.danger-btn { background: #fee2e2; color: #991b1b; width: 100%; margin-top: 18px; }

.stats, .materials { display: grid; gap: 10px; margin-bottom: 22px; }
.stats div, .materials div {
  display: flex; justify-content: space-between; padding: 12px;
  border-radius: 14px; background: #f8fafc; border: 1px solid #e2e8f0;
}
.stats span, .materials span { color: #64748b; font-weight: 700; }
.stats b, .materials b { font-size: 20px; }
.select { width: 100%; border: 1px solid #cbd5e1; border-radius: 14px; padding: 12px; background: white; font-weight: 800; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.village-grid, .library-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.building, .library-card, .review-card { background: white; border: 1px solid #e2e8f0; border-radius: 18px; padding: 16px; }
.building.locked { filter: grayscale(1); opacity: .62; }
.building h4, .library-card h4, .review-card h4 { margin: 0 0 8px; font-size: 18px; }
.unlock-btn {
  width: 100%; margin-top: 10px; border: 0; border-radius: 14px; padding: 10px;
  background: #0ea5e9; color: white; font-weight: 900; cursor: pointer;
}
.unlock-btn:disabled { background: #cbd5e1; cursor: not-allowed; }
.review-list { display: grid; gap: 12px; margin-top: 16px; }
.badge {
  display: inline-block; border-radius: 999px; padding: 4px 9px;
  font-size: 12px; font-weight: 900; background: #e0f2fe; color: #075985;
}

@media (max-width: 900px) {
  .hero { flex-direction: column; align-items: stretch; }
  .layout { grid-template-columns: 1fr; }
  .choices { grid-template-columns: 1fr; }
  .hp-box { width: 100%; }
  .battle-top { flex-direction: column; align-items: stretch; }
  .village-grid, .library-grid { grid-template-columns: 1fr; }
  .mode-tabs { grid-template-columns: repeat(2, 1fr); }
}
