@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/InstrumentSerif-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f3eee6;
  --ink: #241f1b;
  --muted: #6f675e;
  --line: rgba(36, 28, 22, 0.1);
  --clay: #c96442;
  --fill: #d97757;
  --danger: #8c3b2e;
  --serif: "Instrument Serif", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

html { background: var(--paper); }

body {
  min-height: 100vh;
  color: var(--ink);
  background: transparent;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color-scheme: light;
}

.wash {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.wash i {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 221, 200, 0.95) 0%, rgba(246, 221, 200, 0) 64%);
}

.wash i:nth-child(1) {
  width: 46vw;
  height: 40vw;
  left: -16vw;
  top: -18vw;
}

.wash i:nth-child(2) {
  width: 34vw;
  height: 38vw;
  right: -14vw;
  top: 18vh;
  background: radial-gradient(circle, rgba(236, 196, 170, 0.55) 0%, rgba(236, 196, 170, 0) 62%);
}

.wash i:nth-child(3) {
  width: 28vw;
  height: 24vw;
  left: 8vw;
  bottom: -14vw;
  background: radial-gradient(circle, rgba(244, 214, 190, 0.7) 0%, rgba(244, 214, 190, 0) 60%);
}

.wash i:nth-child(4) {
  width: 22vw;
  height: 22vw;
  right: 6vw;
  bottom: -8vw;
  background: radial-gradient(circle, rgba(232, 186, 160, 0.4) 0%, rgba(232, 186, 160, 0) 58%);
}

[hidden] { display: none !important; }

::selection { background: #f0d2c4; }

:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

button:disabled { opacity: 0.45; cursor: default; }

a { color: inherit; }

.page {
  position: relative;
  z-index: 1;
  width: min(42rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.6rem 0 4.5rem;
}

body[data-page="admin"] .page { width: min(44rem, calc(100% - 2rem)); }

.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
}

.brand {
  font-family: var(--serif);
  font-size: 1.9rem;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.brand span { color: var(--clay); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 32px;
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.72);
  font-size: 0.82rem;
  color: var(--muted);
}

#phase-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #b3aa9e;
}

.pill.running #phase-dot,
.pill.done #phase-dot { background: #3c8f62; }

.pill.paused #phase-dot { background: #c4922a; }

.pill.error #phase-dot,
.pill.stopped #phase-dot { background: #a33b32; }

