/* ACTION! Saulėlydis virš Santa Monikos: vieta lentelėje yra spalva. */

@font-face { font-family: "Shrikhand"; src: url("fonts/shrikhand-latin.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow SC"; font-weight: 500; src: url("fonts/barlowsc-500-latin.woff2") format("woff2"); font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Barlow SC"; font-weight: 500; src: url("fonts/barlowsc-500-ext.woff2") format("woff2"); font-display: swap; unicode-range: U+0100-02BA, U+1E00-1EFF, U+2C60-2C7F; }
@font-face { font-family: "Barlow SC"; font-weight: 700; src: url("fonts/barlowsc-700-latin.woff2") format("woff2"); font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Barlow SC"; font-weight: 700; src: url("fonts/barlowsc-700-ext.woff2") format("woff2"); font-display: swap; unicode-range: U+0100-02BA, U+1E00-1EFF, U+2C60-2C7F; }
@font-face { font-family: "Barlow Num"; font-weight: 800; src: url("fonts/barlowc-800-latin.woff2") format("woff2"); font-display: swap; }

:root {
  --dusk: #17114F;
  --dusk-2: #241C6B;
  --line: #4A3FAE;
  --sun: #FFD21F;
  --coral: #FF4D6D;
  --coral-soft: #FF8FA3;
  --violet: #6A2BC8;
  --foam: #FFFFFF;
  --haze: #C9C4F0;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--dusk);
  color: var(--foam);
  font: 500 1.0625rem/1.4 "Barlow SC", "Arial Narrow", Arial, sans-serif;
}
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, a.btn { font: inherit; }
button { touch-action: manipulation; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--foam); outline-offset: 2px; }

.mark {
  display: inline-block;
  font: 400 1.75rem/1.1 "Shrikhand", Georgia, serif;
  color: var(--sun);
  text-shadow: .05em .05em 0 var(--coral), .1em .1em 0 var(--violet);
  transform: rotate(-3deg);
  white-space: nowrap;
}
.mark.big { font-size: clamp(3.5rem, 20vw, 5.5rem); }
.loading { padding: 40px var(--gutter); color: var(--haze); }

/* ---------- Mygtukai ir laukai ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 10px 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--foam);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.btn.cta {
  min-height: 56px;
  border-color: var(--sun);
  background: var(--sun);
  color: var(--dusk);
  font-size: 1.2rem;
  box-shadow: 0 4px 0 var(--coral);
}
.btn.cta:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--coral); }
.btn.cta:disabled { opacity: .6; }
.btn.cta.small { width: auto; flex: none; font-size: 1.0625rem; }
.btn.danger { border-color: var(--coral); color: var(--coral-soft); }
.btns { display: grid; gap: 10px; margin-top: 14px; }

.label { display: block; margin-bottom: 6px; font-weight: 700; color: var(--haze); }
.field {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--dusk-2);
  color: var(--foam);
  font-size: 1.125rem;
}
.field:focus { border-color: var(--sun); outline: none; }
.field::placeholder { color: var(--haze); }
.error { color: var(--coral-soft); font-weight: 700; }
.error:not(:empty) { margin-top: 8px; }
.note { color: var(--haze); }
.hint { padding: 14px var(--gutter); color: var(--haze); }

/* ---------- Prisijungimas ---------- */
.gate {
  display: flex;
  flex-direction: column;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 48px var(--gutter) 32px;
}
.gate .mark { align-self: flex-start; margin-bottom: 28px; }
.gate-lead { margin-bottom: 28px; font-size: 1.25rem; line-height: 1.3; }
.gate .btn { margin-top: 16px; }
.gate .note { margin-top: 24px; font-size: .95rem; }
.pin { font: 800 2rem/1 "Barlow Num", sans-serif; letter-spacing: .15em; }

/* ---------- Pagrindinis vaizdas ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px var(--gutter) 12px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
}
.top-sum { color: var(--haze); font-size: .95rem; text-align: right; }
.offline { padding: 8px var(--gutter); background: var(--coral); color: var(--dusk); font-weight: 700; }
.view { padding-bottom: calc(150px + var(--safe-b)); }

.dock {
  position: fixed;
  z-index: 5;
  inset: auto 0 0 0;
  background: var(--dusk);
  border-top: 2px solid var(--line);
  padding-bottom: var(--safe-b);
}
.dock > .btn { width: calc(100% - 2 * var(--gutter)); margin: 12px var(--gutter) 8px; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); }
.tab {
  min-height: 50px;
  border: 0;
  border-top: 3px solid transparent;
  background: none;
  color: var(--haze);
  font-size: 1rem;
  font-weight: 700;
}
.tab.on { color: var(--sun); border-top-color: var(--sun); }

/* ---------- Santrauka vedėjui ---------- */
.cues { padding: 0 var(--gutter); }
.cue { padding: 10px 0 12px; border-top: 1px solid var(--line); }
.cue:last-child { padding-bottom: 16px; }
.cue h2 { margin-bottom: 2px; color: var(--sun); font-size: 1rem; font-weight: 700; }
.cue li { line-height: 1.3; padding: 2px 0; }
.cue b { font-weight: 700; }

/* ---------- Saulėlydžio lentelė ---------- */
.board { display: grid; }
.row {
  display: grid;
  grid-template-columns: 3.25em minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 66px;
  padding: 8px var(--gutter) 8px 0;
  border: 0;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  text-align: left;
  transition: background-color .5s, color .5s;
  position: relative;
}
.row:focus-visible { outline-offset: -4px; z-index: 1; outline-color: var(--fg); }
.place { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.place b { font: 800 1.8em/1 "Barlow Num", sans-serif; }
.move { display: inline-flex; align-items: center; gap: 3px; margin-top: 3px; font-size: .8em; font-weight: 700; }
.move::before { content: ""; border-inline: .36em solid transparent; }
.move.up::before { border-bottom: .55em solid currentColor; }
.move.down::before { border-top: .55em solid currentColor; }
.who { min-width: 0; padding-right: 10px; }
.who b { display: block; font-size: 1.2em; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.who small { display: block; margin-top: 2px; font-size: .9em; line-height: 1.2; }
.pts { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.pts b { font: 800 2.2em/1 "Barlow Num", sans-serif; font-variant-numeric: tabular-nums; }
.pts small { margin-top: 2px; font-size: .9em; font-weight: 700; }

/* ---------- Sąrašai ---------- */
.list { border-top: 1px solid var(--line); }
.list li { border-bottom: 1px solid var(--line); }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 10px var(--gutter);
  border: 0;
  background: none;
  color: var(--foam);
  text-align: left;
}
.list-main { min-width: 0; }
.list-main b { display: block; font-weight: 700; font-size: 1.125rem; line-height: 1.2; overflow-wrap: anywhere; }
.list-main small { display: block; margin-top: 2px; color: var(--haze); font-size: .95rem; }
.list-time { flex: none; color: var(--haze); font-size: .95rem; }
.list-pts { flex: none; color: var(--sun); font: 800 1.6rem/1 "Barlow Num", sans-serif; }
.list-pts.zero { color: var(--haze); }
.list-pts.neg { color: var(--coral-soft); }

.empty { padding: 32px var(--gutter); }
.empty p { margin-bottom: 16px; font-size: 1.125rem; color: var(--haze); }
.empty .btn { margin-top: 0; }

.add-team { padding: 4px var(--gutter) 18px; }
.add-row { display: flex; gap: 10px; }
.add-row .field { flex: 1; min-width: 0; }

.block { padding: 18px var(--gutter); border-bottom: 1px solid var(--line); }
.block h2 { margin-bottom: 4px; font-size: 1.2rem; font-weight: 700; }
.block > .btn { margin-top: 12px; }
.block:last-child { border-bottom: 0; }
.url { margin-top: 10px; color: var(--sun); overflow-wrap: anywhere; font-weight: 700; }

/* ---------- Taškų įvedimas ---------- */
.entry { padding-bottom: calc(136px + var(--safe-b)); }
.entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px var(--gutter);
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.entry-head h1 { font-size: 1.35rem; font-weight: 700; }
.link { min-height: 44px; padding: 0; border: 0; background: none; color: var(--haze); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.entry-task { padding: 0 var(--gutter) 12px; }
.entry-tools {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px var(--gutter);
  background: var(--dusk);
  border-block: 1px solid var(--line);
}
.segs { display: flex; align-items: center; gap: 6px; }
.segs-label { margin-right: 2px; color: var(--haze); font-size: .95rem; white-space: nowrap; }
.seg {
  min-width: 44px;
  min-height: 44px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: none;
  color: var(--foam);
  font: 800 1.25rem/1 "Barlow Num", sans-serif;
}
.seg.on { background: var(--foam); border-color: var(--foam); color: var(--dusk); }
.all {
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: none;
  color: var(--foam);
  font-weight: 700;
  white-space: nowrap;
}
.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 68px;
  padding: 8px var(--gutter);
  border-bottom: 1px solid var(--line);
  border-left: 6px solid transparent;
  padding-left: calc(var(--gutter) - 6px);
}
.entry-row.given { background: var(--dusk-2); border-left-color: var(--sun); }
.entry-row.taken { background: var(--dusk-2); border-left-color: var(--coral); }
.entry-name { min-width: 0; font-size: 1.125rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.stepper { flex: none; display: flex; align-items: center; gap: 4px; }
.step {
  width: 50px;
  height: 50px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--foam);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}
.step.plus { border-color: var(--sun); background: var(--sun); color: var(--dusk); }
.step:active { transform: scale(.92); }
.value {
  width: 3.1rem;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--haze);
  text-align: center;
  font: 800 1.75rem/1 "Barlow Num", sans-serif;
}
.value:focus { background: var(--foam); color: var(--dusk); outline: none; }
.given .value { color: var(--sun); }
.taken .value { color: var(--coral-soft); }
.given .value:focus, .taken .value:focus { color: var(--dusk); }
.entry-delete { padding: 20px var(--gutter) 8px; }
.save-bar {
  position: fixed;
  z-index: 5;
  inset: auto 0 0 0;
  padding: 8px var(--gutter) calc(14px + var(--safe-b));
  background: var(--dusk);
  border-top: 2px solid var(--line);
}
.save-error:not(:empty) { margin: 0 0 6px; }
.save-sum { margin-bottom: 8px; color: var(--haze); text-align: center; font-size: .95rem; }

/* ---------- Apatinis langas ---------- */
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 85dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-top: 4px solid var(--sun);
  border-radius: 18px 18px 0 0;
  background: var(--dusk);
  color: var(--foam);
}
.sheet:focus { outline: none; }
.sheet::backdrop { background: rgba(10, 6, 50, .7); }
.sheet-body { padding: 20px var(--gutter) calc(20px + var(--safe-b)); }
.sheet h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.sheet-lead { margin-top: 2px; font-size: 1.125rem; }
.sheet .note { margin-top: 6px; }
.sheet .list { margin: 14px calc(-1 * var(--gutter)) 16px; }
.sheet form { margin-top: 14px; }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(150px + var(--safe-b));
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--foam);
  color: var(--dusk);
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .2s, transform .2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Vieša lentelė ---------- */
.screen-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 18px var(--gutter) 16px;
}
.screen-head .mark { font-size: clamp(2.75rem, 12vw, 4rem); }
.slogan { font-size: 1.125rem; font-weight: 700; }
.latest { min-height: 1.4em; color: var(--sun); font-weight: 700; }
.screen-empty { padding: 40px var(--gutter); color: var(--haze); font-size: 1.5rem; }

