:root {
  --ground: #eef1ec;
  --paper: #f7f8f5;
  --field: #e6ebe6;
  --ink: #16181d;
  --muted: #4f5b56;
  --line: #d2dad3;
  --line-strong: #a7b3a9;
  --accent: #0b6b62;
  --accent-dark: #08544d;
  --accent-soft: #d9eae5;
  --sans: 'IBM Plex Sans', 'IBM Plex Sans Hebrew', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: 'IBM Plex Serif', 'IBM Plex Sans Hebrew', Georgia, 'Times New Roman', serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/1.5 var(--sans);
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

html[lang='he'] h1,
html[lang='he'] h2,
html[lang='he'] h3 { letter-spacing: 0; }

p { margin: 0; }
a { color: var(--accent); }

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

.tab { font-variant-numeric: tabular-nums; }

.label {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.hint {
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.plain-value {
  display: block;
  font-size: 17px;
  font-weight: 500;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Masthead */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.masthead-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
}

.masthead .note {
  font-size: 14px;
  color: var(--muted);
}

.lang {
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.lang:hover { border-color: var(--line); color: var(--accent); }
.lang:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Landing */

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: start;
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  font-size: clamp(38px, 5.2vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  max-width: 18ch;
}

html[lang='he'] .hero h1 { letter-spacing: 0; }

.hero-line {
  max-width: 44ch;
  padding-top: 10px;
  font-size: 18px;
  color: var(--muted);
}

.forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.form {
  display: flex;
  flex-direction: column;
  padding: 48px 0 56px;
}
.form + .form {
  border-inline-start: 1px solid var(--line);
  padding-inline-start: 48px;
}
.forms .form:first-child { padding-inline-end: 48px; }

.form h2 { font-size: 26px; margin-bottom: 6px; }
.form .hint { margin-bottom: 4px; }

.field { display: block; margin-top: 20px; }
.field .label { margin-bottom: 6px; }

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--paper);
}

.field input::placeholder { color: #79867f; }

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-variant-numeric: tabular-nums;
  font-size: 20px;
}

input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line-strong); color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; }

.form .btn { width: 100%; }

.form-actions {
  margin-top: auto;
  padding-top: 24px;
}

.panel .btn.block { margin-top: 20px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 14px;
  font-size: 16px;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.help {
  padding: 24px 0 72px;
}

.help summary {
  min-height: 44px;
  line-height: 44px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.help summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.help dl {
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
}

.help dl > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.help dt {
  padding-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.help dd {
  margin: 0;
  font-size: 15px;
  max-width: 62ch;
}

@media (max-width: 600px) {
  .help dl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* In-game frame */

.screen {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--line);
}

.topbar .brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
}

.topbar-right {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.topbar .stats { display: flex; gap: 20px; }
.topbar .stat .value {
  display: block;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

.screen-title {
  font-size: clamp(30px, 7vw, 38px);
  margin: 40px 0 8px;
  max-width: 22ch;
}

.screen-sub {
  font-size: 16px;
  color: var(--muted);
  max-width: 52ch;
}

.panel {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.panel .label { margin-bottom: 4px; }

.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.roster > li:last-child { border-bottom: 0; }

fieldset.roster {
  border: 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}

.row .idx {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row .who {
  font-size: 17px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.row .who .tag {
  display: inline-block;
  margin-inline-start: 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1px 6px;
  vertical-align: 1px;
}

.row .meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.row.dead .who {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.row .count {
  min-width: 1.5ch;
  text-align: end;
  font-size: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Selectable rows are labels wrapping a radio */

.option {
  position: relative;
  cursor: pointer;
}

.option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.option:hover { background: var(--field); }

.option:has(input:checked) {
  background: var(--accent-soft);
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.option:has(input:disabled) { cursor: default; opacity: 0.7; }

/* Stamps */

.stamp {
  display: inline-block;
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 3px 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
  transform: rotate(-3deg);
}

html[lang='he'] .stamp { letter-spacing: 0.04em; }

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-inline-start: 3px solid var(--accent);
  background: var(--paper);
  font-size: 15px;
}

.notice.error { border-inline-start-color: var(--ink); }
.notice p { flex: 1; }

.inset {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--accent);
  background: var(--paper);
}

.inset .label { margin-bottom: 4px; }
.inset p { font-size: 17px; }
.inset ul {
  margin: 8px 0 0;
  padding-inline-start: 18px;
  font-size: 15px;
  color: var(--muted);
}

.report {
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
}

.report > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.report dt { font-size: 15px; color: var(--muted); }
.report dd { margin: 0; font-size: 17px; font-weight: 500; text-align: end; }

.actionbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
}

.actionbar .hint { flex: 1; }

/* Lobby */

.room-code {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(40px, 11vw, 56px);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-top: 4px;
}

.settings {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding-top: 0;
}

.settings .field { margin-top: 0; min-width: 200px; }

.setup {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.setup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}

.setup-name {
  font-size: 17px;
  font-weight: 500;
}

.setup-max {
  margin-inline-start: 10px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper output {
  min-width: 28px;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
}

.step {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--paper);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.step:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.step:disabled { opacity: 0.35; cursor: not-allowed; }
.step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.role-rule { margin-top: 10px; }

.lobby-head { margin-top: 32px; border-top: 0; }
.lobby-status { margin-top: 10px; }
.lobby-share { margin-top: 8px; }
.settings select { min-height: 44px; }

/* Role card */

.role-card > .label { margin-top: 32px; }

.role-name {
  font-size: clamp(42px, 10vw, 64px);
  line-height: 1;
  margin: 6px 0 16px;
}

.role-duty {
  font-size: 19px;
  max-width: 46ch;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin: 32px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.facts .value { display: block; font-size: 17px; font-weight: 500; }

/* End screen */

.verdict-title { font-size: clamp(34px, 8vw, 48px); }

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 40px 0 32px;
  }
  .hero h1 { max-width: 18ch; }
  .forms { grid-template-columns: 1fr; }
  .form { padding: 40px 0; }
  .form + .form {
    border-inline-start: 0;
    border-top: 1px solid var(--line);
    padding-inline-start: 0;
  }
  .forms .form:first-child { padding-inline-end: 0; }
  .masthead .note { display: none; }
}

@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .screen { padding: 0 16px 48px; }
  .topbar-right { gap: 10px; }
  .topbar .stats { gap: 12px; }
  .topbar .brand { font-size: 18px; }
  .topbar .stat.case { display: none; }
  .settings { flex-direction: column; align-items: stretch; }
  .actionbar { flex-direction: column; align-items: stretch; }
  .actionbar .btn { width: 100%; }
}