h1 {
  margin: 1.15rem 0 0.15rem;
  font-family: var(--serif);
  font-size: clamp(2.7rem, 7vw, 4.4rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.035em;
}

body[data-page="admin"] h1 { font-size: clamp(2.6rem, 7vw, 4.2rem); }

h2 {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.lede, .quiet, .note, .hint { color: var(--muted); }

.lede {
  margin: 0.45rem 0 0;
  font-size: 1.08rem;
}

.hint { margin: 0.7rem 0 0; font-size: 0.95rem; }

.hint.bad { color: var(--danger); }

.progress-block { margin-top: 1.55rem; }

.follow {
  margin: 1.35rem auto 0;
  max-width: 28rem;
  text-align: center;
}

.follow-kicker,
.follow-note {
  margin: 0;
  color: var(--muted);
}

.follow-kicker { font-size: 0.95rem; }

.follow-time {
  margin: 0.2rem 0 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 9vw, 4.4rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.follow-note {
  margin-top: 0.45rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.35;
}

.follow.held .follow-time { color: var(--danger); }

.follow-setup { margin-top: 1.15rem; }

.hero-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
}

.percent {
  font-family: var(--serif);
  font-size: clamp(4.4rem, 14vw, 6.8rem);
  line-height: 0.84;
  letter-spacing: -0.045em;
}

.hero-unit {
  font-family: var(--serif);
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  line-height: 1;
  color: var(--muted);
}

.track {
  height: 3px;
  margin-top: 1rem;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(36, 28, 22, 0.08);
}

#progress-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: var(--fill);
  transition: width 0.45s ease;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0;
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.facts span:not(:last-child)::after {
  content: "·";
  margin: 0 0.55rem;
  color: #c4b8aa;
}

.refresh::before {
  content: "";
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: #b3aa9e;
  vertical-align: 0.05em;
}

body.checking .refresh::before {
  background: var(--clay);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

.figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem 0.75rem;
  margin: 2rem 0 0;
}

.figures p { margin: 0; }

.figures b {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.85rem, 4.5vw, 2.45rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.figures span {
  display: block;
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.quiet { margin: 0.55rem 0 0; }

.note {
  max-width: 38rem;
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
}

.note.left { margin-left: 0; }

.block { margin-top: 2.15rem; }

.person {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}

.avatar {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border-radius: 50%;
  background: #efe6da;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px #d4cbc0;
}

.avatar.online { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px #3c8f62; }
.avatar.ingame { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--fill); }
.avatar.away { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px #c4922a; }
.avatar.busy { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px #a33b32; }

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar span {
  font-family: var(--serif);
  font-size: 1.2rem;
}

.dot.online,
.chip.online i { background: #3c8f62; }
.dot.ingame,
.chip.ingame i { background: var(--fill); }
.dot.away,
.chip.away i { background: #c4922a; }
.dot.busy,
.chip.busy i { background: #a33b32; }
.dot.offline,
.dot.unknown,
.chip.offline i,
.chip.unknown i { background: #b3aa9e; }

.person-name { font-size: 1.02rem; }

.person-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.22rem;
  padding: 0.08rem 0.55rem 0.1rem 0.42rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.8);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.35;
}

.chip i {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #b3aa9e;
}

.person-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}

.marks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.mark {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.48rem 0.12rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.mark.ok {
  color: #2d6a48;
  border-color: rgba(60, 143, 98, 0.28);
  background: rgba(60, 143, 98, 0.08);
}

.mark.bad {
  color: var(--danger);
  border-color: rgba(140, 59, 46, 0.28);
  background: rgba(140, 59, 46, 0.06);
}

.person-game,
.person-sub,
.person-status,
.badge {
  color: var(--muted);
  font-size: 0.85rem;
}

.person-game { margin-top: 0.12rem; }

.person-copy .person-sub {
  margin-top: 0.16rem;
  font-variant-numeric: tabular-nums;
}

.empty { margin: 0.35rem 0 0; color: var(--muted); }

.event {
  margin: 0;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.summary {
  margin: 0.2rem 0 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1.3;
}

body[data-page="home"] h1,
body[data-page="home"] .lede,
body[data-page="home"] .follow,
body[data-page="home"] .progress-block,
body[data-page="home"] .figures,
body[data-page="home"] .quiet,
body[data-page="home"] .note:not(.left) {
  text-align: center;
}

body[data-page="home"] .facts { justify-content: center; }

body[data-page="home"] .note:not(.left),
body[data-page="home"] #group-who {
  margin-inline: auto;
}

body[data-page="home"] .block,
body[data-page="home"] .person,
body[data-page="home"] .event,
body[data-page="home"] .summary {
  text-align: left;
}

.login {
  display: grid;
  gap: 0.85rem;
  width: min(22rem, 100%);
  margin-top: 1.4rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.3rem;
}

.spacer { flex: 1 1 0.5rem; }

.primary, .ghost {
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
}

.primary {
  border: 0;
  background: #241f1b;
  color: #f7f2ea;
}

.primary:hover:not(:disabled) { background: #3a322c; }

.ghost {
  border: 1px solid rgba(36, 28, 22, 0.14);
  background: rgba(255, 252, 247, 0.45);
}

.ghost:hover:not(:disabled) { background: rgba(255, 252, 247, 0.9); }

.ghost.stop { color: var(--danger); }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1.15rem 0 0.4rem;
}

.tabs button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.tabs button.on {
  background: #241f1b;
  color: #f7f2ea;
}

.pane { padding-top: 0.85rem; }

label {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.86rem;
}

label.check {
  display: flex;
  align-items: center;
  grid-template-columns: none;
  margin-top: 0;
  color: var(--ink);
  font-size: 0.98rem;
  min-height: 44px;
}

.fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1rem;
}

.checks { margin-top: 0.8rem; }

input, select, textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(36, 28, 22, 0.14);
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.72);
}

textarea { resize: vertical; min-height: 7rem; }

.check input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: #241f1b;
}

.adder {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.7rem;
}

.adder input { margin: 0; }

.plus {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.45rem;
  line-height: 1;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.tags, .accounts { margin: 0.4rem 0 0; padding: 0; list-style: none; }

.tags li, .accounts li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.accounts li { align-items: center; flex-wrap: wrap; }

.accounts li.empty { color: var(--muted); }

.who { min-width: 0; }

.who strong { font-weight: 560; }

.row-actions { display: flex; gap: 0.4rem; }

.tags button, .row-actions button {
  min-height: 44px;
  padding: 0.3rem 0.85rem;
  border: 1px solid rgba(36, 28, 22, 0.14);
  border-radius: 999px;
  background: transparent;
}

.row-actions .stop { color: var(--danger); }

.file {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 44px;
  margin-top: 0.9rem;
  padding: 0.55rem 1rem;
  border: 1px solid rgba(36, 28, 22, 0.14);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.45);
  color: var(--ink);
}

.file input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

#cookie-save { margin-top: 0.9rem; }

#replace-form,
#cookie-view { margin-top: 1.2rem; }

.tags li input { flex: 1 1 8rem; min-width: 0; margin: 0; }

.log {
  max-height: 22rem;
  margin-top: 0.8rem;
  padding: 0.35rem 0.9rem;
  overflow: auto;
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.62);
}

.log p {
  margin: 0;
  padding: 0.38rem 0;
  border-bottom: 1px solid rgba(36, 28, 22, 0.06);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.log time {
  display: inline-block;
  min-width: 4.5rem;
  margin-right: 0.55rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .spacer { display: none; }
}

@media (min-width: 720px) {
  .fields { grid-template-columns: 1fr 1fr; }
  .fields label:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

#flies {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.fly {
  position: absolute;
  left: var(--fly-x, 6vw);
  top: calc(var(--fly-y, 16vh) + var(--fly-shift, 0px));
  max-width: 13rem;
  margin: 0;
  color: rgba(90, 74, 64, 0.38);
  font-family: var(--serif);
  font-size: clamp(1.7rem, 2.8vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.fly.left { animation: fly-left 4.6s ease forwards; }
.fly.right { animation: fly-right 4.6s ease forwards; }

@keyframes fly-left {
  0% { opacity: 0; transform: translate(-18px, 8px) rotate(var(--fly-rot, -4deg)); }
  16% { opacity: 1; transform: translate(0, 0) rotate(var(--fly-rot, -4deg)); }
  100% { opacity: 0; transform: translate(-12px, 64px) rotate(var(--fly-rot, -4deg)); }
}

@keyframes fly-right {
  0% { opacity: 0; transform: translate(18px, 8px) rotate(var(--fly-rot, 4deg)); }
  16% { opacity: 1; transform: translate(0, 0) rotate(var(--fly-rot, 4deg)); }
  100% { opacity: 0; transform: translate(12px, 64px) rotate(var(--fly-rot, 4deg)); }
}

@media (max-width: 720px) {
  .fly {
    max-width: 7.5rem;
    color: rgba(90, 74, 64, 0.16);
    font-size: 1.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #progress-bar,
  body.checking .refresh::before { transition: none; animation: none; }
  .fly.left, .fly.right { animation: fly-still 4.6s ease forwards; }
}

@keyframes fly-still {
  0% { opacity: 0; }
  14% { opacity: 0.9; }
  68% { opacity: 0.9; }
  100% { opacity: 0; }
}
