/* GYM – „Tablo“: tamsus tablo fonas, dideli gintariniai skaitmenys, vienas didelis veiksmo mygtukas.
   Tema: html[data-theme] = dark | light | system (system – pagal telefoną). */
:root, html[data-theme="dark"] {
  --bg:#1B1D21; --panel:#111214; --panel2:#2A2D32; --fg:#E8E6E1; --muted:#A9A6A0; --line:#3A3D43; --dim:#55585E;
  --led:#FFB020; --led-ink:#1B1D21; --led2:#C98A10; --ok:#5CC38A; --bad:#FF6B5E;
  --display:"Oxanium","Arial Narrow",system-ui,sans-serif; --body:"Barlow",system-ui,-apple-system,"Segoe UI",sans-serif;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg:#F3F2EF; --panel:#FFFFFF; --panel2:#E8E6E1; --fg:#1B1D21; --muted:#5E5B55; --line:#D5D2CC; --dim:#B5B2AC;
  --led:#9A5B00; --led-ink:#FFFFFF; --led2:#C98A10; --ok:#1E7A4A; --bad:#B3261E; color-scheme: light;
}
@media (prefers-color-scheme: light) {
  html[data-theme="system"] {
    --bg:#F3F2EF; --panel:#FFFFFF; --panel2:#E8E6E1; --fg:#1B1D21; --muted:#5E5B55; --line:#D5D2CC; --dim:#B5B2AC;
    --led:#9A5B00; --led-ink:#FFFFFF; --led2:#C98A10; --ok:#1E7A4A; --bad:#B3261E; color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.4;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); -webkit-tap-highlight-color: transparent; }
a { color: var(--led); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--led); outline-offset: 2px; }
.wrap { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
h1 { font-family: var(--body); font-weight: 600; font-size: 30px; line-height: 1.1; margin: 0; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .04em; color: var(--muted); margin: 8px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }

/* viršutinė juosta */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: calc(10px + env(safe-area-inset-top, 0px));
  max-width: 560px; margin: 0 auto; display: flex; gap: 2px; }
.top a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-family: var(--display); font-weight: 700;
  font-size: 14px; padding: 10px 2px; border-bottom: 3px solid transparent; }
.top a.on { color: var(--fg); border-bottom-color: var(--led); }

/* mygtukai */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px; border: 2px solid var(--line);
  background: transparent; color: var(--fg); font-family: var(--display); font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer; }
