:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --text: #172033;
  --muted: #667085;
  --primary: #2f6fed;
  --primary-dark: #1e56c9;
  --primary-soft: #eaf1ff;
  --success: #168a5b;
  --success-soft: #e7f7f0;
  --warning: #c77700;
  --warning-soft: #fff4dd;
  --danger: #c93b4b;
  --danger-soft: #ffedf0;
  --border: #e4e9f2;
  --shadow: 0 10px 35px rgba(31, 50, 81, 0.08);
  --radius: 20px;
  --sidebar: 248px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 24px 16px;
  background: rgba(255,255,255,.94); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 22px; z-index: 20;
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(145deg, #2f6fed, #6f91ff); color: #fff; font-weight: 900; box-shadow: 0 8px 22px rgba(47,111,237,.24); }
.brand-text strong { display: block; font-size: 17px; }
.brand-text span { font-size: 12px; color: var(--muted); }
.nav-list { display: grid; gap: 7px; }
.nav-button { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; padding: 12px 14px; border-radius: 14px; background: transparent; color: var(--muted); text-align: left; font-weight: 650; }
.nav-button:hover { background: var(--surface-soft); color: var(--text); }
.nav-button.active { background: var(--primary-soft); color: var(--primary); }
.nav-icon { font-size: 19px; width: 24px; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 14px; border-radius: 16px; background: var(--surface-soft); border: 1px solid var(--border); }
.sidebar-foot strong { display: block; margin-bottom: 4px; }
.sidebar-foot small { color: var(--muted); line-height: 1.45; }

.main { min-width: 0; padding: 0 30px 110px; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 18px; position: sticky; top: 0; z-index: 15; background: rgba(244,247,251,.88); backdrop-filter: blur(18px); }
.topbar h1 { margin: 0; font-size: 25px; letter-spacing: -.02em; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.profile-pill { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); padding: 8px 11px; border-radius: 999px; box-shadow: 0 4px 16px rgba(31,50,81,.05); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.profile-pill strong { font-size: 14px; display: block; }
.profile-pill span { font-size: 12px; color: var(--muted); }
.content { max-width: 1180px; margin: 0 auto; }

.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(250px, .55fr); gap: 18px; margin-bottom: 22px; }
.hero-main { padding: 30px; color: #fff; border-radius: 28px; background: radial-gradient(circle at 85% 15%, rgba(255,255,255,.24), transparent 25%), linear-gradient(135deg, #2f6fed 0%, #315bd6 55%, #5447c7 100%); box-shadow: 0 18px 48px rgba(47,111,237,.22); overflow: hidden; position: relative; }
.hero-main::after { content: ""; position: absolute; width: 210px; height: 210px; border-radius: 50%; background: rgba(255,255,255,.08); right: -80px; bottom: -110px; }
.hero-kicker { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.16); font-size: 12px; font-weight: 750; }
.hero h2 { font-size: clamp(26px, 4vw, 40px); margin: 18px 0 10px; letter-spacing: -.035em; max-width: 650px; }
.hero p { margin: 0 0 22px; max-width: 650px; color: rgba(255,255,255,.83); line-height: 1.6; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 2; }
.hero-side { display: grid; gap: 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 5px 24px rgba(31,50,81,.045); }
.card-pad { padding: 22px; }
.metric-card { padding: 20px; display: flex; flex-direction: column; justify-content: space-between; min-height: 124px; }
.metric-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.metric-icon { font-size: 22px; }
.metric-value { font-size: 30px; font-weight: 850; margin-top: 8px; letter-spacing: -.03em; }
.metric-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

.section { margin-top: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 20px; }
.section-head p { color: var(--muted); margin: 5px 0 0; font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.btn { min-height: 44px; border: 0; border-radius: 13px; padding: 10px 17px; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 7px 18px rgba(47,111,237,.2); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--primary-soft); color: var(--primary); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-white { background: #fff; color: var(--primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-icon { width: 44px; padding: 0; }
.btn-wide { width: 100%; }

.lesson-card { padding: 19px; display: grid; gap: 14px; transition: .18s ease; }
.lesson-card:hover { border-color: #cbd8f6; transform: translateY(-2px); box-shadow: var(--shadow); }
.lesson-top { display: flex; align-items: flex-start; gap: 13px; }
.lesson-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: var(--surface-soft); font-size: 25px; flex: 0 0 auto; }
.lesson-title { margin: 0; font-size: 16px; }
.lesson-goal { margin: 5px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 700; }
.chip.success { background: var(--success-soft); color: var(--success); }
.chip.primary { background: var(--primary-soft); color: var(--primary); }
.progress-track { height: 8px; background: #edf0f5; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #6a8cff); }

.skill-card { padding: 18px; }
.skill-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.skill-row strong { font-size: 14px; }
.skill-row span { font-size: 13px; color: var(--muted); }

.empty { padding: 44px 20px; text-align: center; }
.empty-icon { font-size: 46px; margin-bottom: 12px; }
.empty h3 { margin: 0 0 8px; }
.empty p { margin: 0 auto 18px; max-width: 460px; color: var(--muted); line-height: 1.6; }

.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 750; }
.field small { color: var(--muted); line-height: 1.45; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 13px; padding: 12px 13px; outline: none; transition: .15s; }
.textarea { resize: vertical; min-height: 90px; }
.input:focus, .select:focus, .textarea:focus { border-color: #83a5f6; box-shadow: 0 0 0 4px rgba(47,111,237,.09); }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option-card { position: relative; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card label { display: flex; gap: 10px; align-items: center; min-height: 58px; padding: 13px; border: 1px solid var(--border); border-radius: 14px; background: #fff; cursor: pointer; font-weight: 700; }
.option-card input:checked + label { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

.onboarding { min-height: 100vh; padding: 34px 18px; display: grid; place-items: center; background: radial-gradient(circle at top left, #dbe8ff, transparent 34%), radial-gradient(circle at bottom right, #eee5ff, transparent 30%), var(--bg); }
.onboarding-card { width: min(920px, 100%); display: grid; grid-template-columns: .85fr 1.15fr; overflow: hidden; border-radius: 30px; background: #fff; box-shadow: 0 24px 70px rgba(31,50,81,.15); border: 1px solid rgba(255,255,255,.7); }
.onboarding-aside { padding: 42px; color: #fff; background: linear-gradient(150deg, #2f6fed, #4f46b9); }
.onboarding-aside .brand-mark { background: rgba(255,255,255,.18); box-shadow: none; }
.onboarding-aside h1 { font-size: 37px; line-height: 1.06; margin: 50px 0 16px; letter-spacing: -.04em; }
.onboarding-aside p { color: rgba(255,255,255,.82); line-height: 1.65; }
.feature-mini { display: grid; gap: 12px; margin-top: 35px; }
.feature-mini div { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.onboarding-form { padding: 38px; }
.onboarding-form h2 { margin: 0 0 7px; font-size: 25px; }
.onboarding-form > p { margin: 0 0 24px; color: var(--muted); }

.lesson-player { min-height: 100vh; background: var(--bg); padding: 18px; }
.player-shell { width: min(900px, 100%); min-height: calc(100vh - 36px); margin: 0 auto; display: flex; flex-direction: column; }
.player-top { display: flex; align-items: center; gap: 14px; padding: 8px 0 18px; }
.player-progress { flex: 1; }
.player-body { flex: 1; display: grid; place-items: center; }
.player-card { width: min(720px, 100%); padding: clamp(22px, 5vw, 42px); background: #fff; border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow); }
.player-card h1, .player-card h2 { margin-top: 0; }
.player-card p { line-height: 1.65; }
.player-foot { width: min(720px, 100%); margin: 18px auto 0; display: flex; justify-content: space-between; gap: 10px; }
.step-label { color: var(--primary); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.phrase-main { font-size: clamp(28px, 5vw, 44px); line-height: 1.25; margin: 20px 0 9px; font-weight: 850; letter-spacing: -.025em; }
.phrase-meaning { font-size: 17px; color: var(--muted); }
.phrase-actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.vocab-count { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; }
.example-box { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 16px; padding: 15px; margin-top: 12px; }
.example-box strong { display: block; margin-bottom: 6px; }
.listen-prompt { min-height: 150px; display: grid; place-items: center; text-align: center; border-radius: 20px; background: var(--primary-soft); margin: 22px 0; }
.listen-prompt button { width: 70px; height: 70px; border-radius: 50%; font-size: 28px; }
.answer-list { display: grid; gap: 10px; margin-top: 18px; }
.answer { width: 100%; min-height: 52px; text-align: left; border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 14px; padding: 12px 14px; font-weight: 650; }
.answer:hover { border-color: #9db8f5; background: var(--primary-soft); }
.answer.correct { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.answer.wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.speech-target { text-align: center; padding: 24px; background: var(--surface-soft); border-radius: 18px; margin: 18px 0; }
.speech-target strong { font-size: 25px; display: block; margin-bottom: 8px; }
.mic-button { width: 82px; height: 82px; border-radius: 50%; margin: 20px auto; display: grid; place-items: center; border: 0; background: var(--primary); color: #fff; font-size: 31px; box-shadow: 0 12px 26px rgba(47,111,237,.27); }
.mic-button.listening { animation: pulse 1.2s infinite; background: var(--danger); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(201,59,75,.28); } 50% { box-shadow: 0 0 0 18px rgba(201,59,75,0); } }
.score-ring { width: 112px; height: 112px; border-radius: 50%; margin: 18px auto; display: grid; place-items: center; background: conic-gradient(var(--success) var(--score), #edf0f5 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #fff; }
.score-ring strong { position: relative; font-size: 25px; }
.dialogue { display: grid; gap: 12px; margin-top: 20px; }
.dialogue-line { display: flex; gap: 10px; align-items: flex-start; }
.dialogue-line.learner { flex-direction: row-reverse; }
.bubble { max-width: 78%; padding: 12px 15px; border-radius: 17px; background: var(--surface-soft); line-height: 1.5; }
.dialogue-line.learner .bubble { background: var(--primary); color: #fff; }
.result-icon { font-size: 64px; text-align: center; }
.result-score { text-align: center; font-size: 44px; font-weight: 900; margin: 10px 0; }

.role-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; min-height: 620px; }
.role-list { padding: 14px; display: grid; gap: 8px; align-content: start; }
.role-button { border: 1px solid transparent; background: transparent; text-align: left; border-radius: 14px; padding: 12px; display: flex; gap: 11px; }
.role-button:hover { background: var(--surface-soft); }
.role-button.active { border-color: #c7d6fa; background: var(--primary-soft); color: var(--primary); }
.role-button strong { display: block; font-size: 14px; }
.role-button small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.chat-panel { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.chat-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.chat-head h3 { margin: 0; }
.chat-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.chat-log { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; min-height: 420px; max-height: 560px; }
.chat-line { display: flex; gap: 9px; align-items: flex-end; }
.chat-line.user { flex-direction: row-reverse; }
.chat-message { max-width: min(76%, 580px); white-space: pre-wrap; line-height: 1.55; border-radius: 18px 18px 18px 5px; padding: 12px 15px; background: var(--surface-soft); border: 1px solid var(--border); }
.chat-line.user .chat-message { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 18px 18px 5px 18px; }
.chat-compose { padding: 15px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: end; }
.chat-compose textarea { min-height: 46px; max-height: 120px; resize: vertical; }
.typing { display: inline-flex; gap: 4px; padding: 13px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce .9s infinite alternate; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { to { transform: translateY(-5px); opacity: .45; } }

.review-card { max-width: 650px; margin: 40px auto; padding: 36px; text-align: center; }
.review-target { font-size: clamp(30px, 6vw, 50px); font-weight: 850; margin: 28px 0 12px; }
.review-answer { font-size: 20px; color: var(--muted); margin: 14px 0 24px; }
.rating-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 22px; }
.rating { border: 1px solid var(--border); background: #fff; border-radius: 13px; padding: 12px 6px; font-weight: 750; }
.rating small { display: block; color: var(--muted); margin-top: 4px; font-weight: 500; }

.table-list { display: grid; }
.table-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 100px; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.table-row:last-child { border-bottom: 0; }
.table-row small { color: var(--muted); }

.setting-section { padding: 22px; margin-bottom: 16px; }
.setting-section h3 { margin: 0 0 5px; }
.setting-section > p { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.inline-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.notice { border-radius: 14px; padding: 13px 15px; background: var(--warning-soft); color: #7b4b00; line-height: 1.5; font-size: 13px; }
.notice.success { background: var(--success-soft); color: var(--success); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }

.mobile-nav { display: none; }
.toast-root { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 9px; z-index: 100; pointer-events: none; }
.toast { min-width: 250px; max-width: 420px; background: #172033; color: #fff; padding: 13px 15px; border-radius: 13px; box-shadow: var(--shadow); animation: toastIn .2s ease; }
.toast.success { background: #126b49; }
.toast.error { background: #9f2938; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.loader { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.35); border-top-color: currentColor; border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

@media (max-width: 980px) {
  :root { --sidebar: 210px; }
  .main { padding-inline: 20px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .hero-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-grid { grid-template-columns: 270px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .main { padding: env(safe-area-inset-top) 14px calc(90px + env(safe-area-inset-bottom)); }
  .topbar { height: 68px; top: env(safe-area-inset-top); }
  .topbar h1 { font-size: 21px; }
  .topbar p, .profile-pill > div:last-child { display: none; }
  .profile-pill { padding: 5px; }
  .content { width: 100%; }
  .mobile-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 50; background: rgba(255,255,255,.96); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 12px 40px rgba(31,50,81,.18); backdrop-filter: blur(18px); padding: 5px; }
  .mobile-nav button { border: 0; background: transparent; color: var(--muted); min-width: 0; padding: 7px 2px; border-radius: 14px; font-size: 10px; font-weight: 700; }
  .mobile-nav button span { display: block; font-size: 20px; margin-bottom: 2px; }
  .mobile-nav button.active { background: var(--primary-soft); color: var(--primary); }
  .hero-main { padding: 23px; border-radius: 23px; }
  .hero h2 { font-size: 29px; }
  .hero-side { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 110px; padding: 16px; }
  .metric-value { font-size: 24px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .onboarding { padding: 12px; place-items: start center; }
  .onboarding-card { grid-template-columns: 1fr; border-radius: 24px; }
  .onboarding-aside { padding: 25px; }
  .onboarding-aside h1 { margin: 25px 0 10px; font-size: 31px; }
  .feature-mini { display: none; }
  .onboarding-form { padding: 25px; }
  .option-grid { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: 1fr; min-height: 0; }
  .role-list { display: flex; overflow-x: auto; padding: 10px; }
  .role-button { flex: 0 0 210px; }
  .chat-log { min-height: 360px; max-height: 54vh; }
  .chat-message { max-width: 86%; }
  .chat-compose { padding: 10px; }
  .player-card { border-radius: 22px; }
  .player-foot { position: sticky; bottom: 0; padding: 10px 0 max(10px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 20%); }
  .rating-grid { grid-template-columns: repeat(2, 1fr); }
  .table-row { grid-template-columns: minmax(0, 1fr) 80px; }
  .table-row > :nth-child(3) { display: none; }
}

@media (max-width: 420px) {
  .hero-side { grid-template-columns: 1fr; }
  .hero-actions .btn { width: 100%; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .phrase-main { font-size: 31px; }
  .player-card { padding: 21px; }
  .profile-pill { display: none; }
}


/* PWA install, update and offline states */
.pwa-banner { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 120; width: min(620px, calc(100% - 24px)); display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 18px; background: rgba(255,255,255,.97); box-shadow: 0 18px 55px rgba(31,50,81,.22); backdrop-filter: blur(18px); }
.pwa-banner img { border-radius: 12px; }
.pwa-banner strong, .pwa-banner span { display: block; }
.pwa-banner span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.pwa-close { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.pwa-update { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 130; width: min(560px, calc(100% - 24px)); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: #172033; color: #fff; box-shadow: 0 14px 45px rgba(0,0,0,.25); }
.pwa-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); }
.pwa-setting-row strong, .pwa-setting-row span { display: block; }
.pwa-setting-row span { margin-top: 4px; color: var(--muted); font-size: 13px; }
body.is-offline::before { content: 'Đang ngoại tuyến — dữ liệu học vẫn được lưu trên thiết bị'; position: fixed; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 140; width: max-content; max-width: calc(100% - 24px); padding: 8px 13px; border-radius: 999px; background: #7b4b00; color: #fff; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); }
.pwa-standalone .pwa-setting-card [data-pwa-install] { display: none; }

@media (max-width: 760px) {
  .pwa-banner { bottom: calc(92px + env(safe-area-inset-bottom)); grid-template-columns: auto minmax(0,1fr) auto; }
  .pwa-banner .btn { grid-column: 2 / 3; justify-self: start; }
  .pwa-banner .pwa-close { grid-column: 3; grid-row: 1; }
  .pwa-update { align-items: stretch; flex-direction: column; }
  .pwa-setting-row { align-items: stretch; flex-direction: column; }
}
