:root {
  --bg-a: #08121c;
  --bg-b: #193952;
  --card: #f5f7fb;
  --ink: #102130;
  --muted: #495c6e;
  --accent: #e66a2f;
  --accent-dark: #af4517;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #295b7a, var(--bg-a) 35%), linear-gradient(140deg, var(--bg-a), var(--bg-b));
  min-height: 100vh;
}

.screen {
  padding: 20px;
  display: grid;
  place-items: center;
}

.card {
  width: min(760px, 96vw);
  background: color-mix(in hsl, var(--card) 94%, #ffffff 6%);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.32);
}

.card.narrow {
  width: min(480px, 96vw);
}

.card.wide {
  width: min(940px, 96vw);
}

.home-card {
  width: min(860px, 96vw);
}

h1,
h2 {
  margin: 0 0 10px;
}

.subtitle {
  margin: 0 0 20px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

section + section {
  margin-top: 22px;
}

.stack {
  display: grid;
  gap: 10px;
}

.mode-switch {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #d5dce3;
  background: #eaf0f5;
  width: fit-content;
}

.mode-chip {
  position: relative;
  margin: 0;
}

.mode-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.mode-chip span {
  display: block;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.mode-chip input:checked + span {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}

.mode-chip input:focus-visible + span {
  outline: 2px solid #2c87c6;
  outline-offset: 1px;
}

.home-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 4px;
}

.home-option {
  background: #fff;
  border: 1px solid #d5dce3;
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.home-option[hidden] {
  display: none;
}

.home-options section + section {
  margin-top: 0;
}

.home-option h2 {
  margin: 0;
}

.home-option .muted {
  margin: 0;
  min-height: 2.2em;
}

.home-option button {
  margin-top: auto;
}

.form-error {
  margin: 0;
  color: #9f1c1c;
  font-size: 14px;
  font-weight: 600;
}

input,
button,
select {
  border-radius: 10px;
  border: 1px solid #cfd7de;
  padding: 10px 12px;
  font-size: 15px;
  background: #fff;
}

input:focus-visible {
  outline: 2px solid #2c87c6;
  outline-offset: 1px;
}

button {
  background: linear-gradient(180deg, #f27d47, var(--accent));
  border: none;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: linear-gradient(180deg, #ef6f3a, var(--accent-dark));
}

button.danger {
  background: linear-gradient(180deg, #d65555, #b73434);
}

button.danger:hover {
  background: linear-gradient(180deg, #cb4c4c, #a52b2b);
}

.ghost-link {
  color: #25567c;
  text-decoration: none;
  font-weight: 600;
}

.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.split {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel {
  background: #fff;
  border: 1px solid #d5dce3;
  border-radius: 12px;
  padding: 16px;
}

.qr {
  width: 100%;
  max-width: 260px;
  display: block;
  margin: 0 auto;
}

.players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.players li {
  background: #f2f5f8;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.players li.dropped {
  opacity: 0.7;
}

.player-name {
  overflow-wrap: anywhere;
}

.name-line {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.name-markers {
  display: inline-flex;
  gap: 4px;
  width: 2.8em;
  flex: 0 0 2.8em;
}

.name-marker {
  display: inline-block;
  width: 1.2em;
  text-align: center;
}

.name-marker.hidden {
  visibility: hidden;
}

.name-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.result-editor {
  display: grid;
  gap: 8px;
}

.result-counters {
  display: grid;
  gap: 6px;
}

.result-counter {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
}

.result-counter-label {
  font-size: 14px;
  color: var(--muted);
}

.counter-btn {
  padding: 4px 10px;
  min-width: 34px;
}

.counter-value {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
}

.seating-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.pairing-row {
  border: 1px solid #d5dce3;
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: #fff;
}

.table-wrap {
  overflow-x: auto;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.standings-table th,
.standings-table td {
  border-bottom: 1px solid #e1e6eb;
  text-align: left;
  padding: 8px;
  white-space: nowrap;
}

.history-line {
  margin: 0;
}
