/* iPadOS Landscape / Split View + iOS PWA Stylesheet for 《从零学透托福 2026》
   Apple HIG touch targets (>=44px), safe-area-inset support, zero Safari input auto-zoom (>=18px inputs),
   persistent iPad left rail + side-by-side split textbook pane. */
:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --ink: #132b36;
  --muted: #55707d;
  --line: #dbe5eb;
  --teal: #0e7490;
  --teal-dark: #0a556a;
  --duo-green: #58cc02;
  --duo-green-dark: #46a302;
  --rail-w: 272px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15.5px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "SF Pro Text", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, label.btn-like {
  font: inherit;
  touch-action: manipulation;
}

button, .btn-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s, filter .12s, background .12s, border-color .12s;
}
button:hover:not(:disabled), .btn-like:hover { filter: brightness(1.04); }
button:active:not(:disabled), .btn-like:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button.light, .btn-like.light {
  background: #fff;
  color: #16485a;
  border-color: #c8d8e1;
}
button.light:hover:not(:disabled), .btn-like.light:hover { background: #f2f8fa; border-color: #96bac8; }
button.pill-active {
  background: #0e7490;
  border-color: #0a556a;
  color: #fff;
}
button.danger-btn { color: #b91c1c; border-color: #f2c2c2; }
button.danger-btn:hover:not(:disabled) { background: #fff1f2; border-color: #e58e8e; }

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

/* ==================== IPAD 2-PANE SHELL ==================== */

.ipad-shell {
  display: flex;
  min-height: 100dvh;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.ipad-rail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--safe-left);
  width: var(--rail-w);
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: calc(14px + var(--safe-top)) 14px calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 30;
  transition: transform .22s ease;
}

.ipad-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--rail-w);
  display: flex;
  flex-direction: column;
  transition: margin-left .22s ease;
}

.ipad-shell.rail-collapsed .ipad-rail { transform: translateX(calc(-100% - 20px)); visibility: hidden; pointer-events: none; }
.ipad-shell.rail-collapsed .ipad-main { margin-left: 0; }

.mobile-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) 18px 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.rail-toggle {
  min-height: 38px;
  min-width: 40px;
  padding: 4px 10px;
  background: #f2f7fa;
  border: 1.5px solid #cfdce4;
  color: #15495c;
  font-size: 18px;
  border-radius: 10px;
}

