:root {
  --bg: #0a0a0a;
  --fg: #f4f1ea;
  --dim: #8b8880;
  --line: #262523;
  --red: #ff2b2b;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }

html, body { min-height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(16px, 7vh, 72px);
}

main[hidden] { display: none; }

.kicker {
  font-size: clamp(13px, 2.2vw, 17px);
  font-weight: 600;
  letter-spacing: .32em;
  margin-right: -.32em;
  color: var(--dim);
  text-align: center;
}

.clock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(4px, 2vw, 22px);
  width: 100%;
  max-width: 800px;
  margin: clamp(14px, 3vh, 28px) 0 clamp(24px, 5vh, 48px);
}

.clock p { display: grid; justify-items: center; gap: clamp(6px, 1.2vw, 12px); }

.clock b {
  font-size: clamp(50px, 16vw, 148px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}

.clock span {
  font-size: clamp(10px, 1.6vw, 15px);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
}

body[data-danger="1"] .clock b { color: var(--red); }
body[data-danger="2"] .clock b { color: var(--red); animation: pulse 1s steps(2) infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 640px;
}

.act {
  border: 0;
  border-radius: 4px;
  padding: 22px 8px 18px;
  font: inherit;
  cursor: pointer;
  display: grid;
  gap: 6px;
  justify-items: center;
  transition: transform .08s ease, opacity .15s ease;
}

.act:active:not(:disabled) { transform: scale(.975); }
.act:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.act:disabled { opacity: .3; cursor: not-allowed; }
.save { background: var(--fg); color: var(--bg); }
.kill { background: var(--red); color: var(--bg); }
.act-name { font-size: clamp(21px, 5vw, 30px); font-weight: 800; letter-spacing: .02em; }
.act-detail { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }

.notice {
  margin-top: 14px;
  min-height: 20px;
  font-size: 14px;
  color: var(--dim);
  text-align: center;
}

#turnstile { display: flex; justify-content: center; }

.tug {
  width: 100%;
  max-width: 640px;
  height: 3px;
  background: var(--red);
  margin-top: 28px;
}

.tug i { display: block; height: 100%; width: 50%; background: var(--fg); transition: width .4s ease; }

.totals {
  width: 100%;
  max-width: 640px;
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 14px;
  color: var(--dim);
}

.totals b { color: var(--fg); font-weight: 700; font-variant-numeric: tabular-nums; }

.feed {
  list-style: none;
  padding: 0;
  width: 100%;
  max-width: 640px;
  margin-top: 28px;
  border-top: 1px solid var(--line);
}

.feed li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.feed .who { font-weight: 700; }
.feed .kill-word { color: var(--red); }
.feed .when { color: var(--dim); font-size: 13px; white-space: nowrap; }
.feed .said { grid-column: 1 / -1; color: var(--dim); }
.feed .empty { display: block; color: var(--dim); text-align: center; }

#dead { justify-content: center; text-align: center; gap: 18px; padding-bottom: 12vh; }
.grave-date { font-size: clamp(30px, 8vw, 64px); font-weight: 800; letter-spacing: -.02em; }
.grave-killer { font-size: clamp(18px, 4vw, 26px); }
.grave-total { color: var(--dim); font-variant-numeric: tabular-nums; }

footer {
  display: flex;
  justify-content: center;
  gap: 22px;
  padding-top: 28px;
  font-size: 13px;
}

footer a, .page a { color: var(--dim); }

dialog {
  width: min(440px, calc(100vw - 32px));
  margin: auto;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111;
  color: var(--fg);
}

dialog::backdrop { background: rgb(0 0 0 / .75); }
dialog h2 { font-size: 24px; font-weight: 800; }
.pay-effect { color: var(--dim); margin: 4px 0 16px; font-size: 15px; }

dialog label { display: block; font-size: 14px; margin-bottom: 12px; }
dialog small { color: var(--dim); }

dialog input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
  font: inherit;
  font-size: 16px;
}

dialog input:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }

.check { display: grid !important; grid-template-columns: 22px 1fr; gap: 8px; color: var(--dim); font-size: 13px !important; line-height: 1.4; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--fg); }

.pay-error { color: var(--red); font-size: 14px; min-height: 20px; margin-bottom: 6px; }

.confirm, .cancel { display: block; width: 100%; border: 0; border-radius: 4px; font: inherit; cursor: pointer; }
.confirm { padding: 15px; background: var(--fg); color: var(--bg); font-weight: 800; font-size: 17px; }
.confirm:disabled { opacity: .5; cursor: wait; }
dialog[data-action="kill"] .confirm { background: var(--red); }
.cancel { padding: 12px; margin-top: 4px; background: none; color: var(--dim); }

.page {
  align-items: stretch;
  max-width: 640px;
  line-height: 1.55;
  font-size: 16px;
}

.page h1 { font-size: 30px; font-weight: 800; margin-bottom: 18px; }
.page h2 { font-size: 18px; margin: 22px 0 6px; }
.page ul { padding-left: 20px; }
.page p, .page li { color: #cfccc4; margin-bottom: 8px; }
