/* EDVERSE AI Interviewer — светлая тема под стиль личного кабинета:
   светло-серый фон, белые карточки с крупным радиусом, синий акцент, капсовые подписи. */

:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --bg-soft: #f7f8fc;
  --surface-3: #eef0f7;
  --card: #ffffff;
  --line: #e6e9f2;
  --line-soft: #eef0f6;

  --text: #12151f;
  --text-2: #3d4358;
  --muted: #6e7488;
  --faint: #9aa0b4;   /* декоративное: id фрагментов, футер */
  --label: #6b7186;   /* капсовые подписи — несут смысл, поэтому читаемый контраст */

  --accent: #3b5bfe;
  --accent-hover: #2f4cf0;
  --accent-soft: #eaeeff;
  --accent-ink: #2740c9;

  --ok: #12a877;
  --ok-soft: #e6f7f1;
  --warn: #e08c00;
  --warn-soft: #fdf3e2;
  --err: #e0484d;
  --err-soft: #fdecee;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 26px -14px rgba(16, 24, 40, .22);
}

* { box-sizing: border-box; }

/* The UI toggles visibility with the `hidden` attribute, and several classes below set an
   author-level `display` that would otherwise beat the UA `[hidden] { display: none }`
   rule — leaving the recording indicator, the stop button and the spinner permanently on
   screen. This must stay above those rules and keep !important. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

::selection { background: var(--accent-soft); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 16px calc(44px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- topbar ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 4px 0 20px;
}
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; flex: none; border-radius: 11px;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 17px; box-shadow: 0 4px 12px -4px rgba(59, 91, 254, .6);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 16px; color: var(--text); letter-spacing: -.01em; }
.brand-sub {
  color: var(--label); font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
}

.topbar-meta {
  display: flex; gap: 10px; align-items: center;
  font-size: 13px; color: var(--muted); flex-wrap: wrap;
}
.meta-module { color: var(--text); font-weight: 600; }

.content { flex: 1; }
.footer { color: var(--faint); font-size: 12px; text-align: center; padding-top: 30px; }

/* ---------- hero ---------- */

.hero { padding: 2px 2px 20px; }
.hero h1 {
  font-size: clamp(25px, 4.6vw, 34px); line-height: 1.15; margin: 0 0 10px;
  letter-spacing: -.025em; font-weight: 800; text-wrap: balance;
}
.lead { color: var(--muted); margin: 0; max-width: 62ch; }

/* ---------- cards ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.card h2 { margin: 0 0 10px; font-size: 19px; font-weight: 800; letter-spacing: -.015em; }
.card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }

.card-inline {
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 16px;
}
.card-inline summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.rules { color: var(--muted); margin: 10px 0 2px; padding-left: 20px; font-size: 14px; }
.rules li { margin-bottom: 5px; }

.section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--label); margin: 22px 0 10px;
}

/* ---------- forms ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 700; color: var(--text-2); }

input[type=text], input[type=password], input[type=file], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 12px 14px; font: inherit; font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 91, 254, .14);
}
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 38px;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

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

/* ---------- buttons ---------- */

.btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 18px; font: inherit; font-weight: 650; font-size: 15px; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .08s, color .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px rgba(59,91,254,.75); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-soft); border-color: #d9dded; }
.btn-danger { background: var(--err-soft); color: #b3383c; border-color: #f6d3d5; }
.btn-danger:hover:not(:disabled) { background: #fbe0e2; }
.btn-lg { width: 100%; min-height: 50px; font-size: 16px; }
.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-row .btn { flex: 1 1 auto; }

/* ---------- banners ---------- */

.banner {
  border-radius: var(--radius-sm); padding: 13px 15px; font-size: 14px; margin-bottom: 14px;
  display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.banner-error { background: var(--err-soft); border: 1px solid #f6d3d5; color: #a5343a; }
.banner-warn { background: var(--warn-soft); border: 1px solid #f5e1bd; color: #8a5b00; }

/* ---------- status ---------- */

.state-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); white-space: nowrap;
}
.state-pill[data-state=recording] { color: #b3383c; border-color: #f3cdcf; background: var(--err-soft); }
.state-pill[data-state=ready], .state-pill[data-state=ok] { color: #0d7d59; border-color: #bfe8d9; background: var(--ok-soft); }
.state-pill[data-state=busy], .state-pill[data-state=loading] { color: var(--accent-ink); border-color: #ccd6ff; background: var(--accent-soft); }
.state-pill[data-state=error] { color: #b3383c; border-color: #f3cdcf; background: var(--err-soft); }

.stage-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 14px; }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; font-weight: 600; }

.progress-track { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .35s ease; }

/* ---------- question ---------- */

.question-head { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.badge {
  font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid #d6dfff;
}
.badge-soft { background: var(--warn-soft); color: #8a5b00; border-color: #f5e1bd; }
.question-text {
  font-size: clamp(18px, 3.2vw, 21px); line-height: 1.45; margin: 0 0 20px;
  font-weight: 650; letter-spacing: -.012em; text-wrap: pretty;
}

/* ---------- recorder ---------- */

.recorder { border-top: 1px solid var(--line-soft); padding-top: 18px; }
.rec-indicator {
  display: flex; align-items: center; gap: 10px; font-size: 14px; color: #b3383c;
  margin-bottom: 10px; font-weight: 700;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--err); animation: pulse 1.1s infinite; }
.rec-time { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text); }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.8); } }

.level-track { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.level-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--ok), var(--accent)); transition: width .08s linear; }

