/* Гарнитура лежит рядом с приложением: без сети она всё равно загрузится,
   и текст не мигает подменой шрифта при открытии страницы. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2192, U+2212;
}

:root {
  color-scheme: light dark;

  --bg: #f3f1ed;
  --surface: #ffffff;
  --surface-sunken: #faf9f6;
  --border: #e4e0d8;
  --text: #1a1917;
  --muted: #6d6862;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0ec;
  --up: #2c7a4f;
  --down: #b23f2d;
  --warn: #9a6b1f;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 10px 28px -18px rgb(0 0 0 / 28%);
  --gap: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181a;
    --surface: #1e2124;
    --surface-sunken: #191c1f;
    --border: #2e3336;
    --text: #e9e7e3;
    --muted: #9b9791;
    --accent: #4f9b84;
    --accent-ink: #0f1214;
    --accent-soft: #21332e;
    --up: #62b184;
    --down: #e07a63;
    --warn: #d0a44e;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 12px 30px -18px rgb(0 0 0 / 60%);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv05", "ss03";
}

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.75rem) clamp(1rem, 4vw, 2rem) 5rem;
}

h1 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 .35rem;
}
h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .85rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .35rem; }
h4 { font-size: .9rem; font-weight: 600; color: var(--muted); margin: 1rem 0 .35rem; }
p { margin: 0 0 .75rem; }

.round { color: var(--muted); font-size: .95rem; margin: 0 0 1.5rem; }

.big {
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  background: var(--accent-soft);
  color: var(--text);
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  margin: 0 0 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
  margin: 0 0 var(--gap);
}
.card.disabled { opacity: .5; box-shadow: none; }

.prose { white-space: pre-wrap; line-height: 1.65; }
.news {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: .97rem;
}

table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th {
  text-align: left;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: .4rem .75rem .4rem 0;
  border-bottom: 1px solid var(--border);
}
td { padding: .6rem .75rem .6rem 0; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }

.code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 1.05rem;
  letter-spacing: .12em;
  font-weight: 600;
}

.pill {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 500;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  color: var(--muted);
}
.pill.done { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

.tracks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.track {
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: .7rem .85rem;
}
.track .value { display: block; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.track .name { display: block; font-size: .8rem; color: var(--muted); }
.track.own { background: var(--accent-soft); }

.sides { display: grid; gap: .75rem; }
.side { border-top: 1px solid var(--border); padding-top: .75rem; }
.side:first-child { border-top: 0; padding-top: 0; }
.side .title { font-weight: 600; margin-bottom: .4rem; }

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: var(--gap);
}
.action .meta { font-size: .85rem; color: var(--muted); margin: .35rem 0 .75rem; }
.action .why { font-size: .88rem; color: var(--warn); margin: .35rem 0 0; }

button, .button {
  font: inherit;
  font-weight: 500;
  padding: .55rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: filter .15s ease, transform .05s ease;
}
button:hover, .button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled { background: var(--surface-sunken); color: var(--muted); border-color: var(--border); cursor: not-allowed; filter: none; }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.secondary:hover { background: var(--surface-sunken); filter: none; }
button.ghost { background: transparent; color: var(--muted); border-color: transparent; padding: .25rem .5rem; font-size: .85rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

form { margin: .5rem 0 0; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
label { display: block; margin: .6rem 0; font-size: .88rem; color: var(--muted); }
input, select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .65rem;
  margin-top: .3rem;
  width: 100%;
  max-width: 22rem;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.orders { list-style: none; margin: 0; padding: 0; }
.orders li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
}
.orders li:last-child { border-bottom: 0; }
.orders .intent { color: var(--muted); font-size: .88rem; }
.orders form { margin: 0 0 0 auto; }

.rules { margin: 0; padding-left: 1.15rem; }
.rules li { margin-bottom: .5rem; }

.links { font-size: .9rem; margin: 0 0 1.25rem; }
a { color: var(--accent); text-underline-offset: 3px; }

.cover {
  position: fixed;
  inset: 0;
  background: var(--bg);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  z-index: 10;
  cursor: pointer;
}
/* Без этого правила display: flex перебивает браузерное [hidden] { display: none },
   и заглушка висит поверх экрана всегда, а клик по ней ничего не меняет. */
