:root {
  --bg: #F8F8FF;
  --card: #ffffff;
  --primary: #FF5C00;
  --primary-dark: #E05200;
  --accent: #1E1B5E;
  --accent-dark: #16144A;
  --good: #00A878;
  --good-dark: #007A58;
  --bad: #e74c3c;
  --bad-dark: #c0392b;
  --ink: #111111;
  --muted: #6B7280;
  --border: #E8E8F0;
  --shadow: 0 4px 16px rgba(30, 27, 94, 0.08);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ── Hero header ──────────────────────────────────────────────── */
header.hero {
  position: relative;
  text-align: center;
  margin-bottom: 28px;
  padding: 32px 18px 26px;
  border-radius: 22px;
  overflow: hidden;
  background: #1E1B5E;
  box-shadow: 0 8px 32px rgba(30, 27, 94, 0.28);
}
.hero-title {
  position: relative;
  margin: 0 0 10px;
  font-size: 38px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.5px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
}
.hero-title .title-en {
  color: #FFFFFF;
  font-weight: 800;
}
.hero-title .title-zh {
  font-size: 30px;
  font-weight: 700;
  color: #FF5C00;
}
header.hero .sub {
  position: relative;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  font-weight: 500;
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.5;
}
@media (max-width: 480px) {
  .hero-title { font-size: 30px; gap: 8px; }
  .hero-title .title-zh { font-size: 24px; }
  header.hero .sub { font-size: 13px; }
}

.top-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  flex-wrap: wrap;
}
.top-who { font-weight: 600; color: rgba(255, 255, 255, 0.95); }
.link-btn {
  background: none;
  border: none;
  color: #FF5C00;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  padding: 0;
}
.link-btn:hover { color: var(--primary-dark); }
.top-bar .link-btn { color: rgba(255, 255, 255, 0.8); }
.top-bar .link-btn:hover { color: #ffffff; }
.top-bar .upgrade-link { color: #FF5C00 !important; }
.top-bar .upgrade-link:hover { color: #FF7A30 !important; }
.back-link { display: inline-block; margin-bottom: 10px; color: var(--accent); }
.muted-inline { color: var(--muted); font-weight: 400; font-size: 12px; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 16px;
}

.screen-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-bottom: 4px;
}
.screen-head h2 { margin: 0; }

/* ── Tabs ────────────────────────────────────────────────────────── */
.tab-row { display: flex; gap: 8px; margin-bottom: 18px; }
.tab-row.small { margin-bottom: 12px; }
.tab {
  flex: 1; padding: 10px 12px; border-radius: 10px;
  border: 2px solid var(--border); background: white;
  font: inherit; cursor: pointer; font-weight: 600; color: var(--muted);
}
.tab.active { border-color: var(--primary); color: var(--primary-dark); background: #FFF5F0; }

.tab-pane h2 { margin-top: 0; font-size: 20px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.field input {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 2px solid var(--border); border-radius: 10px;
  background: #fafafa; font-family: inherit; outline: none;
  transition: border-color 0.15s;
}
.field input:focus { border-color: var(--accent); background: white; }
.err {
  background: #fdf2f0; color: var(--bad); border: 1px solid #f4cbc4;
  padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: 14px;
}

/* ── Children ────────────────────────────────────────────────────── */
.children-list { display: grid; gap: 10px; margin-bottom: 16px; }
.child-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 2px solid var(--border); border-radius: 12px;
  background: white;
  transition: all 0.15s;
}
.child-row .name { flex: 1; font-size: 17px; font-weight: 600; }
.child-row .meta { font-size: 12px; color: var(--muted); }
.child-row .actions { display: flex; gap: 8px; }
.child-row button { font-size: 13px; padding: 10px 14px; min-height: 44px; border-radius: 8px; border: none; cursor: pointer; font-family: inherit; }
.child-row .open { background: var(--primary); color: white; font-weight: 600; }
.child-row .open:hover { background: var(--primary-dark); }
.child-row .del { background: transparent; color: var(--bad); border: 1px solid #f4cbc4; }
.child-row .del:hover { background: #fdf2f0; }

.add-child-form { padding-top: 14px; border-top: 1px dashed var(--border); margin-top: 8px; }

/* ── Lists ───────────────────────────────────────────────────────── */
.lists-container { display: grid; gap: 10px; margin: 16px 0 22px; }
.list-card {
  border: 2px solid var(--border); border-radius: 12px;
  padding: 14px 16px; background: white;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.list-card .info { flex: 1; min-width: 0; }
.list-card .info .title { font-weight: 600; font-size: 16px; }
.list-card .info .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.list-card .actions button { font-size: 13px; padding: 10px 14px; min-height: 44px; border-radius: 8px; border: none; cursor: pointer; font-family: inherit; }
.list-card .actions .review { background: var(--accent); color: white; font-weight: 600; }
.list-card .actions .review:hover { background: var(--accent-dark); }
.list-card .actions .del { background: transparent; color: var(--bad); border: 1px solid #f4cbc4; }
.list-card .actions .del:hover { background: #fdf2f0; }

.empty-state {
  padding: 24px; text-align: center; color: var(--muted);
  border: 2px dashed var(--border); border-radius: 12px;
  background: #fafafa;
}

.upload-block { padding-top: 18px; border-top: 1px solid var(--border); }
.upload-block h3 { margin: 0 0 10px; font-size: 17px; }
.hint-text { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.input-pane { margin-top: 6px; }

.upload-drop {
  display: flex; padding: 32px 20px; text-align: center;
  border: 2px dashed var(--border); border-radius: 16px;
  background: #fafafa; cursor: pointer; color: var(--muted);
  font-weight: 600; transition: all 0.15s;
  margin-bottom: 10px;
  min-height: 120px;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 8px;
  -webkit-tap-highlight-color: rgba(255, 92, 0, 0.10);
}
.upload-drop:hover, .upload-drop:focus-within {
  border-color: var(--primary); color: var(--primary-dark); background: #FFF5F0;
}
.upload-icon { font-size: 36px; line-height: 1; }

.preview-wrap { margin: 12px 0; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.preview-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border);
  aspect-ratio: 3/4;
  background: #f0f0f0;
}
.preview-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.preview-thumb .remove-thumb {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.55); color: white;
  border: none; border-radius: 99px;
  width: 26px; height: 26px; font-size: 14px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.preview-thumb .page-badge {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.5); color: white;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px;
  white-space: nowrap;
}
.preview-actions {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  margin-top: 4px;
}
.danger-link { color: var(--bad) !important; }

textarea#textInput {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 2px solid var(--border); border-radius: 10px;
  background: #fafafa; font-family: inherit; outline: none;
  transition: border-color 0.15s; resize: vertical;
  margin-bottom: 12px; line-height: 1.5;
}
textarea#textInput:focus { border-color: var(--accent); background: white; }

.upload-status {
  background: #EEEEF8; color: var(--accent-dark);
  border: 1px solid #C8C8EC; padding: 10px 12px;
  border-radius: 10px; margin-top: 10px; font-size: 14px;
  display: flex; align-items: center; gap: 10px;
}
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid #C8C8EC; border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Summary screen ──────────────────────────────────────────────── */
.review-banner {
  background: #FFF5F0;
  border: 2px solid #FECDB5;
  border-radius: 14px;
  padding: 16px 18px;
  margin: 6px 0 4px;
}
.review-banner-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; color: var(--primary-dark); margin-bottom: 6px;
}
.review-banner-head .review-icon { font-size: 22px; }
.review-banner-text { font-size: 14px; color: #7A3A10; line-height: 1.45; }
.review-banner-text em { font-style: normal; font-weight: 700; color: var(--primary-dark); }

.summary-words { display: grid; gap: 10px; margin: 14px 0; }
.summary-word {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  background: white;
}
.summary-word .top {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.summary-word .top .num { color: var(--muted); font-size: 13px; min-width: 22px; }
.summary-word .top .hanzi { font-size: 22px; font-weight: 600; letter-spacing: 2px; }
.summary-word .top .pinyin { color: var(--muted); font-style: italic; font-size: 14px; }
.summary-word .top .lang-tag {
  font-size: 10px; padding: 2px 6px; border-radius: 99px;
  background: #EEEEF8; color: var(--accent-dark); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 700;
}
.summary-word .top .lang-tag.en { background: #FFF0E8; color: var(--primary-dark); }
.summary-word .top .top-actions {
  margin-left: auto;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.summary-word .top .top-actions button {
  background: none; border: 1px solid var(--border); color: var(--ink);
  border-radius: 99px; padding: 3px 10px; font-size: 12px;
  cursor: pointer; font-family: inherit; font-weight: 600;
}
.summary-word .top .top-actions .speak { border-color: var(--accent); color: var(--accent-dark); }
.summary-word .top .top-actions .speak:hover { background: var(--accent); color: white; }
.summary-word .top .top-actions .edit { border-color: var(--primary); color: var(--primary-dark); }
.summary-word .top .top-actions .edit:hover { background: var(--primary); color: white; }
.summary-word .top .top-actions .del { border-color: #f4cbc4; color: var(--bad); }
.summary-word .top .top-actions .del:hover { background: var(--bad); color: white; border-color: var(--bad); }

.summary-word.editing { background: #FFF5F0; border-color: var(--primary); }
.summary-word .edit-form { margin-top: 12px; display: grid; gap: 10px; }
.summary-word .edit-form label { font-size: 12px; color: var(--muted); font-weight: 600; }
.summary-word .edit-form input {
  width: 100%; padding: 10px 12px; font-size: 18px;
  border: 2px solid var(--border); border-radius: 10px;
  background: white; font-family: inherit; outline: none;
}
.summary-word .edit-form input:focus { border-color: var(--primary); }
.summary-word .edit-form .btn-row { gap: 8px; }
.summary-word .edit-form .btn { padding: 10px 16px; font-size: 14px; }
.summary-word .edit-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--accent-dark);
}
.summary-word .edit-err { color: var(--bad); font-size: 13px; }
.summary-word .meaning-text { font-size: 14px; color: #333; margin-top: 8px; }
.summary-word .meaning-text strong { color: var(--accent-dark); }
.summary-word .ex {
  background: #fafafa; border-left: 3px solid var(--primary);
  padding: 8px 12px; border-radius: 8px; margin-top: 8px;
}
.summary-word .ex .ex-zh { font-size: 16px; line-height: 1.4; }
.summary-word .ex .ex-py { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 2px; }
.summary-word .ex .ex-en { font-size: 13px; color: #555; margin-top: 2px; }

/* ── Practice options ────────────────────────────────────────────── */
.field-group { margin-bottom: 18px; }
.field-group .label { font-weight: 600; margin-bottom: 8px; display: block; }
.option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 2px solid var(--border); border-radius: 12px;
  cursor: pointer; margin-bottom: 8px; transition: all 0.15s;
}
.option:hover { border-color: var(--primary); background: #FFF5F0; }
.option input { accent-color: var(--primary); transform: scale(1.2); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  border: none; border-radius: 12px; padding: 14px 22px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  transition: transform 0.05s, box-shadow 0.15s, background 0.15s;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover:not(:disabled) { background: var(--accent-dark); }
.btn-good { background: var(--good); color: white; }
.btn-good:hover:not(:disabled) { background: var(--good-dark); }
.btn-bad { background: var(--bad); color: white; }
.btn-bad:hover:not(:disabled) { background: var(--bad-dark); }
.btn-ghost { background: transparent; color: var(--muted); border: 2px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--muted); color: var(--ink); }
.btn-block { width: 100%; }
.btn-small { font-size: 13px; padding: 8px 14px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 120px; }
.btn-row.arrows .btn { padding: 10px 14px; font-size: 14px; }

/* ── Quiz screen ─────────────────────────────────────────────────── */
.quiz-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px;
}
.progress {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; font-size: 14px; color: var(--muted);
}
.progress-bar {
  height: 8px; background: var(--border); border-radius: 99px;
  overflow: hidden; margin-bottom: 18px;
}
.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0; transition: width 0.3s;
}
.quiz .play-row {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; margin-bottom: 14px;
}
.play-btn {
  width: 110px; height: 110px; border-radius: 50%;
  background: var(--accent); color: white; border: none; cursor: pointer;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(30, 27, 94, 0.30);
  transition: transform 0.1s, background 0.15s;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.play-btn:hover { background: var(--accent-dark); }
.play-btn:active { transform: scale(0.95); }
.play-btn svg { width: 36px; height: 36px; }
.play-btn.playing { background: var(--good); }
.speed-toggle { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.chip {
  padding: 8px 14px; min-height: 44px; border-radius: 99px;
  border: 1px solid var(--border); background: white;
  cursor: pointer; font-size: 13px; font-family: inherit;
}
.chip.active { background: var(--accent); color: white; border-color: var(--accent); }
.hint-row { text-align: center; margin-bottom: 14px; min-height: 24px; }
.hint-row .pinyin {
  font-style: italic; color: var(--muted);
  letter-spacing: 1px; font-size: 18px;
}
.hint-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 14px; text-decoration: underline;
  min-height: 44px; padding: 8px 12px;
  font-family: inherit;
}

.paper-prompt {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: #FFF5F0;
  border: 1px dashed #FECDB5; border-radius: 12px;
  margin-bottom: 16px;
}
.paper-prompt .paper-icon { font-size: 26px; }
.paper-prompt .paper-text { color: var(--primary-dark); font-weight: 600; font-size: 15px; }

.controls { margin-top: 14px; }

.result {
  margin-top: 16px; padding: 18px; border-radius: 12px;
  background: #F5F5FA; border: 1px solid var(--border);
}
.result .answer-label {
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px;
}
.result .answer-display {
  font-size: 36px; font-weight: 600; margin: 6px 0 4px; letter-spacing: 6px;
}
.result .pinyin-display {
  color: var(--muted); font-style: italic; margin-bottom: 12px; letter-spacing: 1px;
}
.result .meaning {
  background: white; padding: 12px 14px; border-radius: 10px;
  border-left: 4px solid var(--accent); margin-bottom: 8px;
}
.result .meaning strong { color: var(--accent-dark); }
.result .example {
  background: white; padding: 12px 14px; border-radius: 10px;
  border-left: 4px solid var(--primary); font-size: 14px; color: #333;
}
.result .example strong { color: var(--primary-dark); }
.result .example .ex-zh {
  font-size: 18px; color: var(--ink); margin: 6px 0 4px; line-height: 1.5;
}
.result .example .ex-py {
  font-style: italic; color: var(--muted);
  font-size: 13px; letter-spacing: 0.5px; margin-bottom: 4px;
}
.result .example .ex-en { color: #555; font-size: 13px; }
.result .example .ex-play {
  background: none; border: 1px solid var(--primary); color: var(--primary-dark);
  border-radius: 99px; padding: 2px 10px; font-size: 12px;
  cursor: pointer; margin-left: 6px; font-family: inherit;
}
.result .example .ex-play:hover { background: var(--primary); color: white; }

.grade-prompt {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.grade-status {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  text-align: center;
}
.grade-status.good { background: #E6FAF4; color: var(--good-dark); border: 1px solid #A3E6CE; }
.grade-status.bad { background: #fdf2f0; color: var(--bad-dark); border: 1px solid #f4cbc4; }
.grade-status .change {
  background: none; border: none; color: inherit;
  text-decoration: underline; cursor: pointer; font: inherit;
  margin-left: 8px; font-weight: 500;
}

.quiz-footer { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.quiz-footer .btn-row.arrows { margin-bottom: 10px; }

.retry-row { display: grid; gap: 10px; margin-top: 18px; }

/* ── Final summary ───────────────────────────────────────────────── */
.summary { text-align: center; }
.score-big {
  font-size: 64px; font-weight: 700;
  color: var(--primary-dark); margin: 8px 0;
}
.score-label { color: var(--muted); margin-bottom: 20px; }
.review-list {
  text-align: left; margin: 18px 0;
  border-top: 1px solid var(--border);
}
.review-item {
  padding: 12px 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.review-item .icon { font-size: 20px; flex-shrink: 0; width: 24px; }
.review-item .icon.good { color: var(--good); }
.review-item .icon.bad { color: var(--bad); }
.review-item .icon.unanswered { color: var(--muted); }
.review-item .text { flex: 1; }
.review-item .text .hanzi { font-size: 18px; font-weight: 600; }
.review-item .text .pinyin { font-size: 13px; color: var(--muted); font-style: italic; }
.review-item .text .meaning { font-size: 13px; color: #555; margin-top: 2px; }

/* ── History / progress ──────────────────────────────────────────── */
.tricky-words { display: grid; gap: 8px; margin-top: 8px; }
.tricky-word {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: white;
}
.tricky-word .w { font-size: 18px; font-weight: 600; flex: 1; }
.tricky-word .py { font-size: 13px; color: var(--muted); font-style: italic; }
.tricky-word .count {
  font-size: 12px; padding: 2px 8px; border-radius: 99px;
  background: #fdf2f0; color: var(--bad-dark); font-weight: 700;
}
.history-list { display: grid; gap: 10px; margin-top: 8px; }
.history-row {
  border: 1px solid var(--border); border-radius: 10px;
  background: white; overflow: hidden;
}
.history-row summary {
  list-style: none; cursor: pointer;
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  font-size: 14px;
}
.history-row summary::-webkit-details-marker { display: none; }
.history-row summary .when { color: var(--muted); font-size: 12px; }
.history-row summary .name { flex: 1; font-weight: 600; }
.history-row summary .score-pill {
  padding: 3px 10px; border-radius: 99px; font-weight: 700; font-size: 13px;
  background: #EEEEF8; color: var(--accent-dark);
}
.history-row summary .score-pill.good { background: #E6FAF4; color: var(--good-dark); }
.history-row summary .score-pill.bad { background: #fdf2f0; color: var(--bad-dark); }
.history-row .session-detail {
  padding: 8px 14px 14px; border-top: 1px solid var(--border);
}
.history-row .session-detail .it {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; font-size: 14px;
}
.history-row .session-detail .it .ic { width: 22px; }
.history-row .session-detail .it.good .ic { color: var(--good); }
.history-row .session-detail .it.bad .ic { color: var(--bad); }
.history-row .session-detail .it.unanswered .ic { color: var(--muted); }

.footer-note {
  text-align: center; color: var(--muted);
  font-size: 12px; margin-top: 24px;
}

/* ── Summary screen — editable title ────────────────────────────── */
.summary-title-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 2px;
}
.summary-title-row h2 { margin: 0; }
.edit-title-btn { font-size: 13px; white-space: nowrap; }
.edit-title-form {
  background: #fafafa; border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
}
.edit-title-form input[type="text"] {
  width: 100%; padding: 10px 12px; font-size: 15px;
  border: 2px solid var(--border); border-radius: 10px;
  background: white; font-family: inherit; outline: none;
  box-sizing: border-box;
}
.edit-title-form input[type="text"]:focus { border-color: var(--accent); }

/* ── List card — rename ──────────────────────────────────────────── */
.list-card .actions .rename {
  background: transparent; color: var(--accent-dark);
  border: 1px solid #C8C8EC;
}
.list-card .actions .rename:hover { background: #EEEEF8; }
.list-card .rename-form {
  width: 100%; padding: 10px 0 4px; display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center; border-top: 1px solid var(--border); margin-top: 10px;
}
.list-card .rename-form input {
  flex: 1; min-width: 140px; padding: 8px 10px; font-size: 14px;
  border: 2px solid var(--accent); border-radius: 8px;
  font-family: inherit; outline: none;
}
.list-card.renaming { flex-wrap: wrap; }

/* ── List type badge ─────────────────────────────────────────────── */
.list-type-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; margin-top: 4px;
  background: #EEEEF8; color: var(--accent-dark); letter-spacing: 0.02em;
}
#summaryTypeBadge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; margin-left: 8px;
  background: #EEEEF8; color: var(--accent-dark); vertical-align: middle;
}
#summaryTypeBadge.hidden { display: none; }

/* ── List type selector in upload block ──────────────────────────── */
.list-type-row { margin-bottom: 14px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.list-type-row .label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 6px; }
.list-type-row .option { margin: 4px 0; }

/* ── Dictation answer display ────────────────────────────────────── */
.dictation-sentence {
  font-size: 18px; font-weight: 600; line-height: 1.6;
  color: var(--ink); padding: 10px 0 6px;
  border-bottom: 2px solid var(--border);
  word-break: break-word;
}

.forgot-row { text-align: center; margin-top: 12px; }
.forgot-row .link-btn { font-size: 13px; }

/* ── Modals (overlay) ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(17, 10, 40, 0.60);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: fade-in 0.18s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: white; border-radius: 16px;
  max-width: 480px; width: 100%;
  padding: 22px 24px; box-shadow: 0 24px 60px rgba(30, 27, 94, 0.22);
  max-height: 90vh; overflow-y: auto;
  animation: pop-in 0.22s ease-out;
}
@keyframes pop-in {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1);     opacity: 1; }
}
.modal-card h3 { margin: 0 0 12px; color: var(--accent-dark); }
.modal-card p { margin: 8px 0; line-height: 1.5; font-size: 14px; }
.modal-card p em { font-style: italic; color: var(--primary-dark); }
.modal-list { padding-left: 22px; margin: 8px 0; line-height: 1.6; font-size: 14px; }
.modal-list li { margin-bottom: 6px; }
.modal-note { font-size: 13px; color: var(--muted); padding: 10px 12px; background: #fafafa; border-radius: 8px; }
.modal-card .field { margin-top: 12px; }
.modal-card textarea {
  width: 100%; padding: 10px 12px; font-size: 15px;
  border: 2px solid var(--border); border-radius: 10px;
  background: #fafafa; font-family: inherit; outline: none;
  resize: vertical; line-height: 1.5;
}
.modal-card textarea:focus { border-color: var(--accent); background: white; }
.modal-card .btn-row { margin-top: 14px; }

/* ── Plan badge ──────────────────────────────────────────────────── */
.plan-badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.75);
}
.plan-badge-premium {
  background: linear-gradient(135deg, #f5d97a, #f0b429);
  color: #7a4f00;
}
.upgrade-link { color: #FF5C00 !important; font-weight: 600; }
.upgrade-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  background: linear-gradient(135deg, #f5d97a, #f0b429);
  color: #7a4f00; padding: 1px 7px; border-radius: 10px; margin-left: 4px;
  vertical-align: middle;
}
.btn-upgrade {
  background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
  color: #7a4f00 !important; border: 1.5px solid #f0b429 !important;
  font-weight: 600;
}
.btn-upgrade:hover { background: linear-gradient(135deg, #fde68a, #f0b429) !important; }

/* ── Upgrade success banner ──────────────────────────────────────── */
.upgrade-success {
  background: rgba(0, 168, 120, 0.18); border: 1.5px solid rgba(0, 168, 120, 0.40);
  color: #004D38; font-size: 14px; font-weight: 500;
  padding: 10px 16px; border-radius: 10px; text-align: center;
  margin: 8px auto 0; max-width: 680px;
}

/* ── Upgrade modal ───────────────────────────────────────────────── */
.upgrade-modal-card {
  max-width: 460px !important; width: 95%; position: relative;
}
.upgrade-modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: #aaa; padding: 4px 8px;
  line-height: 1;
}
.upgrade-modal-close:hover { color: #555; }
.upgrade-header { text-align: center; margin-bottom: 20px; }
.upgrade-crown { font-size: 36px; margin-bottom: 6px; }
.upgrade-header h3 { font-size: 22px; margin: 0 0 6px; color: var(--accent-dark); }
.upgrade-reason {
  font-size: 14px; color: var(--primary-dark); margin: 0;
  min-height: 0;
}
.upgrade-reason:empty { display: none; }
.upgrade-features {
  background: #F5F5FA; border-radius: 12px; padding: 14px 16px;
  margin-bottom: 20px;
}
.upgrade-feature-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 5px 0; font-size: 14px; line-height: 1.4;
}
.uf-icon { font-size: 18px; flex-shrink: 0; }
.upgrade-pricing {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 14px;
}
.price-card {
  border: 2px solid var(--border); border-radius: 14px;
  padding: 16px 14px; text-align: center; background: white;
  position: relative;
}
.price-card.price-annual {
  border-color: var(--primary); background: #FFF8F5;
}
.price-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: white; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 12px; white-space: nowrap;
}
.price-amount { font-size: 32px; font-weight: 800; color: var(--accent-dark); }
.price-period { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.price-saving { font-size: 12px; color: var(--primary-dark); font-weight: 600; min-height: 18px; margin-bottom: 12px; }
.price-card .btn { font-size: 13px; padding: 8px 10px; }
.upgrade-note {
  text-align: center; font-size: 12px; color: var(--muted); margin: 0;
}
.footer-legal-link { color: #999; text-decoration: none; }
.footer-legal-link:hover { text-decoration: underline; }

/* ── Landing section ─────────────────────────────────────────────── */
.landing-section { margin-bottom: 8px; }

.landing-hero-text { text-align: center; padding: 4px 0 20px; }
.landing-headline {
  font-size: 24px; font-weight: 800; color: var(--ink);
  margin: 0 0 10px; line-height: 1.25;
}
.landing-sub {
  color: var(--muted); font-size: 15px; line-height: 1.55;
  margin: 0 auto; max-width: 400px;
}

.landing-how { margin-bottom: 20px; }
.landing-how-label {
  text-align: center; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--accent); margin-bottom: 12px;
}

/* ── How-it-works carousel ───────────────────────────────────────── */
.how-carousel-wrap {
  position: relative;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow);
  padding: 26px 48px 16px; overflow: hidden;
}
.how-track { display: flex; transition: transform 0.38s cubic-bezier(.4,0,.2,1); }
.how-slide { min-width: 100%; text-align: center; padding: 0 4px 4px; }

/* Step card mockup (replaces old mini phone) */
.mock-phone {
  width: 108px; height: 178px;
  border: 3px solid #2A2770; border-radius: 20px;
  margin: 0 auto 16px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(30, 27, 94, 0.18), inset 0 1px 0 rgba(255,255,255,0.15);
  background: white;
}
.mock-screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 7px; padding: 10px;
}
.step1-screen { background: linear-gradient(145deg, #2E2A80 0%, #1E1B5E 100%); }
.step2-screen { background: linear-gradient(145deg, #FF7A30 0%, #FF5C00 100%); }
.step3-screen { background: linear-gradient(145deg, #00C896 0%, #00A878 100%); }

.mock-icon { font-size: 32px; line-height: 1; }
.mock-lines { display: flex; flex-direction: column; gap: 5px; width: 70%; }
.mock-line { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.30); }
.ml-wide { width: 100%; } .ml-med { width: 70%; }

.mock-word-display {
  font-size: 12px; font-weight: 700; color: white;
  background: rgba(255,255,255,0.20); border-radius: 6px; padding: 3px 8px;
}
.mock-pencil { font-size: 9px; color: rgba(255,255,255,0.75); }

.mock-answer-row { display: flex; justify-content: center; }
.mock-answer-word {
  font-size: 11px; font-weight: 700; color: white;
  background: rgba(255,255,255,0.20); border-radius: 6px; padding: 2px 8px;
}
.mock-btn-row { display: flex; gap: 5px; }
.mock-mini-btn {
  font-size: 9px; font-weight: 700; border-radius: 6px;
  padding: 3px 6px; white-space: nowrap;
}
.mock-got-it { background: #d4f5e2; color: #007A58; }
.mock-wrong  { background: #fde8e8; color: #c0392b; }

.how-step-num {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.9px; color: var(--primary); margin-bottom: 4px;
}
.how-step-title { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.how-step-desc {
  font-size: 14px; color: var(--muted); line-height: 1.5;
  max-width: 300px; margin: 0 auto;
}

.how-dots { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.how-dot {
  width: 8px; height: 8px; border-radius: 50%; border: none;
  background: var(--border); cursor: pointer; padding: 0;
  transition: background 0.2s, transform 0.2s;
}
.how-dot.active { background: var(--primary); transform: scale(1.4); }

.how-nav {
  position: absolute; top: 48%; transform: translateY(-50%);
  background: white; border: 1.5px solid var(--border); border-radius: 50%;
  width: 30px; height: 30px; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); box-shadow: 0 2px 8px rgba(30, 27, 94, 0.08);
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s; padding: 0; line-height: 1; z-index: 2;
}
.how-nav:hover { color: var(--primary); border-color: var(--primary); box-shadow: 0 3px 12px rgba(30, 27, 94, 0.14); }
.how-prev { left: 8px; } .how-next { right: 8px; }

/* ── Benefit chips ───────────────────────────────────────────────── */
.benefit-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin: 0 0 22px;
}
.benefit-chip {
  background: white; border: 1.5px solid var(--border); border-radius: 20px;
  padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--ink);
  box-shadow: 0 1px 4px rgba(30, 27, 94, 0.06);
}

.landing-cta-area { display: flex; flex-direction: column; gap: 0; }
.landing-cta-btn { font-size: 17px; padding: 16px; border-radius: 14px; }
.landing-login-hint {
  text-align: center; font-size: 14px; color: var(--muted);
  margin: 12px 0 0;
}

@media (max-width: 480px) {
  .landing-headline { font-size: 20px; }
  .how-carousel-wrap { padding: 22px 38px 14px; }
  .how-step-title { font-size: 15px; }
  .how-step-desc { font-size: 13px; }
  .mock-phone { width: 96px; height: 158px; }
}

/* ── Manage Plan modal ───────────────────────────────────────────── */
.plan-modal-card { max-width: 380px !important; width: 95%; }
.plan-modal-header { text-align: center; margin-bottom: 20px; }
.plan-modal-icon { font-size: 36px; margin-bottom: 6px; }
.plan-modal-header h3 { font-size: 20px; margin: 0; color: var(--accent-dark); }
.plan-modal-content { margin-bottom: 20px; }
.plan-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.plan-info-row:last-child { border-bottom: none; }
.plan-info-label { color: var(--muted); }
.plan-info-row strong { color: var(--ink); text-align: right; }
.plan-modal-actions {
  display: flex; flex-direction: column; gap: 10px;
}
.plan-cancel-btn { color: #c0392b; border-color: #c0392b; }
.plan-cancel-btn:hover { background: #fef0ef; }

/* ── Dictation auto-detect banner ────────────────────────────────── */
.dictation-suggestion-banner {
  background: #fff8e1; border: 1px solid #f9a825; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px;
}
.dsb-text { font-size: 14px; color: #5d4037; margin-bottom: 10px; line-height: 1.5; }
.dsb-text strong { display: block; margin-bottom: 4px; }
.dsb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Share / Refer modal ─────────────────────────────────────────── */
.btn-share-footer {
  font-size: 14px; padding: 10px 22px; border-radius: 99px;
  display: inline-flex; align-items: center; gap: 6px;
}
.share-modal-card {
  max-width: 420px !important; width: 95%; position: relative;
}
.share-modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: #aaa; padding: 4px 8px; line-height: 1;
}
.share-modal-close:hover { color: #555; }
.share-modal-header { text-align: center; margin-bottom: 18px; }
.share-modal-icon { font-size: 38px; margin-bottom: 6px; }
.share-modal-header h3 { font-size: 21px; margin: 0 0 6px; color: var(--accent-dark); }
.share-modal-sub { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.4; }

.share-link-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 10px 12px 10px 16px;
  margin-bottom: 18px;
}
.share-link-url {
  flex: 1; font-size: 14px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.share-copy-btn {
  background: var(--accent); color: white; border: none;
  border-radius: 8px; padding: 7px 14px; font-size: 13px;
  font-weight: 700; cursor: pointer; font-family: inherit;
  flex-shrink: 0; transition: background 0.15s;
}
.share-copy-btn:hover { background: var(--accent-dark); }
.share-copy-btn.copied { background: var(--good); }

.share-channels {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 16px;
}
.share-channel-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 10px; border-radius: 12px; font-size: 14px; font-weight: 700;
  text-decoration: none; border: none; cursor: pointer;
  font-family: inherit; transition: filter 0.15s, transform 0.05s;
}
.share-channel-btn:active { transform: scale(0.97); }
.share-channel-btn:hover { filter: brightness(0.92); }
.share-channel-icon { width: 20px; height: 20px; flex-shrink: 0; }
.share-wa   { background: #25D366; color: white; }
.share-x    { background: #000000; color: white; }
.share-fb   { background: #1877F2; color: white; }
.share-more { background: #F0F0F8; color: var(--accent); border: 1.5px solid var(--border); }

.share-modal-note {
  text-align: center; font-size: 13px; color: var(--muted); margin: 0;
}

.hidden { display: none !important; }