.btn.go { background: var(--led); border-color: var(--led); color: var(--led-ink); font-weight: 800; font-size: 20px; min-height: 64px; }
.btn.slim { min-height: 44px; font-size: 15px; padding: 0 12px; }
.link { background: none; border: 0; color: var(--led); padding: 8px 0; cursor: pointer; font-size: 15px; text-decoration: none; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

/* tablo langeliai */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { background: var(--panel); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile span { font-size: 14px; color: var(--muted); }
.tile b { font-family: var(--display); font-weight: 800; font-size: 38px; line-height: 1; color: var(--led); font-variant-numeric: tabular-nums; }
.tile b small { font-size: 16px; }

/* sąrašai */
.list { display: flex; flex-direction: column; }
.list > a, .list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.list > :last-child { border-bottom: 1px solid var(--line); }
.list .r { font-family: var(--display); font-weight: 700; color: var(--led); text-align: right; }
.list .r.dim { color: var(--muted); }
.list small { grid-column: 1; color: var(--muted); font-size: 14px; }
.pill { display: inline-block; font-family: var(--display); font-weight: 700; font-size: 12px; padding: 0 6px; margin-left: 6px;
  border: 1.5px solid var(--line); color: var(--muted); vertical-align: 2px; }
.pill.go { border-color: var(--led); color: var(--led); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border: 2px solid var(--line); color: var(--muted); font-size: 14px; text-decoration: none; background: none; cursor: pointer; }
.chip.on { border-color: var(--led); color: var(--led); }

/* formos */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.form input, .form select, .form textarea, .field { min-height: 48px; background: var(--panel); border: 1px solid var(--line); color: var(--fg);
  padding: 8px 12px; font-size: 16px; width: 100%; }
.form .helptext, .form ul.errorlist { font-size: 13px; color: var(--muted); }
.errorlist { color: var(--bad) !important; padding-left: 18px; margin: 0; }
.msg { padding: 12px 14px; background: var(--panel); border-left: 3px solid var(--led); }
.msg.error { border-left-color: var(--bad); }

/* treniruotė: vienas pratimas */
.prog { display: flex; gap: 3px; }
.prog i { flex: 1; height: 5px; background: var(--line); }
.prog i.on { background: var(--led); }
.exname { font-weight: 600; font-size: 28px; line-height: 1.1; }
.wheels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wheels.one { grid-template-columns: minmax(0, 1fr); }
.wheel { background: var(--panel); position: relative; height: 190px; display: flex; flex-direction: column; align-items: stretch; }
.wheel .cap { text-align: center; font-size: 14px; color: var(--muted); padding-top: 8px; }
.wheel .scroll { flex: 1; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.wheel .scroll::-webkit-scrollbar { display: none; }
.wheel .v { height: 48px; scroll-snap-align: center; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 30px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wheel .v.sel { font-weight: 800; font-size: 48px; color: var(--led); }
.wheel .pad { height: 56px; }
.wheel::after { content: ""; position: absolute; left: 8px; right: 8px; top: calc(50% + 14px - 26px); height: 52px;
  border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); pointer-events: none; }
.dots { display: flex; align-items: center; gap: 10px; }
.dot { width: 22px; height: 22px; border-radius: 50%; background: var(--line); border: 0; padding: 0; cursor: pointer; }
.dot.done { background: var(--led); }
.dot.cur { background: transparent; border: 3px solid var(--led); }
.next { border-top: 1px solid var(--line); padding-top: 12px; }

/* poilsio laikmatis */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--panel); border-top: 1px solid var(--line);
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.dock-in { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.clock { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; min-width: 3.2ch; }
.clock.run { color: var(--led); }
.has-dock { padding-bottom: 110px; }

/* visas sąrašas */
.wl .blk { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.wl .grp { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 6px 0 10px; display: flex; flex-direction: column; gap: 8px; }
.wl .grp.cur { border-left-color: var(--led); }
.wl .gl { font-family: var(--display); font-weight: 700; color: var(--muted); font-size: 14px; }
.wl .it { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; background: none; border: 0; text-align: left; padding: 4px 0; cursor: pointer; color: var(--fg); }
.wl .it .s { font-family: var(--display); color: var(--muted); }
.wl .it.done .s { color: var(--led); }
.wl .it.skip { opacity: .5; text-decoration: line-through; }

/* rekordo šventė */
.party { position: fixed; inset: 0; z-index: 50; background: var(--led); color: var(--led-ink); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; animation: pop .35s ease-out; }
.party .big { font-family: var(--display); font-weight: 800; font-size: 130px; line-height: .9; }
.party .t { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: 4px; }
.party i { position: absolute; width: 14px; height: 14px; background: var(--led-ink); animation: fall 1.6s ease-in forwards; }
@keyframes pop { from { transform: scale(.8); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes fall { from { transform: translateY(-40vh) rotate(0) } to { transform: translateY(60vh) rotate(540deg); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .party, .party i { animation: none; } }

/* lapas (keitimas) */
.sheet { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto; padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }

/* pokalbis */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bub { max-width: 88%; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bub.me { align-self: flex-end; background: var(--panel2); }
.bub.ai { border-left: 3px solid var(--led); padding-left: 12px; }
.plan { background: var(--panel); padding: 12px; display: flex; flex-direction: column; gap: 8px; max-width: 88%; }
.send { display: flex; gap: 8px; position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; }
.send textarea { flex: 1; min-height: 50px; max-height: 160px; background: var(--panel); border: 1px solid var(--line); color: var(--fg); padding: 12px; resize: vertical; }

/* grafikai */
.chartbox { background: var(--panel); padding: 12px; height: 240px; }
.bar { display: flex; height: 22px; gap: 2px; }
.bar i { display: block; height: 100%; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; text-align: center; font-size: 13px; color: var(--muted); }
.week a, .week span.d { height: 40px; background: var(--panel2); display: block; }
.week a.on { background: var(--led); }
.week a.tr { background: var(--led2); }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.vh { position: absolute; left: -9999px; }
#app { display: flex; flex-direction: column; gap: 14px; }
#app .row .field { min-width: 0; }
.dock #lbl { line-height: 1.2; }
#net:empty { display: none; }
.top.three a { flex: 1; text-align: center; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { background: var(--panel); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; border: 2px solid transparent; }
.day span { font-size: 13px; color: var(--muted); }
.day b { font-family: var(--display); font-weight: 800; font-size: 22px; }
.day i { width: 10px; height: 10px; border-radius: 50%; }
.day.done i { background: var(--led); }
.day.plan i { border: 2px solid var(--led); }
.day.today { border-color: var(--led); }
.nextplan { background: var(--panel); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.nextplan > b { font-size: 24px; font-weight: 600; }