.cover[hidden] { display: none; }

/* Проектор читают с задних рядов — там всё крупнее. */
body.projector { font-size: 20px; }
body.projector main { max-width: 78rem; }
body.projector h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
body.projector .track .value { font-size: 2.4rem; }
body.projector .news { font-size: 1.15rem; line-height: 1.75; }
body.projector table { font-size: 1.1rem; }

/* Лента новостей раунда */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item {
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item .headline { font-weight: 600; letter-spacing: -0.01em; }
.feed-item .detail { color: var(--muted); font-size: .9rem; }
.feed-item.hint .headline { font-weight: 500; font-style: italic; color: var(--muted); }
.feed-item.world .headline, .feed-item.scenario_event .headline { color: var(--warn); }

.track .delta { display: block; font-size: .8rem; margin-top: .15rem; }
.track .delta.up { color: var(--up); }
.track .delta.down { color: var(--down); }
.track .delta.flat { color: var(--muted); opacity: .7; }
body.projector .feed-item .headline { font-size: 1.2rem; }
body.projector .feed-item .detail { font-size: 1rem; }
.track .delta.flat { opacity: 1; }

.langbar { font-size: .8rem; color: var(--muted); margin: 0 0 1.25rem; }
.langbar a { margin-left: .4rem; text-decoration: none; }
.langbar a.current { font-weight: 600; text-decoration: underline; }

/* Телефоны: команды заходят со своих устройств */
@media (max-width: 640px) {
  body { font-size: 17px; }
  main { padding: 1rem .9rem 6rem; }
  h1 { font-size: 1.45rem; }

  /* Палец — не мышь: цель нажатия не меньше 44 пикселей */
  button, .button { padding: .8rem 1.1rem; min-height: 44px; }
  button.ghost { min-height: 36px; padding: .4rem .6rem; }
  input, select { max-width: none; padding: .7rem .65rem; font-size: 16px; }
  .langbar a { display: inline-block; padding: .35rem .5rem; }

  .actions-grid { grid-template-columns: 1fr; }
  .tracks { grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: .45rem; }
  .track .value { font-size: 1.25rem; }
  .row { flex-direction: column; align-items: stretch; }
  .orders li { flex-direction: column; align-items: flex-start; }
  .orders form { margin: .25rem 0 0; }
  table { font-size: .9rem; }
  td, th { padding: .5rem .4rem .5rem 0; }

  /* Кнопка сдачи не должна теряться под длинным списком действий:
     на телефоне она закреплена у нижнего края экрана. */
  .submitbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: .7rem .9rem calc(.7rem + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px -16px rgb(0 0 0 / 45%);
    z-index: 5;
  }
  .submitbar button { width: 100%; }
}

/* Свёрнутые действия: на телефоне четырнадцать раскрытых карточек — это
   десять экранов прокрутки до нужного решения. */
details.action > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
details.action > summary::-webkit-details-marker { display: none; }
details.action > summary::after { content: "＋"; position: absolute; right: 1.25rem; color: var(--muted); }
details.action[open] > summary::after { content: "−"; }
details.action { position: relative; }
.action-title { font-weight: 600; }
.action-cost { font-size: .85rem; color: var(--muted); }
details.action[open] > summary { margin-bottom: .6rem; }
.round.warn { color: var(--warn); }

/* Роли: состояние должно читаться, а не угадываться */
.status .big { font-size: 1.05rem; padding: .7rem .9rem; }
.proposal { align-items: flex-start; gap: .6rem; }
.proposal > div { display: flex; flex-direction: column; gap: .1rem; }
.proposal .vote-state { color: var(--accent); }
a.card.action { text-decoration: none; color: inherit; display: block; }
a.card.action:hover { border-color: var(--accent); }
.rolecode { font-family: inherit; font-size: .82rem; letter-spacing: 0; color: var(--muted); }
.rolecode b { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em; color: var(--text); }
.rolerow td { color: var(--muted); font-size: .9rem; }