.playback { margin-top: 14px; }
audio { width: 100%; margin-bottom: 4px; }
.transcript { border-top: 1px solid var(--line-soft); margin-top: 18px; padding-top: 16px; }

.busy { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin-top: 16px; font-weight: 600; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2.5px solid var(--surface-3); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mic-check { background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 14px; }
.mic-check-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.finish-row { text-align: center; margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .rec-dot, .spinner { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* ---------- report ---------- */

.report-body { display: flex; flex-direction: column; gap: 16px; }
.score-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.score-ring {
  width: 104px; height: 104px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 29px; font-weight: 800;
  color: var(--accent-ink); font-variant-numeric: tabular-nums;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface-3) 0);
  position: relative;
}
.score-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.score-ring span { position: relative; }

.verdict { margin: 0 0 2px; font-size: clamp(25px, 4.6vw, 32px); font-weight: 800; letter-spacing: -.025em; }
.verdict-pass { color: var(--ok); }
.verdict-fail { color: var(--err); }
.verdict-sub { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.level-text { font-size: 17px; font-weight: 700; margin: 0 0 4px; }

.encouragement {
  margin: 12px 0 0; padding: 13px 15px; font-size: 14px; line-height: 1.55;
  background: var(--ok-soft); border-left: 3px solid var(--ok);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: #0b6b4d;
}

.qa { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; background: var(--surface); }
.qa-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.qa-score { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent-ink); font-size: 15px; }
.qa-body { display: flex; flex-direction: column; gap: 12px; }
.qa-block-label {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--label); margin-bottom: 4px;
}
.qa-text { font-size: 14px; line-height: 1.6; color: var(--text-2); }

.src { font-size: 13px; color: var(--muted); }
.src-line { margin-bottom: 4px; }
code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; color: var(--text-2);
}

.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.tag { font-size: 12px; padding: 5px 11px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text-2); }

/* ---------- lesson fragments ---------- */

.fragment { margin: 6px 0 12px; }
.fragment summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 650; padding: 4px 0; list-style: none; }
.fragment summary::-webkit-details-marker { display: none; }
.fragment summary::before { content: "▸ "; }
.fragment[open] summary::before { content: "▾ "; }
.fragment-text {
  background: var(--bg-soft); border: 1px solid var(--line-soft); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 13px 15px;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap; color: var(--text-2);
}
.review-lesson { margin-bottom: 20px; }
.review-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.review-title { font-weight: 700; font-size: 15px; }
.review-topics { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.review-fragment { margin-bottom: 10px; }
.fragment-id { display: inline-block; margin-top: 5px; font-size: 11px; color: var(--faint); }

.bonus-note {
  border-left: 3px solid var(--warn); padding: 12px 15px; margin-bottom: 12px;
  background: var(--warn-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px; color: #8a5b00;
}

/* ---------- admin ---------- */

.admin-shell { max-width: 1180px; }

.admin-nav {
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 6px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.admin-nav a {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650;
  padding: 8px 14px; border-radius: var(--radius-xs); transition: background .15s, color .15s;
}
.admin-nav a:hover { background: var(--bg-soft); color: var(--text); }
.admin-nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.admin-nav .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px 16px; }
.stat-label {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--label); margin-bottom: 6px;
}
.stat-value { font-size: 25px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); }
table.grid th {
  text-align: left; padding: 11px 13px; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--label);
  background: var(--bg-soft); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.grid td { padding: 11px 13px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--text-2); }
