:root {
  color-scheme: light dark;
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-2: #eef4ef;
  --text: #18231f;
  --muted: #60706a;
  --primary: #3f7d68;
  --primary-2: #d9ece4;
  --warn: #b45a3c;
  --line: #dce5df;
  --shadow: 0 10px 30px rgba(20, 48, 38, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111816;
    --surface: #1a2420;
    --surface-2: #22312c;
    --text: #ecf4f0;
    --muted: #a9b8b2;
    --primary: #79c5a6;
    --primary-2: #263d34;
    --warn: #f09a7e;
    --line: #31423b;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

.view {
  padding: 18px 16px 24px;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  margin: 18px 0 10px;
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  min-height: 94px;
}

.metric b {
  display: block;
  font-size: 25px;
  margin-top: 8px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row.wrap {
  flex-wrap: wrap;
}

.spread {
  justify-content: space-between;
}

.btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--surface);
  color: var(--text);
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn.tonal {
  background: var(--primary-2);
  border-color: transparent;
  color: var(--text);
}

.btn.warn {
  border-color: var(--warn);
  color: var(--warn);
}

.btn:disabled {
  opacity: 0.55;
}

.progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-2);
}

.progress span {
  display: block;
  height: 100%;
  width: var(--value);
  background: var(--primary);
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
}

.item-title {
  font-weight: 700;
  line-height: 1.35;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 10px;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  width: min(720px, 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.tab {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--primary-2);
  color: var(--text);
  font-weight: 700;
}

.field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--text);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.dialog {
  width: min(94vw, 560px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
}

.dialog-body {
  padding: 16px;
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-2);
}

.seg button {
  border: 0;
  border-radius: 7px;
  min-height: 38px;
  background: transparent;
  color: var(--muted);
}

.seg button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.study-word {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.25;
  margin: 16px 0;
}

.answer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.bars {
  height: 190px;
  display: flex;
  align-items: end;
  gap: 8px;
}

.bar {
  flex: 1;
  display: grid;
  align-items: end;
  gap: 5px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.bar i {
  display: block;
  min-height: 10px;
  border-radius: 6px 6px 0 0;
  background: var(--primary);
}
