/* ==========================================================================
   Активити — стилове
   Палитра: зелено табло + червена карта + трите цвята на задачите
   ========================================================================== */

:root{
  color-scheme: light;

  /* повърхности (светла тема) */
  --bg:        #EDF1E6;
  --bg-2:      #E2E9D8;
  --surface:   #FFFFFF;
  --surface-2: #F5F8F0;
  --line:      #D3DCC6;
  --ink:       #17241C;
  --ink-soft:  #56675A;
  --ink-faint: #8B9A8D;

  /* фирмени цветове на играта */
  --felt:      #2F7D3E;   /* платното на дъската */
  --felt-deep: #1C5A2C;
  --red:       #D6392E;   /* рамката на картата */
  --red-deep:  #A72A21;
  --gold:      #F3C13A;

  /* цветове на задачите */
  --t-d:  #E8A317;   /* рисуване   */
  --t-s:  #2E86C8;   /* обяснение  */
  --t-m:  #DB2F79;   /* пантомима  */
  --t-d-ink: #402C00;
  --t-s-ink: #FFFFFF;
  --t-m-ink: #FFFFFF;

  --ok:   #2E9E5B;
  --warn: #E4572E;

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --shadow-1: 0 1px 2px rgba(15,40,22,.10), 0 6px 18px rgba(15,40,22,.08);
  --shadow-2: 0 10px 34px rgba(15,40,22,.22);

  --display: "Unbounded", "Trebuchet MS", system-ui, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --bg:        #0B1A12;
    --bg-2:      #102318;
    --surface:   #16301F;
    --surface-2: #1C3A27;
    --line:      #2C5138;
    --ink:       #EEF6EA;
    --ink-soft:  #A9C0AE;
    --ink-faint: #7B947F;
    --felt:      #2F7D3E;
    --felt-deep: #14401F;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
    --shadow-2: 0 12px 40px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --bg:        #0B1A12;
  --bg-2:      #102318;
  --surface:   #16301F;
  --surface-2: #1C3A27;
  --line:      #2C5138;
  --ink:       #EEF6EA;
  --ink-soft:  #A9C0AE;
  --ink-faint: #7B947F;
  --felt:      #2F7D3E;
  --felt-deep: #14401F;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
  --shadow-2: 0 12px 40px rgba(0,0,0,.55);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
img{ max-width: 100%; }
[hidden]{ display: none !important; }

button, input, select{ font: inherit; color: inherit; }
button{ cursor: pointer; border: 0; background: none; }
:focus-visible{ outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.wrap{
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding-inline: 16px;
}

/* ------------------------------ лента горе ------------------------------ */
.topbar{
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in{
  display: flex; align-items: center; gap: 10px;
  min-height: 56px;
}
.brand{
  display: flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 700; font-size: 17px;
  letter-spacing: .02em; margin-right: auto;
  background: none; padding: 0;
}
.brand .dot{
  width: 12px; height: 12px; border-radius: 3px; background: var(--red);
  box-shadow: 14px 0 0 -1px var(--t-d), 0 14px 0 -1px var(--t-s), 14px 14px 0 -1px var(--t-m);
  margin-right: 14px; margin-bottom: 14px; flex: none;
}
.icon-btn{
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-soft);
}
.icon-btn:hover{ color: var(--ink); }
.icon-btn svg{ width: 20px; height: 20px; }

/* ------------------------------- екрани --------------------------------- */
.screen{ padding-block: 18px 40px; }
.screen[hidden]{ display: none !important; }

h1{
  font-family: var(--display); font-weight: 800;
  font-size: clamp(30px, 9vw, 42px); line-height: 1.02;
  margin: 6px 0 6px; text-wrap: balance; letter-spacing: -.01em;
}
h1 em{ font-style: normal; color: var(--red); }
.lede{ margin: 0 0 22px; color: var(--ink-soft); max-width: 46ch; }

h2{
  font-family: var(--display); font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--ink-faint);
  margin: 26px 0 10px;
}
.hint{ font-size: 13px; color: var(--ink-faint); margin: 8px 0 0; }

h3{ font-family: var(--display); font-weight: 600; font-size: 14.5px; margin: 20px 0 8px; }

/* ------------------------------- правила ------------------------------- */
.steps{ margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.steps li{
  counter-increment: step; position: relative; padding: 12px 14px 12px 46px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  font-size: 14px; color: var(--ink-soft); line-height: 1.5;
}
.steps li::before{
  content: counter(step); position: absolute; left: 12px; top: 12px;
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--felt); color: #fff; font-family: var(--display); font-size: 12px; font-weight: 700;
}
.steps b{ color: var(--ink); }
.opt .chip{ width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; font-size: 15px; }
.opt .chip.t-d{ background: var(--t-d); color: var(--t-d-ink); }
.opt .chip.t-s{ background: var(--t-s); }
.opt .chip.t-m{ background: var(--t-m); }
.opt .chip svg{ width: 17px; height: 17px; }
.opt .sub b{ color: var(--ink); }

.ui-list{ margin: 0; display: grid; gap: 0; }
.ui-list dt{
  font-weight: 800; font-size: 14px; margin-top: 12px; color: var(--ink);
}
.ui-list dt:first-child{ margin-top: 0; }
.ui-list dd{
  margin: 3px 0 0; padding-left: 12px; border-left: 2px solid var(--line);
  font-size: 13.5px; color: var(--ink-soft); line-height: 1.5;
}
.ui-list dd b{ color: var(--ink); }

/* -------------------------- избор на категории -------------------------- */
.cats{ display: grid; gap: 8px; }
.cat{
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: var(--r-m);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .15s, transform .08s;
}
.cat:active{ transform: scale(.99); }
.cat .emo{ font-size: 22px; line-height: 1; flex: none; }
.cat .nm{ font-weight: 700; }
.cat .ds{ font-size: 12.5px; color: var(--ink-faint); }
.cat .tick{
  margin-left: auto; width: 24px; height: 24px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center; color: transparent;
}
.cat[aria-pressed="true"]{ border-color: var(--felt); background: color-mix(in srgb, var(--felt) 10%, var(--surface)); }
.cat[aria-pressed="true"] .tick{ background: var(--felt); border-color: var(--felt); color: #fff; }
.cat .tick svg{ width: 14px; height: 14px; }

/* ------------------------------- отбори --------------------------------- */
.split-box{
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 12px 14px 14px; margin-bottom: 10px;
}
.split-box .lbl{ display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.split-box textarea{
  width: 100%; resize: vertical; min-height: 54px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  padding: 9px 11px; font-size: 14px; line-height: 1.45; color: var(--ink);
}
.split-box textarea::placeholder{ color: var(--ink-faint); }
.split-row{ display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.split-row .sub{ font-size: 13px; color: var(--ink-faint); }
.split-row .seg{ padding: 3px; }
.split-row .seg button{ padding: 5px 9px; font-size: 13.5px; }
.split-row .btn{ margin-left: auto; padding: 10px 18px; font-size: 14px; }

.teams{ display: grid; gap: 8px; }
.team-card{
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 8px 10px 10px 12px;
}
.team-row{ display: flex; align-items: center; gap: 10px; }
.team-count{ font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.players{ display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; padding-left: 24px; }
.chip{
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 4px 3px 11px; font-size: 13px; font-weight: 600;
}
.chip-x{ width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-faint); }
.chip-x:hover{ color: var(--warn); background: var(--bg-2); }
.chip-x svg{ width: 10px; height: 10px; }
.add-player{
  border: 1px dashed var(--line); background: none; border-radius: 999px;
  padding: 4px 12px; font-size: 13px; width: 116px; color: var(--ink);
}
.add-player::placeholder{ color: var(--ink-faint); }
.who{
  display: inline-flex; align-items: center; gap: 5px; vertical-align: -3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 9px; font-weight: 800; color: var(--ink); font-size: 13.5px;
}
.who svg{ width: 12px; height: 12px; opacity: .55; }
.who:hover svg{ opacity: 1; }
.who-mini{ font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }
.pawn{ width: 14px; height: 18px; flex: none; border-radius: 7px 7px 4px 4px; }
.team-row input{
  flex: 1; min-width: 0; border: 0; background: none; padding: 6px 0; font-weight: 600;
}
.team-row input:focus{ outline: none; }
.mini{
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line);
}
.mini svg{ width: 16px; height: 16px; }

/* ------------------------------ настройки ------------------------------- */
.opt{
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
}
.opt + .opt{ margin-top: 8px; }
@media (max-width: 430px){
  .opt-wide{ flex-wrap: wrap; }
  .opt-wide .ctl{ flex-basis: 100%; justify-content: flex-end; margin-top: 6px; }
}
.opt .lbl{ font-weight: 600; }
.opt .sub{ font-size: 12.5px; color: var(--ink-faint); }
.opt .ctl{ margin-left: auto; display: flex; gap: 6px; align-items: center; }

.seg{ display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.seg button{
  padding: 6px 11px; border-radius: 9px; font-weight: 700; font-size: 14px;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.seg button[aria-pressed="true"]{ background: var(--felt); color: #fff; }

.switch{
  width: 50px; height: 30px; border-radius: 15px; background: var(--line);
  position: relative; transition: background .18s; flex: none;
}
.switch::after{
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch[aria-pressed="true"]{ background: var(--felt); }
.switch[aria-pressed="true"]::after{ transform: translateX(20px); }

/* ------------------------------- бутони --------------------------------- */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 20px; border-radius: 14px; font-weight: 800; font-size: 16px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  transition: transform .08s, filter .15s;
}
.btn:active{ transform: translateY(1px) scale(.995); }
.btn-primary{ background: var(--red); border-color: var(--red-deep); color: #fff; box-shadow: 0 4px 0 var(--red-deep); }
.btn-primary:active{ box-shadow: 0 2px 0 var(--red-deep); transform: translateY(2px); }
.btn-ok{ background: var(--ok); border-color: color-mix(in srgb, var(--ok) 70%, #000); color: #fff; }
.btn-no{ background: var(--surface); color: var(--ink-soft); }
.btn-block{ width: 100%; }
.btn-lg{ padding: 18px 22px; font-size: 17px; font-family: var(--display); letter-spacing: .01em; }
.btn svg{ width: 18px; height: 18px; }
.btn[disabled]{ opacity: .45; pointer-events: none; }

/* ------------------------------- таблото -------------------------------- */
.scorebar{
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px;
  scrollbar-width: none;
}
.scorebar::-webkit-scrollbar{ display: none; }
.sb-team{
  flex: 1 0 auto; min-width: 128px; padding: 10px 12px; border-radius: var(--r-m);
  background: var(--surface); border: 1px solid var(--line);
}
.sb-team.on{ border-color: var(--gold); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold) 45%, transparent); }
.sb-top{ display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.sb-top .nm{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--ink); }
.sb-score{ font-family: var(--display); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.sb-score small{ font-size: 12px; color: var(--ink-faint); font-family: var(--body); font-weight: 600; }
.sb-bar{ height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 6px; }
.sb-bar i{ display: block; height: 100%; border-radius: 3px; }

.turn-row{ display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.turn-note{
  flex: 1; min-width: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.35;
}
.turn-note b{ color: var(--ink); }

/* ------------------------------- дъската ------------------------------- */
/* 48 полета, по 4 на ред, змийка отгоре-вдясно до знаменцето долу-вдясно —
   както е разчертано в кутията.                                            */

.board-wrap{ margin-bottom: 16px; }
.board{
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px; border-radius: var(--r-l);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,.10), transparent 60%),
    repeating-linear-gradient(115deg, rgba(0,0,0,.05) 0 3px, transparent 3px 7px),
    linear-gradient(165deg, #35854A 0%, #1F6335 55%, #17502A 100%);
  box-shadow: var(--shadow-2), inset 0 0 0 2px rgba(255,255,255,.07);
}
.brow{ display: flex; gap: 5px; }
.tile{
  position: relative; flex: 1 1 0; min-width: 0; aspect-ratio: 1.7 / 1;
  border-radius: 7px; display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.95),   /* белият кант на плочките */
              inset 0 -3px 0 rgba(0,0,0,.16), 0 1px 2px rgba(0,0,0,.3);
}
.brow.rl .tile:last-child{ border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.brow.lr .tile:last-child{ border-top-right-radius: 999px; border-bottom-right-radius: 999px; }

/* шестте цвята от дъската в кутията — само украса, знакът носи смисъла */
.tile.c-cyan  { background: #3FC1E8; color: #06384F; }
.tile.c-blue  { background: #2C51A3; color: #FFFFFF; }
.tile.c-pink  { background: #E8388B; color: #FFFFFF; }
.tile.c-yellow{ background: #FFDE17; color: #4A3600; }
.tile.c-orange{ background: #F58220; color: #4A1E00; }
.tile.c-green { background: #5BBB3A; color: #123C06; }
.tile > svg{ width: 58%; max-width: 32px; height: auto; aspect-ratio: 1; transition: opacity .2s; }
.tile.occupied > svg{ opacity: .22; }
.tile.here{ outline: 3px solid var(--gold); outline-offset: 2px; z-index: 2; }
.tile.moved{ animation: land .45s ease-out; }
@keyframes land{ 0%{ transform: scale(1);} 42%{ transform: scale(1.16);} 100%{ transform: scale(1);} }

.pawns{
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 2px; pointer-events: none;
}
.pw{
  width: 26px; height: 26px; display: block; flex: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.45));
}
/* формите идват през <use>, затова обводката се задава наследимо върху svg-то */
.pw svg{
  display: block; width: 100%; height: 100%;
  stroke: #fff; stroke-width: 1.5; paint-order: stroke fill;
}
.pawns.many .pw{ width: 18px; height: 18px; }
.pawns.many.crowd .pw{ width: 13px; height: 13px; }
.board-wrap{ margin-bottom: 16px; }

.bmark{
  align-self: flex-end; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--display); font-size: 11px; font-weight: 700; letter-spacing: .08em;
  padding: 4px 10px; border-radius: 999px; margin-right: 2px;
}
.bmark.start{ background: var(--gold); color: #3A2A00; margin-bottom: 1px; }
.bmark.finish{
  margin-top: 1px; color: #14300F; padding-left: 6px;
  background:
    repeating-conic-gradient(#fff 0% 25%, #1B1B1B 0% 50%) 0 0 / 9px 9px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
}
.bmark.finish b{ background: #fff; padding: 1px 7px; border-radius: 999px; }

.board-legend{
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px;
  font-size: 11.5px; color: var(--ink-faint);
}
.board-legend span{ display: inline-flex; align-items: center; gap: 6px; }
.board-legend i.lg-ic{
  width: 22px; height: 16px; border-radius: 4px; display: inline-grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
}
.board-legend i.lg-ic svg{ width: 11px; height: 11px; }
.board-legend .lg-note{ flex-basis: 100%; opacity: .8; }

.req-note{
  display: flex; align-items: center; gap: 9px; padding: 10px 13px; margin-bottom: 10px;
  border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line);
  font-size: 13.5px;
}
.req-note b{ font-weight: 800; }
.req-note .chip{ width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.req-note .chip.t-d{ background: var(--t-d); color: var(--t-d-ink); }
.req-note .chip.t-s{ background: var(--t-s); }
.req-note .chip.t-m{ background: var(--t-m); }
.req-note .chip svg{ width: 15px; height: 15px; }
.row.off{ opacity: .3; filter: saturate(.35); }

/* отворен кръг — червената дума на картата */
.row.open{ box-shadow: 0 0 0 3px var(--red), 0 1px 0 rgba(0,0,0,.25); }
.row.open .w{ color: var(--red); font-weight: 800; }
.row.open .tag{
  align-self: center; margin-right: 8px; flex: none;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800;
  letter-spacing: .06em; padding: 2px 7px; border-radius: 999px;
}
.open-banner{
  display: flex; align-items: center; gap: 9px; padding: 10px 13px; margin-bottom: 10px;
  border-radius: var(--r-m); font-size: 13.5px; font-weight: 600;
  background: color-mix(in srgb, var(--red) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--red) 45%, var(--line));
}
.open-banner b{ color: var(--red); }
.open-verdict{ display: grid; gap: 8px; }
.open-verdict .lbl-row{ font-size: 13px; color: var(--ink-soft); margin-bottom: 2px; }
.open-verdict .teams-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.open-verdict .btn{ justify-content: flex-start; gap: 9px; padding: 13px 14px; font-size: 15px; }

.win{ text-align: center; padding: 22px 0 6px; }
.win .cup{ font-size: 58px; line-height: 1; }
.win h3{ font-size: 25px; margin: 10px 0 4px; }

/* на таблет дъската стои като истинска — тясна и висока, в средата */
@media (min-width: 560px){
  .board-wrap{ max-width: 420px; margin-inline: auto; }
}
/* на лаптоп: дъската вляво, картите вдясно */
@media (min-width: 900px){
  #scGame{ max-width: 1000px; }
  .game-cols{ display: grid; grid-template-columns: 380px 1fr; gap: 28px; align-items: start; }
  .board-wrap{ max-width: none; margin-bottom: 0; }
  #boardBox{ order: -1; position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); }
  .pw{ width: 30px; height: 30px; }
}

/* ------------------------------ история -------------------------------- */
.hist-team + .hist-team{ margin-top: 20px; }
.hist-head{ display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.hist-head .nm{ font-weight: 800; }
.hist-head .sm{ margin-left: auto; font-size: 12.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.hist-list{ display: grid; gap: 6px; }
.hist-row{
  display: flex; align-items: center; gap: 10px; padding: 7px 11px 7px 8px;
  border-radius: 11px; background: var(--surface); border: 1px solid var(--line);
}
.hist-row .w{ flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.hist-row .dk{ font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.hist-row .mk{ font-weight: 800; font-size: 15px; width: 18px; text-align: center; }
.hist-row.ok .mk{ color: var(--ok); }
.hist-row.no{ opacity: .72; }
.hist-row.no .mk{ color: var(--ink-faint); }
.hist-ic{ width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.hist-ic svg{ width: 15px; height: 15px; }
.hist-ic.t-d{ background: var(--t-d); color: var(--t-d-ink); }
.hist-ic.t-s{ background: var(--t-s); }
.hist-ic.t-m{ background: var(--t-m); }
.hist-empty{ color: var(--ink-faint); font-size: 14px; padding: 14px 0 4px; }

/* ------------------------------- картата -------------------------------- */
.deck-pick{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.deck{
  padding: 14px 8px 12px; border-radius: var(--r-m); text-align: center;
  background: linear-gradient(170deg, #8CC63F, #4E9E30);
  border: 3px solid #fff; box-shadow: var(--shadow-1); color: #10300F;
}
.deck .n{ font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; color: #FFE05C; -webkit-text-stroke: 1.5px #2B5E18; }
.deck .l{ display: block; font-size: 11.5px; font-weight: 700; margin-top: 6px; color: #17400F; }
.deck .r{ display: block; font-size: 11px; color: #2B5E18; opacity: .85; }
.deck:active{ transform: translateY(1px); }

.deck-roll{ width: 100%; padding: 26px 16px 20px; }
.deck-roll .n{ font-size: 54px; display: block; }
.deck-roll .l{ font-size: 15px; margin-top: 10px; }
.deck-roll .r{ font-size: 12px; }
.deck-roll.rolling .n{ animation: tumble .09s steps(1) infinite; }
.deck-roll[disabled]{ pointer-events: none; }
@keyframes tumble{
  0%   { transform: translateY(0)   rotate(-3deg); }
  50%  { transform: translateY(-4px) rotate(3deg); }
  100% { transform: translateY(0)   rotate(-3deg); }
}

.card{
  background: linear-gradient(165deg, #7FC24B 0%, #46953A 55%, #2F7D3E 100%);
  border: 9px solid var(--red);
  border-radius: 20px;
  padding: 12px;
  box-shadow: var(--shadow-2);
  position: relative;
}
.card-head{
  display: flex; align-items: center; gap: 8px; padding: 0 4px 10px;
  color: #ECFFE0; font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.card-head .no{ font-family: var(--display); opacity: .9; font-variant-numeric: tabular-nums; }
.card-head .deck-tag{
  margin-left: auto; background: #FFE05C; color: #2B5E18; border-radius: 999px;
  padding: 3px 10px; font-size: 11px; letter-spacing: .06em;
}
.rows{ display: grid; gap: 7px; }
.row{
  display: flex; align-items: stretch; gap: 0; width: 100%; text-align: left;
  background: #fff; border-radius: 7px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,.25);
  transition: transform .08s, box-shadow .12s;
}
.row:active{ transform: scale(.985); }
.row[disabled]{ cursor: default; }
.row .ic{ width: 42px; flex: none; display: grid; place-items: center; color: #fff; }
.row .ic svg{ width: 22px; height: 22px; }
.row .w{
  flex: 1; min-width: 0; padding: 10px 10px 10px 11px; font-size: 15px; font-weight: 600;
  color: #14210F; display: flex; align-items: center; line-height: 1.25;
  border-left: 2px solid rgba(0,0,0,.12);
}
.row.t-d .ic{ background: var(--t-d); color: var(--t-d-ink); }
.row.t-s .ic{ background: var(--t-s); }
.row.t-m .ic{ background: var(--t-m); }
.row.t-m .w{ color: #A81E58; }
.row.done{ opacity: .42; }
.row.done .w{ text-decoration: line-through; }

.card-foot{ display: flex; gap: 8px; margin-top: 12px; }
.card-foot .btn{ flex: 1; padding: 12px 10px; font-size: 14px; }

/* ------------------------------- задачата ------------------------------- */
.task{ display: grid; gap: 16px; }
.task-head{
  display: inline-flex; align-items: center; gap: 9px; align-self: start; justify-self: start;
  padding: 7px 14px 7px 8px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 14px;
}
.task-head svg{ width: 20px; height: 20px; }
.task-head.t-d{ background: var(--t-d); color: var(--t-d-ink); }
.task-head.t-s{ background: var(--t-s); }
.task-head.t-m{ background: var(--t-m); }

.word-plate{
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 30px 22px; text-align: center; box-shadow: var(--shadow-1);
}
.word{
  font-family: var(--display); font-weight: 800; letter-spacing: -.015em;
  font-size: clamp(26px, 7.6vw, 40px); line-height: 1.1; margin: 0; text-wrap: balance;
}
.word-sub{ margin: 12px 0 0; font-size: 13px; color: var(--ink-faint); }

.twist{
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-m);
  background: color-mix(in srgb, var(--gold) 22%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--gold) 55%, var(--line));
  font-size: 14px; font-weight: 600;
}
.twist span:first-child{ font-size: 17px; line-height: 1.2; }

.timer{ display: grid; place-items: center; gap: 10px; }
.ring{ width: 172px; height: 172px; transform: rotate(-90deg); }
.ring circle{ fill: none; stroke-width: 12; stroke-linecap: round; }
.ring .bg{ stroke: var(--line); }
.ring .fg{ stroke: var(--felt); transition: stroke .3s; }
.timer-wrap{ position: relative; display: grid; place-items: center; }
.timer-num{
  position: absolute; font-family: var(--display); font-weight: 800; font-size: 46px;
  font-variant-numeric: tabular-nums;
}
.timer.low .ring .fg{ stroke: var(--warn); }
.timer.low .timer-num{ color: var(--warn); }
.timer-actions{ display: flex; gap: 8px; }

.verdict{ display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ------------------------------ прогрес --------------------------------- */
.stats{
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px;
}
.stat{
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 12px; text-align: center;
}
.stat b{ display: block; font-family: var(--display); font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span{ font-size: 11.5px; color: var(--ink-faint); }

.progress{ height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 12px; }
.progress i{ display: block; height: 100%; background: var(--felt); border-radius: 4px; transition: width .3s; }

/* ------------------------------ диалози --------------------------------- */
.sheet{
  position: fixed; inset: 0; z-index: 60; display: grid; align-items: end;
  background: rgba(8,20,12,.55); backdrop-filter: blur(3px);
}
.sheet-in{
  background: var(--bg); border-radius: 24px 24px 0 0; padding: 20px 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  max-height: 86vh; overflow-y: auto; box-shadow: var(--shadow-2);
  width: 100%; max-width: 560px; margin: 0 auto;
}
.sheet h3{ font-family: var(--display); font-size: 20px; margin: 0 0 4px; }
.sheet .close{ float: right; }


.toast{
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom, 0px)); z-index: 80;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-2);
  animation: rise .25s ease-out;
}
@keyframes rise{ from{ opacity: 0; transform: translate(-50%, 10px);} to{ opacity: 1; transform: translate(-50%, 0);} }

.deal{ animation: deal .28s cubic-bezier(.2,.8,.3,1.1); }
@keyframes deal{ from{ opacity: 0; transform: translateY(14px) rotate(-1.2deg) scale(.97);} to{ opacity: 1; transform: none;} }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.seo{ font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; margin: 0 0 12px; max-width: 62ch; }
.seo b{ color: var(--ink); font-weight: 700; }
.linkish{
  display: inline; padding: 0; background: none; border: 0; font: inherit;
  color: var(--felt); font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
:root[data-theme="dark"] .linkish, :root:not([data-theme="light"]) .linkish{ color: #7FD08F; }

.footer{ margin-top: 34px; text-align: center; font-size: 12px; color: var(--ink-faint); }
.footer code{ background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
