/* ============================================================
   实用德语 — 样式（冷杉绿主题）
   换肤只改 --brand / --brand-dark / --accent。
   iOS 适配：safe-area、dvh、44px 触摸目标、去除点击高亮。
   ============================================================ */
:root {
  --brand: #1F6B4F;
  --brand-dark: #17553E;
  --accent: #B8873A;
  --bg: #F4F6F3;
  --card: #ffffff;
  --ink: #1E2421;
  --muted: #6E7A73;
  --line: #E2E7E2;
  --ok: #1F6B4F;
  --bad: #B3452F;
  --star: #D19B2E;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.04);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { height: -webkit-fill-available; }
body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Hiragino Sans", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }

.portal-back {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center;
  height: 34px;
  padding: 0 14px;
  background: #2563EB;
  color: #fff;
  font-size: 13px;
  letter-spacing: .02em;
}
.portal-back:active { background: #1D4ED8; }

.topbar {
  position: sticky; top: 34px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; color: var(--brand); font-size: 18px; letter-spacing: .02em; margin: 0; }
.brand::before { content: "DE "; opacity: .5; font-weight: 600; font-size: 13px; letter-spacing: .1em; }
.nav { display: flex; gap: 13px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.nav a:hover { color: var(--brand); }
.nav a.active { color: var(--brand); font-weight: 700; }

.container { max-width: 760px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }

/* 圈层 + 场景网格 */
.circle-title { font-size: 13px; color: var(--muted); margin: 18px 0 8px; letter-spacing: .06em; font-weight: 600; }
.circle-title small { font-weight: 400; opacity: .75; margin-left: 6px; letter-spacing: 0; }
.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.scene-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: .15s; box-shadow: var(--shadow);
}
.scene-item:hover { border-color: var(--brand); transform: translateY(-2px); }
.scene-item .t { font-weight: 600; }
.scene-item .n { font-size: 12px; color: var(--muted); margin-top: 4px; }
.scene-item .progress { font-size: 11px; color: var(--brand); margin-top: 6px; }

/* 句子行 */
.sentence {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; background: var(--card);
}
.sentence .txt { flex: 1; min-width: 0; }
.sentence .de { font-size: 16px; font-weight: 600; }
.sentence .zh { font-size: 13px; color: var(--ink); opacity: .8; }
/* 逐句已读边框标记 + 顶部即时进度条（与实用英语一致） */
.sentence.heard { border-left-width: 3px; }
.bar { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--brand); transition: width .25s; }
.reg {
  display: inline-block; font-size: 10.5px; line-height: 1.5; vertical-align: 2px;
  padding: 0 5px; margin-left: 6px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--muted); font-weight: 600;
}
.reg.sie { color: var(--brand); border-color: #CBE0D5; background: #EFF6F2; }
.reg.du { color: var(--accent); border-color: #EFE0C6; background: #FBF5EA; }
.icon-btn {
  border: none; background: #EFF6F2; color: var(--brand);
  width: 40px; height: 40px; border-radius: 9px; cursor: pointer; font-size: 15px; flex: none;
}
.icon-btn:hover { background: #DFEBE4; }
.icon-btn.playing { background: var(--brand); color: #fff; }
.star { cursor: pointer; font-size: 22px; color: var(--line); user-select: none; flex: none; padding: 0 2px; }
.star.on { color: var(--star); }

/* Tabs */
.tabs { display: flex; gap: 8px; margin: 6px 0 14px; flex-wrap: wrap; }
.tab {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 13px; color: var(--muted);
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 术语表 */
.term { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.term:last-child { border-bottom: none; }
.term .w { font-weight: 700; color: var(--brand); flex: none; }
.term .g { font-weight: 400; font-size: 12.5px; margin-left: 4px; }
.g.art-der { color: #2563EB; }
.g.art-die { color: #DC2626; }
.g.art-das { color: #059669; }
.term .m { font-size: 12.5px; color: var(--muted); }
.term .en { font-size: 12px; color: var(--muted); font-style: italic; }
.term .icon-btn { width: 34px; height: 34px; align-self: center; }
.term .star { font-size: 19px; align-self: center; }
.voc-row .m.small { font-size: 11.5px; }

/* 背词模式 */
.quiz-progress { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0; }
.flashcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 34px 20px; text-align: center; margin-top: 6px; box-shadow: var(--shadow);
}
.flashcard .fc-de { font-size: 30px; font-weight: 700; color: var(--brand); line-height: 1.3; }
.flashcard .fc-zh { font-size: 22px; font-weight: 600; margin-top: 16px; }
.flashcard .fc-hint { color: var(--muted); font-size: 13px; margin: 18px 0 12px; }
.flashcard .en { color: var(--muted); font-style: italic; font-size: 13px; margin-top: 6px; }
.flashcard .m { color: var(--muted); font-size: 13px; margin-top: 8px; }
.fc-btns { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }

/* 剧本列表 */
.script-group-title { font-size: 13px; color: var(--muted); margin: 14px 0 8px; font-weight: 600; }
.script-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.script-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow); transition: .15s;
}
.script-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.script-card .tag {
  display: inline-block; font-size: 11px; color: var(--brand);
  background: #EFF6F2; border-radius: 6px; padding: 1px 7px; margin-bottom: 5px;
}
.script-card .tt { font-weight: 600; font-size: 14.5px; }
.script-card .in { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 剧本交互 */
.sc-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sc-title-row h2 { margin: 0; flex: 1; min-width: 0; }
.star.big { font-size: 26px; }
.small { font-size: 12.5px; }
.script-step { margin-bottom: 18px; }
.say-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.say-txt { flex: 1; min-width: 0; font-weight: 600; line-height: 1.5; }
.say-row .icon-btn { width: 36px; height: 36px; }
.sc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.sc-head .tag { margin-bottom: 0; }
.sc-head .star { margin-left: auto; }
.opt {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; margin-bottom: 8px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); cursor: pointer; font-size: 14px; min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.opt .o-txt { flex: 1; min-width: 0; }
.opt .icon-btn { width: 36px; height: 36px; }
.opt:active:not(.locked) { background: #F2F7F4; }
.opt:hover:not(.locked) { border-color: var(--brand); }
.opt .o-de { font-weight: 600; }
.opt .o-zh { font-size: 12.5px; color: var(--ink); opacity: .8; }
.opt.correct { border-color: var(--ok); background: #EDF6F1; }
.opt.wrong { border-color: var(--bad); background: #FBEFEC; }
.opt.locked { cursor: default; opacity: .96; }
.feedback { font-size: 13px; margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: #F2F5F2; line-height: 1.6; }
.feedback.ok { color: var(--ok); }
.feedback.no { color: var(--bad); }
.result-box { background: #F1F7F4; border: 1px solid #D6E6DD; border-radius: 12px; padding: 16px; margin-top: 8px; }
.result-box .score { font-size: 20px; font-weight: 700; color: var(--brand); }

/* 应急包 */
.emg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.emg { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.emg .label { font-size: 12px; color: var(--muted); }
.emg .num { font-size: 21px; font-weight: 700; color: var(--brand); letter-spacing: .02em; }
.emg-row {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--card);
}
.emg-row .txt { flex: 1; min-width: 0; }
.emg-row .de { font-weight: 600; }
.emg-row .zh { font-size: 12.5px; color: var(--ink); opacity: .8; }

/* 倒计时 */
.trip-form { display: flex; flex-direction: column; gap: 12px; }
.trip-form label { font-size: 13px; color: var(--muted); }
.trip-form select, .trip-form input {
  padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; background: var(--card); color: var(--ink); min-height: 44px;
}
.trip-day { border-left: 4px solid var(--brand); }
.trip-day.emg-day { border-left-color: var(--accent); }
.trip-day .day-h { font-weight: 700; font-size: 14px; }
.trip-day .day-sub { font-size: 12px; color: var(--muted); }

/* 设置 */
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 13px; border-radius: 9px; cursor: pointer; font-size: 14px; min-height: 40px;
}
.seg button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn {
  border: none; background: var(--brand); color: #fff; padding: 11px 16px;
  border-radius: 10px; cursor: pointer; font-size: 15px; min-height: 44px;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--bad); border: 1px solid var(--bad); }
.btn.small { padding: 8px 12px; font-size: 13px; min-height: 38px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.empty a { color: var(--brand); }

.tip-box { background: #FBF5EA; border: 1px solid #EFE0C6; border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.tip-box b { color: #8A6420; }

@media (max-width: 520px) {
  .emg-grid { grid-template-columns: 1fr; }
  .scene-grid { grid-template-columns: 1fr 1fr; }
  .script-list { grid-template-columns: 1fr; }
  .nav { gap: 11px; font-size: 13px; }
}

/* 页脚 */
.site-footer {
  max-width: 760px; margin: 24px auto 0; padding: 22px 16px 34px;
  padding-bottom: calc(34px + var(--safe-b));
  text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.95;
  border-top: 1px solid var(--line);
}
.site-footer p { margin: 0; }