@media (min-width: 900px) and (min-height: 480px) {
  body.screen { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
  .screen-head { flex: none; padding: 2vh 3vw 2.4vh; }
  .screen-head .mark { font-size: clamp(3rem, 12vh, 7rem); }
  .screen-info { text-align: right; }
  .slogan { font-size: clamp(1.25rem, 3.4vh, 2.5rem); }
  .latest { font-size: clamp(1.1rem, 2.8vh, 2rem); }
  .screen .board {
    --row: calc((100dvh - 12vh - 4.4vh - 2rem) / var(--rows));
    flex: 1;
    min-height: 0;
    grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  }
  .screen .board.two-col { grid-auto-flow: column; grid-template-columns: 1fr 1fr; }
  .screen .row {
    min-height: 0;
    padding: 0 3vw 0 0;
    font-size: min(calc(var(--row) * .42), 4vw);
  }
  .screen .two-col .row { font-size: min(calc(var(--row) * .42), 2.2vw); }
  .screen .who b { font-size: 1.35em; }
  .screen .pts { flex-direction: row-reverse; align-items: baseline; gap: .6em; }
  .screen .pts small { font-size: 1.1em; }
  .screen .place { flex-direction: row; justify-content: center; align-items: baseline; gap: .25em; }
  .screen .move { font-size: .7em; }
}

@media (min-width: 700px) {
  body:not(.screen) #app { max-width: 620px; margin: 0 auto; }
  .dock, .save-bar { max-width: 620px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
