:root {
  --bg: #FFF8F0;
  --bg-soft: #FFEFDE;
  --card: #FFFFFF;
  --ink: #2D2A26;
  --ink-soft: #7A7269;
  --orange: #FF8B5E;
  --orange-deep: #F26B3A;
  --teal: #2EC4B6;
  --teal-deep: #1B9E92;
  --amber: #FFB347;
  --green: #4CAF7D;
  --pink: #FF6B9D;
  --purple: #9B8CFF;
  --shadow: 0 8px 24px rgba(45, 42, 38, 0.08);
  --shadow-lg: 0 16px 40px rgba(45, 42, 38, 0.14);
  --radius: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI Rounded", "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 18px 40px;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input {
  font-family: inherit;
}

/* ---------- Home ---------- */

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.mascot {
  font-size: 46px;
  line-height: 1;
}

.greeting h1 {
  font-size: 22px;
  margin: 0 0 2px;
}

.greeting p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.icon-btn {
  background: var(--card);
  border-radius: 16px;
  width: 44px;
  height: 44px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.icon-btn:active { transform: scale(0.92); }

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  font-size: 14px;
}

.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.mode-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 148px;
}
.mode-card:active { transform: scale(0.96); }

.mode-card.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: auto; }

.mode-card .emoji { font-size: 30px; }
.mode-card .title { font-weight: 800; font-size: 16px; }
.mode-card .desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
.mode-card .level-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-top: auto;
}

.card-1 .level-tag { background: #FFE3D3; color: var(--orange-deep); }
.card-2 .level-tag { background: #D8F5F1; color: var(--teal-deep); }
.card-3 .level-tag { background: #FDE8C8; color: #B4740E; }
.card-4 .level-tag { background: #F1EBFF; color: #6C56E0; }

.secondary-btn {
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  color: var(--ink);
}

/* ---------- Session ---------- */

.session-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.dots {
  display: flex;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #EFE6DA;
}
.dot.done { background: var(--teal); }
.dot.current { background: var(--orange); transform: scale(1.3); }

.problem-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 34px 24px;
  text-align: center;
  margin-bottom: 18px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  animation: pop-in .25s ease;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.problem-text {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 1px;
}

.answer-input {
  font-size: 30px;
  text-align: center;
  width: 140px;
  margin: 0 auto;
  padding: 10px 8px;
  border-radius: 16px;
  border: 3px solid var(--bg-soft);
  background: var(--bg);
  color: var(--ink);
  font-weight: 700;
}
.answer-input:focus { border-color: var(--orange); }
.answer-input.shake { animation: shake .35s; }

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

.big-btn {
  background: var(--orange);
  color: white;
  font-weight: 800;
  font-size: 17px;
  padding: 16px;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(255, 139, 94, 0.35);
  transition: transform .12s ease;
}
.big-btn:active { transform: scale(0.97); }
.big-btn.teal { background: var(--teal); box-shadow: 0 10px 24px rgba(46, 196, 182, 0.35); }
.big-btn.ghost { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.feedback {
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.5;
  animation: pop-in .2s ease;
}
.feedback.correct { background: #E4F7ED; color: #2C7A50; font-weight: 700; }
.feedback.hint { background: #FFF3DF; color: #8A5A0B; }
.feedback.reveal { background: #FFE9EC; color: #B23A55; }

.column-wrap {
  display: flex;
  justify-content: center;
}

.column-grid {
  font-variant-numeric: tabular-nums;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 30px;
  font-weight: 700;
  text-align: right;
  display: inline-block;
}
.column-row { display: flex; justify-content: flex-end; gap: 6px; }
.column-op { width: 24px; text-align: left; color: var(--orange-deep); }
.column-num { min-width: 90px; }
.column-line { border-top: 3px solid var(--ink); margin: 4px 0; }

.verify-box {
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 14px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* ---------- Summary ---------- */

.summary-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 30px 22px;
  text-align: center;
}
.summary-emoji { font-size: 54px; margin-bottom: 6px; }
.summary-stats {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 18px 0;
}
.stat-block .num { font-size: 24px; font-weight: 800; color: var(--orange-deep); }
.stat-block .label { font-size: 11px; color: var(--ink-soft); }

.levelup-banner {
  background: linear-gradient(135deg, var(--purple), var(--teal));
  color: white;
  border-radius: 16px;
  padding: 12px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ---------- Stats ---------- */

.stats-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.stats-section h3 { margin: 0 0 12px; font-size: 15px; }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 90px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar { width: 100%; background: var(--teal); border-radius: 6px 6px 0 0; min-height: 3px; }
.bar-day { font-size: 10px; color: var(--ink-soft); }

.weak-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.weak-list li { display: flex; justify-content: space-between; font-size: 14px; background: var(--bg-soft); border-radius: 10px; padding: 8px 12px; }

.settings-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.settings-row label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.settings-row input[type=text] {
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--bg-soft);
  font-size: 15px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.top-nav h2 { margin: 0; font-size: 18px; }

.danger-btn {
  background: #FFE9EC;
  color: #B23A55;
  font-weight: 700;
  padding: 12px;
  border-radius: 14px;
  font-size: 13px;
}

.spacer { flex: 1; }
