/* [ИЗМЕНЕНО v5.2] Светлая тема + верстка вкладок, title-строки и карточек */
:root{
  --bg:#ffffff;
  --fg:#0f172a;
  --muted:#64748b;
  --line:#e2e8f0;
  --card:#ffffff;
  --acc:#2563eb;
  --acc-hover:#1d4ed8;
  --shadow:0 6px 20px rgba(2,6,23,.06);
}
*{box-sizing:border-box}
html,body{height:100%;overflow-x:hidden;max-width:100%}
body{margin:0;background:var(--bg);color:var(--fg);font:16px/1.5 system-ui,Segoe UI,Roboto,Arial}
/* header */
.header{background:#fff;border-bottom:1px solid var(--line);position:static}
.container{max-width:960px;margin:0 auto;padding:16px}
.header h1{margin:0;font-size:20px}
/* вкладки слева + имя справа */
.header .tabsbar{display:flex;align-items:center;justify-content:space-between;margin-top:6px}
.header nav{display:flex;gap:16px}
.header nav a{
  color:var(--muted);text-decoration:none;padding:6px 0;border-bottom:2px solid transparent
}
.header nav a:hover{color:var(--fg);border-color:var(--line)}
.header nav a.active{color:var(--acc);border-color:var(--acc)}
.user-mini{color:var(--muted);font-weight:600;white-space:nowrap}
/* [ДОБАВЛЕНО v5.7] На всякий случай полностью скрываем user-mini, */
.user-mini{display:none !important}
/* [ДОБАВЛЕНО v5.2] строка с заголовком слева и локальными вкладками справа */
.subbar{display:flex;align-items:center;justify-content:space-between;margin:10px 0 6px 0}
.subtabs{display:flex;gap:16px}
.subtabs a{color:var(--muted);text-decoration:none;padding:6px 0;border-bottom:2px solid transparent}
.subtabs a:hover{color:var(--fg);border-color:var(--line)}
.subtabs a.active{color:var(--acc);border-color:var(--acc)}
/* [ДОБАВЛЕНО v5.5] компактный левый заголовок в subbar */
.sub-title{font-size:16px;font-weight:600;color:var(--fg);white-space:nowrap}
h2{margin:0;font-size:20px}
h3{margin:10px 0 6px 0;color:var(--fg)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px;margin-top:12px}
.card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:14px;box-shadow:var(--shadow);transition:opacity .2s ease, transform .2s ease}
.card-title{font-weight:650;font-size:16px;color:var(--fg)}
.card-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}
.chk{display:inline-flex;align-items:center}
.chk input{width:18px;height:18px;cursor:pointer}
.card-sub{color:var(--muted);margin-bottom:8px}
.sentences div{margin:4px 0}
.toolbar{display:flex;gap:12px;align-items:center;margin:8px 0 12px}
.row{display:flex;gap:12px;flex-wrap:wrap;margin:6px 0}
button{background:var(--acc);border:none;color:#fff;padding:9px 14px;border-radius:10px;cursor:pointer}
button:hover{background:var(--acc-hover)}
audio{width:100%}
a{color:inherit;text-decoration:none}
a.card .card-title{color:var(--acc)}
a.card:hover .card-title{color:var(--acc-hover);text-decoration:underline}
.word-list{margin-top:8px;border-top:1px dashed var(--line);padding-top:8px;display:none}
.word-list.visible{display:block}
.word-line{display:flex;gap:8px;padding:3px 0}
.word-line b{font-weight:700}
.word-dash::before{content:"—";margin:0 4px;color:var(--muted)}
.word-toggle{cursor:pointer;color:var(--acc)}
.word-toggle:hover{color:var(--acc-hover);text-decoration:underline}
/* [ДОБАВЛЕНО v5.8] Панель аккаунта в шапке */
.account-panel{
  margin-top:10px;
  background:#f8fafc;
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 12px;
  box-shadow:var(--shadow);
  color:#0f172a;
}
.account-panel .acc-row{
  display:flex;
  flex-wrap:wrap;
  gap:12px 18px;
  align-items:center;
}
.account-panel .acc-item{
  font-size:13px;
  color:#334155;
}
.account-panel .acc-item b{ color:#0f172a; font-weight:600; }
.account-panel .acc-badge{
  margin-left:auto;
  font-size:12px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid #94a3b8;
  color:#334155;
  background:#fff;
}
.account-panel .acc-badge.ok{ border-color:#22c55e; color:#065f46; background:#ecfdf5; }
/* [ДОБАВЛЕНО v5.9] Визуал скрытого урока */
.card.is-hidden{ opacity:.55 }
/* ----------------------------- */
/* [ДОБАВЛЕНО v8.9] AUDIO КНОПКА */
/* ----------------------------- */
.audio-btn{
  background:#fff;
  color:var(--acc);
  border:1px solid var(--line);
  border-radius:9999px;
  width:36px; height:36px;
  display:grid; place-items:center;
  font-size:14px; line-height:1;
  padding:0;
  box-shadow:0 1px 2px rgba(2,6,23,.06);
  transition:transform .08s ease, box-shadow .2s ease, background .2s ease;
}
.audio-btn.mini{ width:28px; height:28px; font-size:12px; }
.audio-btn:hover{ box-shadow:0 3px 10px rgba(2,6,23,.12); background:#f8fafc; }
.audio-btn:active{ transform:scale(.92); }
/* Пульс при нажатии */
@keyframes audio-pulse{
  0%{ box-shadow:0 0 0 0 rgba(37,99,235,.45); }
  70%{ box-shadow:0 0 0 10px rgba(37,99,235,0); }
  100%{ box-shadow:0 0 0 0 rgba(37,99,235,0); }
}
.audio-btn.playing{
  animation:audio-pulse .8s ease-out 1;
}

/* =============================== */
/* [ДОБАВЛЕНО v5.11] Шапочный таймер */
/* =============================== */
.daily-timer{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 12px;
  background:#f8fafc;
  border:1px solid var(--line);
  border-radius:999px;
  box-shadow:var(--shadow);
  width:max-content;
}
.daily-timer .dt-label{
  font-size:13px;
  color:#334155;
  white-space:nowrap;
}
.daily-timer .dt-time{
  font-weight:800;
  font-variant-numeric: tabular-nums;
  letter-spacing:.5px;
  padding:4px 10px;
  border-radius:8px;
  background:#ffffff;
  border:1px solid #e2e8f0;
  min-width:64px;
  text-align:center;
}
.daily-timer.done .dt-time{
  background:#ecfdf5;
  border-color:#86efac;
  color:#065f46;
}
.floating-timer{
  position:fixed;
  top:calc(12px + env(safe-area-inset-top));
  left:calc(12px + env(safe-area-inset-left));
  display:none;
  align-items:center;
  justify-content:center;
  min-width:64px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  color:#0f172a;
  font-weight:800;
  font-variant-numeric:tabular-nums;
  box-shadow:0 6px 18px rgba(2,6,23,.18);
  cursor:grab;
  user-select:none;
  touch-action:none;
  z-index:900;
}
.floating-timer.is-visible{ display:flex; }
.floating-timer.dragging{
  cursor:grabbing;
  box-shadow:0 12px 30px rgba(2,6,23,.25);
}
.pill-btn{
  display:inline-flex; align-items:center; gap:6px;
  padding:10px 14px; border-radius:999px;
  border:1px solid #d0d7e2; background:#9bd8f1; color:#1e293b;
  text-decoration:none; font-size:14px; line-height:1; transition:.2s;
}
.pill-btn:hover{ background:#eef2ff; border-color:#bcd; }
.pill-btn.ghost{ background:#fff; }
.pill-btn.small{ padding:6px 10px; font-size:13px; }

body.modal-open{ overflow:hidden; }

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:1000;
  backdrop-filter:blur(2px);
}
.modal-backdrop.is-open,
.modal-backdrop.is-closing{ display:flex; }
.modal-backdrop.is-open{ animation:modalFadeIn .18s ease-out; }
.modal-backdrop.is-closing{ animation:modalFadeOut .18s ease-in; }

.modal-backdrop .modal{
  width:min(420px,92vw);
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 20px 60px rgba(2,6,23,.25);
  transform:translateY(8px) scale(.98);
  opacity:0;
}
.modal-backdrop.is-open .modal{ animation:modalPopIn .22s ease-out forwards; }
.modal-backdrop.is-closing .modal{ animation:modalPopOut .18s ease-in forwards; }

.modal-backdrop .modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 16px 6px 16px;
  border-bottom:1px solid var(--line);
}
.modal-backdrop .modal-title{ font-size:16px; font-weight:700; }
.modal-backdrop .modal-close{
  border:none;
  background:transparent;
  color:var(--muted);
  font-size:20px;
  width:32px;
  height:32px;
  border-radius:8px;
  cursor:pointer;
}
.modal-backdrop .modal-close:hover{ background:#f1f5f9; color:var(--fg); }

.modal-backdrop .modal-body{ padding:12px 16px 4px 16px; color:#334155; }
.modal-backdrop .modal-body p{ margin:0 0 10px 0; }

.modal-backdrop .modal-status{
  display:none;
  align-items:center;
  gap:8px;
  font-size:13px;
  color:#475569;
}
.modal-backdrop .modal-status.is-visible{ display:flex; }
.modal-backdrop .modal-status.success{ color:#16a34a; }
.modal-backdrop .modal-status.error{ color:#dc2626; }
.modal-backdrop .modal-status.success .spinner,
.modal-backdrop .modal-status.error .spinner{ display:none; }

.modal-backdrop .spinner{
  width:16px;
  height:16px;
  border:2px solid #94a3b8;
  border-right-color:transparent;
  border-radius:50%;
  animation:spin .8s linear infinite;
}

.modal-backdrop .modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  padding:10px 16px 16px 16px;
}
.modal-note{ margin-right:auto; font-size:12px; color:var(--muted); align-self:center; }
.modal-empty{ display:none; font-size:13px; color:var(--muted); margin-bottom:8px; }

.lesson-list{
  display:flex;
  flex-direction:column;
  gap:6px;
  max-height:240px;
  overflow-y:auto;
  margin-bottom:8px;
  padding-right:4px;
}
.lesson-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#f8fafc;
}
.lesson-check{ display:flex; align-items:center; gap:8px; }
.lesson-check input{ width:18px; height:18px; cursor:pointer; }
.lesson-title{ font-size:14px; }
.lesson-meta{ font-size:12px; color:var(--muted); white-space:nowrap; }

.ghost-btn{
  background:#fff;
  color:var(--fg);
  border:1px solid var(--line);
}
.ghost-btn:hover{ background:#f8fafc; }
.danger-btn{ background:#ef4444; }
.danger-btn:hover{ background:#dc2626; }
.danger-btn:disabled,
.ghost-btn:disabled,
.modal-backdrop .modal-close:disabled{ opacity:.6; cursor:not-allowed; }

@keyframes modalFadeIn{ from{opacity:0} to{opacity:1} }
@keyframes modalFadeOut{ from{opacity:1} to{opacity:0} }
@keyframes modalPopIn{ from{opacity:0;transform:translateY(8px) scale(.96)} to{opacity:1;transform:translateY(0) scale(1)} }
@keyframes modalPopOut{ from{opacity:1;transform:translateY(0) scale(1)} to{opacity:0;transform:translateY(8px) scale(.96)} }
@keyframes spin{ to{transform:rotate(360deg)} }

@media (prefers-reduced-motion: reduce){
  .modal-backdrop,
  .modal-backdrop .modal{ animation:none !important; }
  .modal-backdrop .spinner{ animation:none; }
}
/* Конец добавления таймера */

/* ── Узкие экраны (Galaxy Fold внешний ~300px, старые телефоны) ── */
@media (max-width:380px){
  .container{ padding:10px; }
  /* Таймер: убираем подпись и кнопку перезапуска — влезает компактно */
  .daily-timer{ gap:6px; padding:6px 10px; flex-wrap:nowrap; }
  .daily-timer .dt-label{ display:none; }
  #dt_restart{ display:none !important; }
  .pill-btn.small{ padding:5px 8px; font-size:12px; }
}
