:root {
  --bg: #EEF0F3; --surface: #FFFFFF; --ink: #172033; --muted: #5B6475; --line: #D7DBE2;
  --rec: #E0313B; --rec-soft: rgba(224, 49, 59, .16); --link: #2B59C3; --warn: #8A5A00; --warn-bg: #FFF2D6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1420; --surface: #182031; --ink: #E8ECF3; --muted: #94A0B4; --line: #273147;
    --rec: #FF5A61; --rec-soft: rgba(255, 90, 97, .18); --link: #8DA9FF; --warn: #FFD48A; --warn-bg: #3A2C10;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1420; --surface: #182031; --ink: #E8ECF3; --muted: #94A0B4; --line: #273147;
  --rec: #FF5A61; --rec-soft: rgba(255, 90, 97, .18); --link: #8DA9FF; --warn: #FFD48A; --warn-bg: #3A2C10;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 16px calc(96px + env(safe-area-inset-bottom));
}
main { max-width: 680px; margin: 0 auto; }
a { color: var(--link); text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; margin: 8px 0 6px; }
h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.meta { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.err { color: var(--rec); min-height: 1.4em; }
.warn { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 12px; font-size: 15px; }

#top { max-width: 680px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 52px; }
#brand { font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
#top nav a { font-size: 15px; }

/* вхід */
#loginForm { max-width: 340px; margin: 12vh auto 0; display: grid; gap: 10px; }
#loginForm label { font-size: 15px; color: var(--muted); }
#loginForm input { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
#loginForm button { padding: 14px; border-radius: 12px; border: 0; background: var(--ink); color: var(--bg); font-weight: 600; }

#scCard { display: grid; gap: 4px; margin-top: 8px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
#scCard span { color: var(--muted); font-size: 15px; }
#scCard b::after { content: ''; }
/* запис: одна велика кнопка — головна річ на сторінці */
#recorder { display: flex; align-items: center; gap: 14px; padding: 14px 0 22px; }
#recBtn { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
#recIcon { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: border-radius .2s ease; }
#recRing { position: absolute; inset: -1px; border-radius: 50%; border: 1px solid var(--muted); opacity: 0; }
body.recording #recIcon { border-radius: 3px; animation: recPulse 1.6s ease-in-out infinite; }
body.recording #recRing { animation: recRing 1.6s ease-out infinite; }
@keyframes recPulse { 50% { opacity: .35; } }
@keyframes recRing { 0% { opacity: .6; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5); } }
@media (prefers-reduced-motion: reduce) { body.recording #recIcon, body.recording #recRing { animation: none; } body.recording #recRing { opacity: .5; } }
#recInfo { flex: 1; min-width: 0; }
#recTime { font-size: 17px; font-variant-numeric: tabular-nums; color: var(--muted); line-height: 1.2; }
body.recording #recTime { color: var(--ink); }
#recHint { margin: 0; color: var(--muted); font-size: 14px; }
#fileBtn { flex: none; font-size: 15px; color: var(--link); padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }

/* список */
#list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
#list li { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); transition: opacity .2s ease; }
#list li.gone { opacity: 0; }
#list .del { position: absolute; inset: 0 0 0 auto; width: 88px; border: 0; background: var(--rec); color: #fff; font-size: 15px; font-weight: 600; }
#list li a { position: relative; background: var(--bg); touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 0; color: var(--ink); }
#list .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#list .d { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
#list .p { grid-column: 1 / -1; color: var(--muted); font-size: 15px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#list .s { color: var(--link); }
#list .s.e { color: var(--rec); }
#empty { color: var(--muted); }

/* один запис */
.back { display: inline-block; font-size: 15px; padding: 6px 0; }
#rStatus:not(:empty) { padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 16px; }
#rStatus button { margin-top: 10px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
#rPoints { margin: 0 0 18px; padding-left: 20px; }
#rPoints li { margin: 4px 0; }
#rTools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
#rTools button { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; }
#rTools .danger { color: var(--rec); margin-left: auto; }
#segs { list-style: none; margin: 0; padding: 0; }
#segs li { display: grid; grid-template-columns: 52px 1fr; gap: 0 10px; padding: 10px 0; border-top: 1px solid var(--line); }
#segs .tc { background: none; border: 0; padding: 2px 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; text-align: left; align-self: start; }
#segs .uk { margin: 0; }
#segs .de { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
#segs.noorig .de { display: none; }
#segs li.now { background: var(--rec-soft); border-radius: 8px; }
#player { position: fixed; left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom)); width: calc(100% - 32px); max-width: 680px; margin: 0 auto; }

/* ярлик */
.steps { padding-left: 22px; }
.steps li { margin: 0 0 14px; }
code { display: block; margin: 6px 0; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; word-break: break-all; }
.copy { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
[hidden] { display: none !important; }
