:root {
  --bg: #14181f;
  --panel: #1d232d;
  --line: #2c3442;
  --text: #eef1f5;
  --muted: #8b95a5;
  --green: #2fb36b;
  --red: #e5484d;
  --amber: #f1b434;
  --blue: #4c8dff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 24px);
}

header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
h1 { font-size: 24px; margin: 0 0 12px; }
h1 .sub { color: var(--muted); font-weight: 500; font-size: 18px; }
h2 { font-size: 16px; margin: 0; flex: 1; }
.muted { color: var(--muted); font-size: 14px; }
.lead { margin-top: 0; }

.diag { list-style: none; padding: 0; margin: 0 0 16px; background: var(--panel); border-radius: 12px; }
.diag li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.diag li:last-child { border-bottom: 0; }

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  width: 100%;
  cursor: pointer;
}
button.primary { background: var(--green); border-color: var(--green); color: #fff; font-size: 20px; font-weight: 700; padding: 20px; margin-top: 16px; }
button.small { width: auto; padding: 6px 10px; font-size: 14px; border-radius: 8px; }
button:active { opacity: .7; }

details { background: var(--panel); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
summary { cursor: pointer; font-weight: 600; }
label { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; font-size: 15px; }
select, input {
  font: inherit; font-size: 15px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; max-width: 60%;
}
input[type=number] { width: 90px; }
.cmds { margin: 8px 0 0; font-size: 15px; }
.cmds dt { font-weight: 600; margin-top: 8px; }
.cmds dd { margin: 0; color: var(--muted); }

.tap {
  min-height: 62vh;
  background: var(--panel);
  border-radius: 20px;
  padding: 24px 20px;
  display: flex; flex-direction: column; gap: 14px;
  user-select: none; -webkit-user-select: none;
  border: 3px solid transparent;
}
.tap[data-status=listening] { border-color: var(--blue); }
.tap[data-status=paused] { border-color: var(--amber); }
.status { font-size: 22px; font-weight: 700; }
.prompt { font-size: 28px; font-weight: 600; line-height: 1.3; }
.heard { font-size: 24px; color: var(--blue); min-height: 1.4em; }
.verdict { font-size: 22px; font-weight: 600; }
.verdict.ok { color: var(--green); }
.verdict.almost { color: var(--amber); }
.verdict.wrong { color: var(--red); }
.hint-it { font-size: 22px; color: var(--muted); font-style: italic; min-height: 1.2em; }
.tap-hint { margin-top: auto; }
.stats { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 6px 12px; margin: 14px 0; font-size: 15px; }

.badge { font-size: 12px; font-weight: 600; background: var(--amber); color: #000; border-radius: 6px; padding: 2px 6px; vertical-align: middle; }
.center { text-align: center; }

.course { background: var(--panel); border-radius: 16px; padding: 16px; }
.course-head { display: flex; align-items: center; gap: 12px; }
.flag { font-size: 34px; line-height: 1; }
.course-name { font-size: 20px; font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 12px; text-align: center; }
.kpis b { display: block; font-size: 24px; }
.kpis span { color: var(--muted); font-size: 13px; }
.bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--green); transition: width .3s; }
#todayInfo { margin: 10px 0 0; }
#todayInfo:empty { display: none; }

.file-btn {
  justify-content: center; margin-top: 10px; padding: 14px 16px; font-size: 17px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.file-btn input { display: none; }
button:disabled { opacity: .5; }

details .row { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
pre {
  background: #0d1015; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font-size: 12px; line-height: 1.4; max-height: 320px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; margin: 0;
}