table.grid tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover td { background: var(--bg-soft); }
table.grid a { color: var(--accent); text-decoration: none; font-weight: 600; }
table.grid a:hover { text-decoration: underline; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chip {
  display: inline-block; font-size: 12px; font-weight: 650; padding: 4px 10px;
  border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--text-2); white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); border-color: #bfe8d9; color: #0d7d59; }
.chip.warn { background: var(--warn-soft); border-color: #f5e1bd; color: #8a5b00; }
.chip.err { background: var(--err-soft); border-color: #f3cdcf; color: #b3383c; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 168px; flex: 1 1 168px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kv-item { background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-xs); padding: 11px 13px; }
.kv-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--label); margin-bottom: 3px;
}
.kv-value { font-size: 14px; font-weight: 650; word-break: break-word; }

.pre {
  white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.6; background: var(--bg-soft);
  border: 1px solid var(--line-soft); border-radius: var(--radius-xs);
  padding: 13px; max-height: 460px; overflow: auto; color: var(--text-2);
}
.plain { font-size: 14px; line-height: 1.6; color: var(--text-2); }
.block { margin-bottom: 14px; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack > input, .stack > select, .stack > textarea { width: 100%; }

.pick-list {
  max-height: 380px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px; background: var(--bg-soft);
}
.pick-row {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px;
  border-radius: var(--radius-xs); cursor: pointer; font-size: 14px; line-height: 1.45;
}
.pick-row:hover { background: var(--surface); }
.pick-row input { margin-top: 3px; flex: none; accent-color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; z-index: 50; box-shadow: var(--shadow);
  max-width: min(92vw, 520px); text-align: center;
}

/* ---------- responsive ---------- */

@media (max-width: 560px) {
  .shell { padding: 14px 12px calc(36px + env(safe-area-inset-bottom)); }
  .card { padding: 17px; border-radius: 15px; }
  .score-hero { gap: 16px; }
  .score-ring { width: 84px; height: 84px; font-size: 24px; }
  .score-ring::before { inset: 8px; }
  .admin-nav { padding: 5px; }
  .admin-nav a { padding: 7px 11px; font-size: 13px; }
}

/* Distinct entry points: neither format shares a start form. */
.mode-hero { margin-bottom: 28px; }
.mode-eyebrow { margin: 0 0 10px; color: var(--accent-ink); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.mode-card { display: flex; flex-direction: column; min-width: 0; padding: 28px; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 20px; background: white; box-shadow: var(--shadow-sm); }
.mode-card-legend { border-top-color: #8054d8; }
.mode-card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 25px; }
.mode-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-ink); font-size: 17px; font-weight: 750; }
.mode-duration { padding: 5px 10px; border: 1px solid var(--line); border-radius: 30px; color: var(--text-2); font-size: 12px; font-weight: 650; white-space: nowrap; }
.mode-card h2 { margin: 0 0 12px; font-size: 27px; line-height: 1.2; letter-spacing: -.03em; }
.mode-description { min-height: 3.1em; margin: 0; color: var(--muted); }
.mode-features { list-style: none; padding: 0; margin: 24px 0 28px; }
.mode-features li { display: flex; flex-direction: column; gap: 3px; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.mode-features strong { font-size: 12px; color: var(--text-2); }
.mode-features span { font-size: 14px; color: var(--muted); }
.mode-cta { margin-top: auto; width: 100%; justify-content: space-between; gap: 12px; }
.mode-card-legend .mode-eyebrow { color: #6a3eb7; }
.mode-card-legend .mode-icon { color: #6a3eb7; background: #f0eafb; }
.mode-legend-button { color: #fff; background: #7042c1; border-color: #7042c1; }
.mode-legend-button:hover { color: #fff; background: #5f35aa; border-color: #5f35aa; }
.mode-note { margin: 24px 0; text-align: center; color: var(--muted); font-size: 13px; }
.mode-switch { display: flex; gap: 6px; padding: 5px; margin-bottom: 28px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.mode-switch a { flex: 1; padding: 11px 12px; text-align: center; color: var(--muted); font-weight: 650; border-radius: 10px; text-decoration: none; }
.mode-switch a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.mode-switch a:hover { background: var(--bg-soft); }
@media (max-width: 640px) {
  .mode-grid { grid-template-columns: 1fr; gap: 20px; }
  .mode-card { padding: 23px; }
  .mode-card h2 { font-size: 25px; }
  .mode-description { min-height: 0; }
  .mode-switch a { padding: 10px 7px; font-size: 13px; }
}
