:root {
  --bg: #f4efe7;
  --bg-strong: #ece4d6;
  --card: #fffdf8;
  --line: #d9ccb9;
  --text: #2f281f;
  --muted: #6f6256;
  --accent: #2f6d62;
  --positive: #46734a;
  --warning: #9a5f2b;
  --shadow: 0 18px 40px rgba(66, 44, 24, 0.1);
  --radius: 24px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(101, 164, 151, 0.18), transparent 28%),
    linear-gradient(180deg, #fbf8f2 0%, var(--bg) 100%);
}
body { padding: 18px; }
button, input, textarea, select { font: inherit; }
.app-shell { width: min(100%, 920px); margin: 0 auto; display: grid; gap: 14px; }
.hero, .panel { background: rgba(255, 253, 248, 0.94); border: 1px solid rgba(128, 108, 84, 0.14); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero { padding: 24px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: auto -40px -40px auto; width: 180px; height: 180px; border-radius: 999px; background: radial-gradient(circle, rgba(47, 109, 98, 0.12), transparent 66%); }
.eyebrow { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 800; }
.hero h1 { margin: 0; font-size: clamp(32px, 7vw, 52px); line-height: 0.95; letter-spacing: -0.05em; }
.hero-copy { max-width: 680px; margin: 12px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.tab-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tab-button { border: 0; border-radius: 999px; padding: 14px 16px; background: rgba(255, 253, 248, 0.88); border: 1px solid rgba(128, 108, 84, 0.14); color: var(--muted); font-weight: 800; cursor: pointer; }
.tab-button.active { background: var(--accent); color: #fff; }
.panel { padding: 20px; display: none; gap: 16px; }
.panel.active { display: grid; }
.panel-head, .options-row, .toolbar, .section-title-row, .study-meta { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.panel-head { align-items: flex-start; }
.panel-head h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.04em; }
.panel-head p, .subtle-text, .example-text { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.status-pill, .mini-stat { background: var(--bg-strong); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; color: var(--muted); font-size: 13px; min-width: 120px; }
.mini-stat strong { display: block; margin-top: 4px; color: var(--text); font-size: 20px; }
.field { display: grid; gap: 8px; }
.field span { font-size: 13px; font-weight: 700; color: var(--muted); }
textarea, input, select { width: 100%; border: 1px solid var(--line); border-radius: 18px; background: #fff; color: var(--text); padding: 14px 16px; }
textarea { resize: vertical; min-height: 220px; line-height: 1.6; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.checkbox-row { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; width: 100%; }
.checkbox-row input { flex: 0 0 auto; }
.checkbox-row span { flex: 1 1 auto; min-width: 0; white-space: normal; word-break: keep-all; line-height: 1.5; }
.button { border: 0; border-radius: 18px; padding: 14px 18px; font-weight: 800; cursor: pointer; min-height: 48px; }
.button.primary { background: var(--accent); color: #fff; }
.button.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.button.positive { background: var(--positive); color: #fff; }
.button.warning { background: var(--warning); color: #fff; }
.button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.file-button { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.hint-box, .empty-card, .preview-card, .review-card { border-radius: 20px; border: 1px solid var(--line); }
.hint-box { background: linear-gradient(180deg, #f7f4ee 0%, #f1e9dc 100%); padding: 16px; }
.hint-box strong { display: block; margin-bottom: 6px; }
.hint-box p, .flash-example { margin: 0; color: var(--muted); line-height: 1.6; font-size: 14px; }
.preview-list, .review-list, .bundle-list { display: grid; gap: 12px; }
.preview-card, .review-card, .bundle-card { padding: 16px; background: #fff; }
.preview-top, .review-top, .bundle-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.preview-top strong, .review-top strong { font-size: 20px; letter-spacing: -0.03em; }
.bundle-top strong { font-size: 18px; letter-spacing: -0.03em; }
.korean-text { margin: 0 0 6px; color: var(--text); font-weight: 700; }
.bundle-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.button.small { min-height: 40px; padding: 10px 14px; border-radius: 14px; font-size: 13px; }
.button.danger { background: #8f4a43; color: #fff; }
.empty-state, .empty-card { padding: 24px; text-align: center; color: var(--muted); background: rgba(255, 255, 255, 0.78); }
.study-card-section.hidden, .hidden { display: none; }
.study-card-section { display: grid; gap: 14px; }
.flash-card { position: relative; min-height: 320px; border-radius: 28px; border: 1px solid var(--line); overflow: hidden; background: linear-gradient(180deg, #fffefb 0%, #f7f0e4 100%); }
.flash-side { position: absolute; inset: 0; padding: 28px; display: grid; align-content: center; justify-items: center; text-align: center; gap: 10px; opacity: 0; pointer-events: none; transform: scale(0.98); transition: opacity 180ms ease, transform 180ms ease; }
.flash-side.active { opacity: 1; pointer-events: auto; transform: scale(1); }
.flash-label { margin: 0; text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; font-weight: 800; color: var(--accent); }
.flash-side h3 { margin: 0; font-size: clamp(32px, 7vw, 52px); line-height: 1; letter-spacing: -0.05em; }
.flash-korean { margin: 0; font-size: 24px; font-weight: 800; }
.study-actions { justify-content: center; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: rgba(37, 31, 24, 0.92); color: #fff; padding: 12px 16px; border-radius: 999px; font-size: 13px; z-index: 100; }
.sheet-card-list { display: grid; gap: 12px; }
.sheet-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: grid; gap: 10px; }
.sheet-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sheet-card-word { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.sheet-card-label { margin: 0 0 4px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.sheet-card-value { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text); }
.sheet-card-actions { display: flex; justify-content: flex-end; }

/* Vocabulary toolbar */
.vocab-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-strong); }
.vocab-check-all { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; flex-shrink: 0; }

/* Vocabulary list */
.vocab-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: #fff; }
.vocab-row { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.vocab-row:last-child { border-bottom: 0; }
.vocab-main { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.vocab-check { flex-shrink: 0; width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); }
.vocab-check-all input { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); }
.vocab-en { font-size: 19px; font-weight: 800; letter-spacing: -0.03em; flex: 1; color: var(--text); }
.vocab-ko { font-size: 14px; font-weight: 700; color: var(--accent); background: rgba(47,109,98,0.08); padding: 2px 8px; border-radius: 999px; flex-shrink: 0; }
.vocab-ex { margin: 0 0 0 32px; font-size: 13px; color: var(--muted); line-height: 1.6; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg-strong); color: var(--muted); }
.badge.known { background: rgba(70, 115, 74, 0.15); color: var(--positive); }
.badge.unknown { background: rgba(154, 95, 43, 0.15); color: var(--warning); }

/* Vocab inline edit */
.vocab-edit-btn { margin-left: auto; flex-shrink: 0; }
.vocab-edit-wrap { padding: 2px 0; }
.vocab-en-edit { margin: 0 0 10px; font-size: 19px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.vocab-edit-fields { display: grid; gap: 8px; margin-bottom: 10px; }
.vocab-edit-fields input { border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.vocab-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }

.study-actions { flex-wrap: wrap; gap: 10px; }
.study-actions .button { flex: 1 1 auto; min-width: 80px; }
@media (max-width: 720px) {
  body { padding: 12px; }
  .hero, .panel { padding: 16px; border-radius: 22px; }
  .grid.two, .tab-bar { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; }
  .flash-card { min-height: 280px; }
  .flash-side { padding: 22px; }
}