.mobile-brand { display: flex; align-items: center; gap: 8px; font-size: 16px; color: #0f3947; }
.brand-dot {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #16a34a, #0e7490);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.offline-pill {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4f7;
  color: #466575;
}
.offline-pill.is-ready { background: #e6fae9; color: #156e2d; }
.offline-pill.is-offline { background: #fff4d6; color: #8a5600; }

.app-stage {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 22px calc(40px + var(--safe-bottom));
}

body[data-view="coach"] .app-stage {
  max-width: 1320px;
  padding-bottom: calc(130px + var(--safe-bottom));
}

.boot-msg { padding: 40px 20px; text-align: center; color: var(--muted); }

/* Sidebar Contents */
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rail-brand { display: flex; align-items: center; gap: 9px; }
.rail-brand strong { display: block; font-size: 15.5px; color: #0e3847; line-height: 1.2; }
.rail-brand small { display: block; font-size: 11.5px; color: #5b7886; }
.rail-close-btn {
  min-height: 34px;
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 9px;
  background: #f3f7f9;
  border: 1px solid #d4e1e8;
  color: #3a5c6c;
  font-size: 16px;
}

.rail-progress {
  padding: 11px 12px;
  border-radius: 12px;
  background: #f6fafc;
  border: 1px solid #dfeaf0;
}
.rail-prog-row { display: flex; justify-content: space-between; font-size: 13px; color: #244a5a; margin-bottom: 6px; }
.rail-prog-track { height: 9px; border-radius: 999px; background: #e1ebf0; overflow: hidden; }
.rail-prog-track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #58cc02, #7ee32b); }
.rail-progress small { display: block; margin-top: 6px; font-size: 11.5px; color: #5b7785; }

.rail-resume-btn {
  width: 100%;
  background: var(--duo-green);
  border-color: var(--duo-green-dark);
  border-bottom: 3px solid #3c8c02;
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  padding: 9px 10px;
}

.rail-nav { display: grid; gap: 5px; }
.rail-nav-btn {
  width: 100%;
  justify-content: flex-start;
  min-height: 40px;
  padding: 8px 11px;
  background: transparent;
  border: 1.5px solid transparent;
  color: #1d4354;
  font-size: 14px;
  border-radius: 11px;
}
.rail-nav-btn:hover { background: #f2f7fa; filter: none; }
.rail-nav-btn.active { background: #e6f5fa; border-color: #a8d4e3; color: #0a5268; font-weight: 700; }
.rail-ico { width: 22px; text-align: center; }
.rail-badge { margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #e8f1f5; color: #3d6273; }

.rail-section-title { font-size: 11.5px; font-weight: 700; color: #678391; text-transform: uppercase; letter-spacing: .5px; padding: 4px 4px 0; }
.rail-chapters { display: grid; gap: 4px; }
.rail-ch-btn {
  width: 100%;
  justify-content: flex-start;
  min-height: 36px;
  padding: 6px 9px;
  background: transparent;
  border: 1px solid transparent;
  color: #2c4d5d;
  font-size: 13.2px;
  border-radius: 9px;
}
.rail-ch-btn:hover { background: #f4f8fa; filter: none; }
.rail-ch-btn.active { background: #eaf7fb; border-color: #9dd0e0; color: #0b4f64; font-weight: 700; }
.rail-ch-no {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #e6eff4;
  color: #3e6070;
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rail-ch-btn.done .rail-ch-no { background: #58cc02; color: #fff; }
.rail-ch-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-ch-ico { margin-left: auto; font-size: 14px; }

/* ==================== CARDS, HERO, KPI, FORMS ==================== */

.hero {
  background: linear-gradient(135deg, #ffffff 0%, #f1f9fc 100%);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(15, 45, 60, .04);
}
.hero .meta { font-size: 12px; font-weight: 800; letter-spacing: .6px; color: var(--teal); text-transform: uppercase; margin-bottom: 6px; }
.hero h1 { margin: 0 0 8px; font-size: 24px; line-height: 1.3; color: #0e2e3c; }
.sub { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.65; }

.panel.block {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.panel.block h2 { margin: 0 0 12px; font-size: 18px; color: #103747; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; }
.kpi-card { background: #fff; border: 1px solid #dbe7ee; border-radius: 12px; padding: 12px 14px; }
.kpi-card small { display: block; font-size: 12px; color: #5b7887; }
.kpi-card b { display: block; font-size: 24px; color: #0e4a5e; line-height: 1.25; margin: 3px 0; }
.kpi-card span { font-size: 12px; color: #678391; }

.cfg-row { padding: 11px 0; border-bottom: 1px dashed #e2ecf1; }
.cfg-row:last-of-type { border-bottom: none; }
.cfg-lbl { font-size: 13.5px; font-weight: 700; color: #1d4657; margin-bottom: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.form-grid label { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: #20495a; }
.form-grid input, .search-row input {
  width: 100%;
  min-height: 44px;
  padding: 9px 13px;
  border-radius: 11px;
  border: 1.5px solid #c5d6e0;
  background: #fff;
  color: var(--ink);
  font-size: 16px; /* >=16px prevents iOS Safari auto-zoom! */
}
.search-row { margin-top: 12px; }

.guide-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.65; color: #1f3e4d; }

/* ==================== CURRICULUM MAP & LESSON ==================== */

.duo-resume-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 13px 16px;
  border-radius: 15px;
  background: linear-gradient(90deg, #ecfce1, #f6fff0);
  border: 2px solid #80d646;
  color: #215800;
}
.duo-resume-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.duo-resume-info strong { display: block; font-size: 15.5px; color: #1a4700; }
.duo-resume-info small { display: block; font-size: 12.8px; color: #3b7117; margin-top: 2px; }
.duo-resume-badge { padding: 4px 10px; border-radius: 999px; background: var(--duo-green); color: #fff; font-size: 12px; font-weight: 800; }
.duo-resume-go, .duo-mini-go {
  background: var(--duo-green) !important;
  border-color: var(--duo-green-dark) !important;
  border-bottom: 3px solid #3c8c02 !important;
  color: #fff !important;
  font-weight: 700 !important;
}

.curr-overall { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.curr-overall-bar { flex: 1; min-width: 190px; height: 14px; border-radius: 999px; background: #e2ecf1; overflow: hidden; border: 1px solid #d1e0e8; }
.curr-overall-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #58cc02, #7de32b); }
.curr-part-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-left: 12px; margin-bottom: 14px; }
.curr-part-head h2 { margin: 0; font-size: 18px; }
.curr-part-stat { padding: 4px 11px; border-radius: 999px; background: #eef6f9; color: #225163; font-size: 13px; font-weight: 700; }

.curr-path-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 14px; }
.curr-node {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px 16px;
  border-radius: 15px;
  border: 2px solid #dce6ec;
  border-bottom-width: 4px;
  background: #fff;
  transition: transform .12s, border-color .15s;
}
.curr-node:hover { border-color: #8dc1d4; transform: translateY(-2px); }
.curr-node.is-next { border-color: var(--duo-green); background: #f8fff2; box-shadow: 0 6px 18px rgba(88, 204, 2, .14); }
.curr-node.is-passed { border-color: #86d865; background: #f7fdf4; }
.curr-node-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.curr-node-ico { font-size: 26px; line-height: 1; }
.curr-status { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.curr-status.ok { background: #e2f9d5; color: #1e6b00; }
.curr-status.next { background: var(--duo-green); color: #fff; }
.curr-status.todo { background: #eef4f7; color: #4a6775; }
.curr-node h3 { margin: 2px 0 0; font-size: 16px; color: #133544; }
.curr-node-mantra { margin: 0; font-size: 13.5px; line-height: 1.55; color: #3d5b69; flex: 1; }
.curr-node-meta { font-size: 12.5px; font-weight: 600; color: #13667f; background: #eef7fa; padding: 5px 9px; border-radius: 8px; }
.curr-node-actions { margin-top: 4px; }
.curr-node-actions button { width: 100%; }

.curr-sheet { display: grid; gap: 13px; }
.curr-mantra { padding: 12px 15px; border-radius: 12px; background: #fff9e6; border: 1.5px solid #f0cf7b; color: #6e4600; font-size: 14.5px; line-height: 1.6; }
.curr-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 13px; }
.curr-card { padding: 14px 16px; border-radius: 12px; background: #f8fbfd; border: 1.5px solid #d9e7ee; }
.curr-card h3 { margin: 0 0 8px; font-size: 15.5px; color: #0f4558; }
.curr-card ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.8px; line-height: 1.6; color: #203f4d; }
.curr-card code { background: #e6f3f8; color: #0e4f66; padding: 1px 5px; border-radius: 5px; font-size: 13px; font-weight: 600; }
.curr-formula { margin: 6px 0 10px; padding: 9px 12px; border-radius: 9px; background: #e8f6fb; border: 1px solid #b5dce8; color: #0b4a5e; font-weight: 700; font-size: 13.5px; line-height: 1.5; }
.curr-example { padding: 13px 16px; border-radius: 12px; background: #f2fbf4; border: 1.5px solid #b7e3c2; }
.curr-ex-head { font-size: 13px; font-weight: 800; color: #146835; margin-bottom: 5px; }
.curr-ex-txt { font: 600 15.5px/1.65 Georgia, serif; color: #153624; margin-bottom: 6px; }
.curr-ex-note { font-size: 13.5px; line-height: 1.55; color: #27583a; }

.curr-tbl-wrap { overflow-x: auto; }
.table.curr-table { width: 100%; border-collapse: collapse; font-size: 13.8px; }
.table.curr-table th, .table.curr-table td { padding: 8px 10px; border-bottom: 1px solid #e3edf2; text-align: left; }
.table.curr-table th { background: #f4f8fa; color: #264c5c; font-weight: 700; }
.muted { color: var(--muted); text-align: center; }

/* ==================== DUOLINGO COACH & IPAD SIDE-BY-SIDE SPLIT ==================== */

.duo-shell { max-width: 920px; margin: 0 auto; }
.duo-shell.is-split { max-width: 1280px; }

.duo-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
}
.duo-exit-btn {
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid #c9d9e2;
  background: #f7fafc;
  color: #194a5e;
  font-size: 13.5px;
  font-weight: 700;
}
.duo-prog-wrap { flex: 1; min-width: 120px; }
.duo-prog-track { height: 15px; border-radius: 999px; background: #e3edf2; overflow: hidden; }
.duo-prog-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #58cc02, #82e62e);
  transition: width .28s ease;
}
.duo-top-stats { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.duo-prog-num { font-size: 13px; font-weight: 800; color: #254f60; }
.duo-streak { padding: 3px 9px; border-radius: 999px; background: #fff0d4; color: #b55400; font-size: 13px; font-weight: 800; }
.duo-ref-btn, .duo-sound-btn {
  min-height: 36px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1.5px solid #cbd9e2;
  background: #fff;
  color: #1b4b5e;
  font-size: 13px;
  font-weight: 700;
}
.duo-ref-btn.active { background: #e4f5fa; border-color: #1682a0; color: #0c4b5e; }

.duo-workspace { display: block; }
.duo-workspace.has-split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.split-sheet-pane {
  background: #fff;
  border: 2px solid #96cde0;
  border-radius: 16px;
  padding: 15px 16px;
  max-height: calc(100dvh - 220px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 72px;
  box-shadow: 0 6px 20px rgba(16, 42, 56, .08);
}
.split-sheet-pane .curr-cards { grid-template-columns: 1fr; }
.curr-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #dfebf0; }
.curr-drawer-head strong { font-size: 15px; color: #0f4659; }

.duo-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 4px 18px rgba(16, 42, 56, .04);
}
.duo-unit-banner {
  margin: -2px 0 12px;
  padding: 9px 13px;
  border-radius: 10px;
  background: linear-gradient(90deg, #eef8ff, #f6fbff);
  border-left: 4px solid #0284c7;
  font-size: 13.5px;
  line-height: 1.55;
  color: #0c4a6e;
  font-weight: 600;
}
.duo-step-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.duo-kind-tag { font-size: 13px; font-weight: 700; color: #12586e; background: #e8f5f9; padding: 4px 10px; border-radius: 999px; }
.duo-src-tag { font-size: 12px; color: #5b7786; background: #f1f5f7; padding: 3px 9px; border-radius: 999px; }
.duo-retry-pill { font-size: 12.5px; font-weight: 800; color: #a14d00; background: #fff0d4; padding: 4px 10px; border-radius: 999px; }

.duo-coach-bubble {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: #f3f9fc;
  border: 1.5px solid #d1e5ee;
  border-radius: 14px;
  padding: 11px 14px;
  margin-bottom: 14px;
}
.duo-owl { font-size: 24px; line-height: 1.1; }
.duo-bubble-body p { margin: 0; font-size: 14.5px; line-height: 1.65; color: #173b4b; font-weight: 500; }
.duo-bubble-body .duo-deep-tip { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #c4dce5; font-size: 13.5px; color: #3d5b69; }

.duo-passage {
  font: 19.5px/2.45 Georgia, "Times New Roman", serif;
  color: #1c323d;
  padding: 15px 18px;
  background: #fbfdfe;
  border: 1px solid #e1ebf0;
  border-radius: 13px;
}
.duo-solved-word { color: #167e3e; background: #e8f9ee; padding: 2px 7px; border-radius: 7px; font-weight: 700; }
.duo-future-blank { color: #7a909c; background: #f1f5f7; padding: 2px 6px; border-radius: 7px; font-size: 18px; }
.duo-future-blank sup, .duo-active-blank sup { font: 700 11px/1 -apple-system, sans-serif; color: #4a6b7a; margin-right: 3px; }
.duo-active-blank {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  margin: 0 3px;
  border-radius: 11px;
  background: #e4f7fb;
  border: 2px solid #1686a3;
  box-shadow: 0 3px 10px rgba(22, 134, 163, .14);
  vertical-align: baseline;
}
.duo-active-blank.is-ok { background: #e6fae9; border-color: #38a818; }
.duo-active-blank.is-err { background: #ffecec; border-color: #d93b2b; }
.duo-pre { font: 700 19.5px/1.2 Georgia, serif; color: #0e4a5c; margin-right: 2px; }
.duo-letter {
  width: 34px;
  height: 40px;
  text-align: center;
  font: 700 20px/1 Georgia, serif; /* >=18px guarantees ZERO iOS Safari auto-zoom! */
  border: 2px solid #8eb8c7;
  border-bottom-width: 4px;
  border-radius: 9px;
  background: #fff;
  color: #103240;
  padding: 0;
  outline: none;
}
.duo-letter:focus { border-color: #0e7490; background: #f5fcff; }
.duo-letter.is-hinted { background: #fff8df; border-color: #e0a419; color: #8a5600; }

.duo-dialog-prompt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
  border: 1.5px solid #dce6ec;
  border-radius: 14px;
  padding: 13px 16px;
  margin-bottom: 14px;
}
.duo-speaker { font-size: 26px; line-height: 1; padding: 3px; }
.duo-dialog-prompt small { display: block; font-size: 12px; font-weight: 700; color: #5a7382; margin-bottom: 2px; }
.duo-dialog-prompt p { margin: 0; font: 600 17.5px/1.55 Georgia, serif; color: #17303d; }

.duo-sent-build {
  padding: 16px 18px;
  border-radius: 13px;
  background: #fbfdfe;
  border: 1.5px solid #dce7ed;
  line-height: 2.55;
  font-size: 18px;
  margin-bottom: 16px;
}
.duo-fixed-txt { font: 600 18.5px/1.5 Georgia, serif; color: #193542; }
.duo-slot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 72px;
  min-height: 42px;
  justify-content: center;
  padding: 6px 14px;
  margin: 4px;
  border-radius: 11px;
  font: 600 16.5px/1.25 -apple-system, sans-serif;
}
.duo-slot.empty { border: 2px dashed #9eb8c6; background: #f2f7fa; color: #7892a0; }
.duo-slot.empty.selected { border-color: #0e7490; background: #e4f6fb; color: #0e7490; border-style: solid; }
.duo-slot.filled { border: 2px solid #1c7c96; border-bottom-width: 4px; background: #eaf7fb; color: #0e4758; }
.duo-slot.slot-ok { border-color: #38a818 !important; background: #e6fae9 !important; color: #146b24 !important; }
.duo-slot.slot-err { border-color: #d93b2b !important; background: #ffecec !important; color: #a32116 !important; }
.duo-slot i { font-style: normal; font-size: 12px; font-weight: 800; }

.duo-word-bank { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 4px 4px; justify-content: center; }
.duo-word-tile {
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 13px;
  border: 2px solid #cbd9e2;
  border-bottom: 4px solid #b5c8d4;
  background: #fff;
  color: #173240;
  font: 600 16.5px/1.25 -apple-system, sans-serif;
}
.duo-word-tile:hover:not(:disabled) { background: #f2f9fc; border-color: #7bb2c4; filter: none; }
.duo-word-tile:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
.duo-word-tile:disabled { opacity: .28; background: #eef3f6; border-bottom-width: 2px; }

.duo-scaffolds { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #e7eff3; }
.duo-chip-btn {
  min-height: 40px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid #c5dce5;
  background: #f7fbfd;
  color: #15586e;
  font-size: 13.8px;
  font-weight: 600;
}
.duo-chip-btn:hover { background: #e6f4f8; border-color: #7eb6c9; filter: none; }

/* Fixed Bottom Feedback Footer (respects iPad Rail & Home Indicator safe area) */
.duo-footer {
  position: fixed;
  left: calc(var(--rail-w) + var(--safe-left));
  right: var(--safe-right);
  bottom: 0;
  z-index: 25;
  background: #fff;
  border-top: 2px solid #dce6ec;
  padding: 13px 22px calc(13px + var(--safe-bottom));
  box-shadow: 0 -4px 20px rgba(16, 42, 56, .08);
  transition: left .22s ease;
}
.ipad-shell.rail-collapsed .duo-footer { left: var(--safe-left); }
.duo-footer.is-ok { background: #d7ffb8; border-top-color: #a5ed6e; }
.duo-footer.is-err { background: #ffdfe0; border-top-color: #f5a7a9; }
.duo-footer-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.duo-fb-layout { align-items: flex-end; }
.duo-fb-content { flex: 1; min-width: 250px; }
.duo-fb-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.duo-footer.is-ok .duo-fb-title { color: #2f7a00; }
.duo-footer.is-err .duo-fb-title { color: #b82020; }
.duo-fb-detail { font-size: 14.5px; line-height: 1.55; color: #1d3540; }
.duo-ans-sub { font-size: 13.5px; color: #3d5460; }
.duo-fb-ask { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.duo-mini-ai { min-height: 36px; padding: 5px 11px; border-radius: 9px; border: 1.5px solid rgba(0,0,0,.14); background: rgba(255,255,255,.85); color: #174252; font-size: 13px; font-weight: 700; }
.duo-mini-input { flex: 1; min-width: 170px; max-width: 310px; min-height: 36px; padding: 5px 11px; border-radius: 9px; border: 1.5px solid rgba(0,0,0,.15); background: rgba(255,255,255,.92); font-size: 16px; }

.duo-primary-btn {
  min-height: 46px;
  padding: 11px 28px;
  border-radius: 14px;
  border: none;
  border-bottom: 4px solid var(--duo-green-dark);
  background: var(--duo-green);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}
.duo-primary-btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.duo-primary-btn.is-soft { background: #93c987; border-bottom-color: #74ad68; }
.duo-primary-btn.is-err-btn { background: #ea2b2b; border-bottom-color: #bd1d1d; }
.duo-skip-btn {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 13px;
  border: 2px solid #d3dfe6;
  border-bottom-width: 4px;
  background: #fff;
  color: #627885;
  font-size: 14px;
  font-weight: 700;
}

.duo-ai-thread { margin-top: 14px; display: grid; gap: 10px; }
.coach-ai-loading { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #eef6fa; color: #15536b; font-size: 13.8px; }
.coach-ai-msg { background: #fff; border: 1px solid #c4dce6; border-left: 4px solid #1a6d85; border-radius: 11px; padding: 12px 14px; font-size: 14.2px; line-height: 1.68; color: #1d3644; }
.coach-q-tag { font-size: 12.5px; font-weight: 700; color: #145b70; margin-bottom: 5px; }
.coach-takeaway { margin-top: 7px; padding: 7px 10px; border-radius: 7px; background: #fff7e6; color: #7d4905; font-weight: 700; font-size: 13.8px; }
.coach-bonus { margin-top: 6px; padding: 7px 10px; border-radius: 7px; background: #eff8f4; color: #12593e; font-size: 13.8px; }

.diff-word { font: 700 18.5px/1.4 Georgia, serif; letter-spacing: 1.5px; background: #fff; padding: 3px 9px; border-radius: 7px; border: 1px solid #e4c9c5; display: inline-block; }
.ch-ok { color: #126e48; }
.ch-err { color: #fff; background: #d13b2c; padding: 0 3px; border-radius: 3px; margin: 0 1px; }
.advice-list { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.mic-ok { color: #15703a; font-weight: 700; }

/* Toast & Dialog */
.toast {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(560px, 92vw);
  padding: 11px 18px;
  border-radius: 12px;
  background: #103240;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 26px rgba(10, 30, 42, .26);
}
.ios-dialog {
  width: min(440px, 90vw);
  border: none;
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .22);
}
.ios-dialog::backdrop { background: rgba(12, 30, 40, .45); backdrop-filter: blur(3px); }
.ios-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.ios-dialog p { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
.ios-dialog .actions { justify-content: flex-end; }

/* ==================== IPAD SPLIT VIEW / PORTRAIT / IPHONE BREAKPOINTS ==================== */

@media (max-width: 979px) {
  .ipad-rail {
    transform: translateX(calc(-100% - 20px));
    visibility: hidden;
    pointer-events: none;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .16);
  }
  .ipad-shell.drawer-open .ipad-rail { transform: translateX(0); visibility: visible; pointer-events: auto; }
  .ipad-main { margin-left: 0; }
  .duo-footer { left: var(--safe-left); }
  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 28;
    background: rgba(12, 30, 40, .38);
  }
  .duo-workspace.has-split {
    grid-template-columns: 1fr;
  }
  .split-sheet-pane {
    position: static;
    max-height: 360px;
    order: -1;
  }
}

@media (max-width: 639px) {
  .app-stage { padding: 14px 12px calc(36px + var(--safe-bottom)); }
  .hero { padding: 16px; }
  .hero h1 { font-size: 20px; }
  .duo-card { padding: 14px; }
  .duo-passage { font-size: 17.5px; line-height: 2.3; padding: 12px; }
  .duo-letter { width: 30px; height: 38px; font-size: 18px; }
  .duo-footer { padding: 11px 12px calc(11px + var(--safe-bottom)); }
  .duo-primary-btn { width: 100%; }
}
