:root {
  --bg: #f1f2f4;
  --surface: #fbfbfa;
  --ink: #1d2229;
  --muted: #747b84;
  --line: #d8dadd;
  --primary: #3d4652;
  --primary-ink: #ffffff;
  --gold: #b7a06a;
  --amber: #9c6b2f;
  --danger: #b42318;
  --green: #16803c;
  --radius: 8px;
  --shadow: 0 16px 34px rgba(24, 28, 34, .08);
  --shadow-soft: 0 8px 22px rgba(24, 28, 34, .06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
}

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

a {
  color: inherit;
  text-decoration: none;
}

.mono {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
}

.admin-body {
  background: linear-gradient(180deg, #f8f8f7 0%, var(--bg) 52%, #eaedf0 100%);
}

.topbar {
  min-height: 60px;
  padding: 9px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 250, .94);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(24, 28, 34, .05);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand strong {
  display: block;
  line-height: 1.2;
}

.brand small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(145deg, #6f747b 0%, #20262e 72%);
  color: #d8c27d;
  display: inline-grid;
  place-items: center;
  font-family: Consolas, monospace;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.26), 0 8px 18px rgba(29,34,41,.14);
}

.brand-mark.owner {
  background: linear-gradient(145deg, #777d85 0%, #2b3138 72%);
  color: #f5e3a1;
}

.brand-mark.large {
  width: 54px;
  height: 54px;
  font-size: 28px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.warning-strip {
  padding: 9px 28px;
  background: #fff7ed;
  color: #9a3412;
  border-bottom: 1px solid #fed7aa;
  font-size: 14px;
}

.page-shell {
  width: min(1280px, calc(100% - 40px));
  margin: 20px auto 40px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
}

.page-heading.compact {
  align-items: center;
}

.page-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}

.page-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.heading-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.surface {
  background: linear-gradient(180deg, #ffffff 0%, var(--surface) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.button {
  min-height: 38px;
  border: 1px solid #cfd2d6;
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f5f6 100%);
  color: var(--ink);
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}

.button:hover {
  border-color: #a9adb4;
  box-shadow: var(--shadow-soft);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .62;
}

.button.primary {
  border-color: #303844;
  background: linear-gradient(180deg, #56606b 0%, #343d49 100%);
  color: var(--primary-ink);
}

.button.amber {
  border-color: var(--amber);
  background: var(--amber);
  color: #fff;
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.button.ghost {
  background: linear-gradient(180deg, #fbfbfb 0%, #f0f1f3 100%);
  color: #444b55;
}

.button.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 14px;
}

.button.wide,
.wide {
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: #546273;
  font-weight: 600;
  font-size: 13px;
  background: #f8fafc;
}

.data-table td small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.right {
  text-align: right !important;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.actions form {
  display: inline-flex;
  margin: 0;
}

.pill {
  border-radius: 999px;
  border: 1px solid #cbd5df;
  background: #f8fafc;
  color: #475569;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  font-size: 13px;
}

.pill.green {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--green);
}

.pill.amber {
  border-color: #fed7aa;
  background: #fff7ed;
  color: var(--amber);
}

.pill.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.pill.muted {
  color: #64748b;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--ink);
  margin: 0;
}

.login-layout {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  width: 100%;
  padding: 16px;
  box-sizing: border-box;
}

.login-panel {
  width: 100%;
  max-width: 380px;
  min-width: 0;
  box-sizing: border-box;
  padding: 28px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-heading h1 {
  margin: 0;
  font-size: 26px;
}

.login-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.stack-form,
.form-grid,
.inline-form {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.stack-form label,
.form-grid label,
.inline-form label,
.full-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

label span,
.full-field span {
  color: #536171;
  font-size: 13px;
}

input,
select,
textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
}

textarea {
  min-height: 320px;
  resize: vertical;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 12px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, .18);
  border-color: var(--primary);
}

.password-field {
  display: grid;
  min-width: 0;
  max-width: 100%;
}

.password-field input {
  grid-area: 1 / 1;
  min-width: 0;
  width: 100%;
  padding-right: 64px;
}

.password-toggle {
  grid-area: 1 / 1;
  align-self: center;
  justify-self: end;
  z-index: 1;
  width: 48px;
  min-height: 28px;
  margin-right: 8px;
  border: 1px solid #dbe1e8;
  border-radius: 6px;
  background: #f7f9fb;
  color: #64748b;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
}

.password-toggle:hover {
  border-color: #cbd5df;
  background: #f7f9fb;
  color: #0f172a;
}

.form-error {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 7px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.form-success {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 7px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.settings-grid {
  display: grid;
  gap: 14px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 14px;
}

.stat-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
  line-height: 1.18;
}

.stat-card .compact-value {
  font-size: 22px;
  overflow-wrap: anywhere;
}

.status-text {
  display: block;
  margin-top: 6px;
  font-size: 13px;
}

.status-text.green {
  color: var(--green);
}

.status-text.amber {
  color: var(--amber);
}

.status-text.danger {
  color: var(--danger);
}

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

.admin-table td {
  min-width: 120px;
}

.form-section {
  padding: 16px;
}

.form-section h2,
.side-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.tournament-list-surface {
  margin-top: 4px;
}

.tournament-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tournament-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f8f8 100%);
  box-shadow: var(--shadow-soft);
}

.tournament-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.tournament-card-head strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.tournament-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tournament-card-metrics div {
  min-width: 0;
  border: 1px solid #e1e3e6;
  border-radius: 7px;
  background: rgba(255,255,255,.72);
  padding: 8px;
}

.tournament-card-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.tournament-card-metrics strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tournament-card-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.tournament-card-actions form,
.tournament-card-actions .button {
  width: 100%;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-title-row h2 {
  margin: 0;
}

.form-grid {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.form-grid.tight {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.color-field {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.color-swatch {
  padding: 3px;
  min-height: 42px;
  cursor: pointer;
}

.color-hex {
  text-transform: lowercase;
}

.input-invalid {
  border-color: var(--danger) !important;
  background: #fff7f7;
}

.checkline {
  display: flex !important;
  align-items: center;
  gap: 9px;
}

.checkline input {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

.full-field {
  margin-top: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.blind-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 10px;
}

.blind-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.blind-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.blind-table th,
.blind-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.blind-table th {
  background: #f8fafc;
  color: #536171;
  font-size: 13px;
  font-weight: 600;
}

.blind-table tr:last-child td {
  border-bottom: 0;
}

.blind-table input,
.blind-table select {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  background: #fff;
  width: 100%;
}

.blind-table .break-row {
  background: #f8fbff;
}

.blind-actions {
  white-space: nowrap;
}

.icon-action {
  min-width: 30px;
  height: 30px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  margin-left: 4px;
  color: #334155;
}

.danger-text {
  color: var(--danger);
}

.json-details {
  margin-top: 12px;
}

.json-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.json-details textarea {
  min-height: 160px;
}

.asset-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
}

.asset-preview-row figure {
  margin: 0;
  width: 180px;
}

.asset-preview-row img {
  width: 180px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
}

.asset-preview-row figcaption {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr) minmax(280px, .75fr);
  gap: 14px;
  align-items: start;
}

.timer-console {
  padding: 18px;
  grid-row: auto;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
}

.timer-value {
  font-size: clamp(66px, 10vw, 134px);
  line-height: 1;
  margin: 18px 0 12px;
  color: #2f3a46;
  text-align: center;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e6edf3;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0f766e, #c28a14);
}

.console-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.console-stats div,
.metric-pair div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #f8fafc;
}

.console-stats span,
.metric-pair span,
.muted-line {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.console-stats strong,
.metric-pair strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-row {
  margin: 10px 0 16px;
}

.side-panel {
  padding: 14px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 12px;
}

.inline-form:has(button + button) {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.metric-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.projection-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.projection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.projection-actions form {
  margin: 0;
}

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

.event-list li {
  display: grid;
  grid-template-columns: 70px 90px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.event-list span {
  color: var(--ink);
}

.empty-log {
  display: block !important;
}

.projection-body {
  margin: 0;
  background: #030712;
  overflow: hidden;
}

.projection-stage {
  --projection-timer: #00e5ff;
  --projection-font-color: #ffffff;
  --projection-progress: #00e5ff;
  --projection-registration: #007846;
  --projection-font: "Microsoft YaHei";
  width: 100vw;
  height: 100vh;
  color: var(--projection-font-color);
  background-color: #060a1a;
  background-size: cover;
  background-position: center;
  font-family: var(--projection-font), "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  display: grid;
  grid-template-columns: clamp(220px, 15vw, 310px) minmax(0, 1fr) clamp(300px, 18vw, 390px);
  grid-template-rows: 7vh 1fr 4vh;
}

.projection-top {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: clamp(180px, 15vw, 310px) minmax(0, 1fr) 120px clamp(150px, 10vw, 190px);
  align-items: center;
  border-bottom: 1px solid rgba(115, 165, 220, .35);
  background: rgba(7, 17, 38, .86);
  padding: 0 2vw;
  gap: 18px;
}

.projection-brand strong {
  color: #ffcc38;
  font-family: Consolas, monospace;
  font-size: clamp(22px, 2.1vw, 38px);
}

.projection-brand img {
  max-width: 10vw;
  max-height: 5vh;
}

.projection-top h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(20px, 2.1vw, 40px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.projection-top span {
  border: 1px solid #ffcc38;
  background: #ffcc38;
  color: #071126;
  border-radius: 6px;
  padding: 7px 12px;
  text-align: center;
  font-weight: 800;
}

.projection-top time {
  text-align: right;
  color: var(--projection-font-color);
  font-family: Consolas, monospace;
  font-size: clamp(16px, 1.4vw, 26px);
}

.projection-left,
.projection-right {
  min-width: 0;
  box-sizing: border-box;
  padding: 5vh clamp(16px, 1.2vw, 26px);
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 2.1vh;
  background: rgba(4, 12, 30, .48);
}

.projection-left {
  border-right: 1px dashed rgba(115, 165, 220, .32);
}

.projection-right {
  border-left: 1px dashed rgba(115, 165, 220, .32);
  padding-top: 3vh;
  padding-bottom: 3vh;
  gap: 1.25vh;
}

.projection-left span,
.projection-right span,
.projection-info dt {
  color: var(--projection-font-color);
  font-size: clamp(13px, 1.1vw, 22px);
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
}

.projection-left strong,
.projection-right strong {
  font-family: Consolas, monospace;
  font-size: clamp(30px, 4.2vw, 78px);
  color: var(--projection-font-color);
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
}

.projection-right strong {
  font-size: 42px;
  line-height: 1.05;
}

.projection-right .projection-side-highlight {
  color: #ffd700;
}

.projection-right .projection-side-blue {
  color: #2f91ff;
}

.projection-right .projection-side-green {
  color: #00f5a8;
}

@media (max-width: 1600px) {
  .projection-stage {
    grid-template-columns: 220px minmax(0, 1fr) 300px;
  }

  .projection-right strong {
    font-size: 34px;
  }
}

@media (max-width: 1200px) {
  .projection-stage {
    grid-template-columns: 190px minmax(0, 1fr) 250px;
  }

  .projection-right strong {
    font-size: 28px;
  }
}

.projection-left small {
  color: var(--projection-font-color);
  font-family: Consolas, monospace;
  margin-top: -2vh;
}

.projection-divider {
  width: 75%;
  border-top: 1px solid rgba(115, 165, 220, .34);
}

.projection-center {
  min-width: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  padding: 4vh 4vw;
}

.break-label {
  min-height: 7vh;
  font-size: clamp(24px, 3.6vw, 70px);
  color: var(--projection-timer);
  font-weight: 800;
}

.projection-time {
  font-size: clamp(88px, 14vw, 260px);
  line-height: .95;
  color: var(--projection-timer);
  text-shadow: 0 0 24px currentColor;
}

.projection-blinds {
  display: flex;
  gap: 3vw;
  align-items: center;
  justify-content: center;
  margin-top: 4vh;
  font-size: clamp(24px, 3vw, 58px);
}

.projection-blinds span {
  color: var(--projection-font-color);
}

.projection-blinds strong {
  color: var(--projection-font-color);
}

.projection-progress {
  width: min(980px, 86%);
  height: 10px;
  margin-top: 4vh;
  border-radius: 999px;
  background: rgba(117, 151, 190, .24);
  overflow: hidden;
}

.projection-progress span {
  display: block;
  height: 100%;
  background: var(--projection-progress);
}

.registration-badge {
  margin-top: 4vh;
  min-width: 220px;
  text-align: center;
  border: 2px solid var(--projection-registration);
  background: var(--projection-registration);
  border-radius: 7px;
  padding: 11px 24px;
  font-size: clamp(16px, 1.6vw, 30px);
  font-weight: 800;
}

.registration-badge.closed {
  border-color: #475569;
  background: rgba(30, 41, 59, .84);
  color: #94a3b8;
}

.projection-info {
  margin: 4vh 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3vw;
}

.projection-info div {
  min-width: 240px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 18px;
  align-items: baseline;
}

.projection-info dd {
  margin: 0;
  color: var(--projection-font-color);
  font-family: Consolas, monospace;
  font-size: clamp(20px, 2vw, 40px);
}

.projection-bottom {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  background: rgba(7, 17, 38, .92);
  color: var(--projection-font-color);
  font-family: Consolas, monospace;
  font-size: clamp(11px, .9vw, 18px);
  border-top: 1px solid rgba(115, 165, 220, .25);
}

@media (max-width: 900px) {
  .topbar,
  .page-heading,
  .topnav {
    align-items: stretch;
    flex-direction: column;
  }

  .page-shell {
    width: min(100% - 24px, 1280px);
    margin-top: 16px;
  }

  .form-grid,
  .form-grid.tight,
  .control-grid,
  .console-stats,
  .metric-pair {
    grid-template-columns: 1fr;
  }

  .admin-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .merchant-stats .membership-card {
    grid-column: 1 / -1;
  }

  .timer-console {
    grid-row: auto;
  }

  .data-table {
    min-width: 760px;
  }

  .surface {
    overflow-x: auto;
  }

  .tournament-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 681px) and (max-width: 900px) {
  .control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-grid .timer-console {
    grid-column: 1 / -1;
  }

  .console-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  body {
    background: #f6f8fb;
  }

  .topbar {
    position: static;
    padding: 9px 12px;
    gap: 8px;
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .brand {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand small {
    font-size: 12px;
  }

  .topnav {
    width: auto;
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
  }

  .topnav .button,
  .topnav form,
  .topnav form .button {
    width: auto;
  }

  .topnav > span {
    grid-column: auto;
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topnav .button {
    min-height: 34px;
    padding: 6px 10px;
  }

  .warning-strip {
    padding: 10px 12px;
    font-size: 13px;
  }

  .page-shell {
    width: 100%;
    margin: 0;
    padding: 10px;
  }

  .page-heading {
    gap: 10px;
    margin-bottom: 10px;
  }

  .page-heading.compact {
    align-items: flex-end;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .page-heading.compact > .button {
    width: auto;
  }

  .page-heading.compact .heading-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .page-heading.compact .heading-actions .button {
    width: 100%;
  }

  .page-heading h1 {
    font-size: 24px;
  }

  .page-heading p {
    font-size: 14px;
  }

  .heading-actions,
  .heading-actions .button {
    width: 100%;
  }

  .surface {
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(20, 32, 45, .06);
    overflow: visible;
  }

  .admin-stat-grid {
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card strong {
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  .responsive-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }

  .responsive-table tr:last-child {
    border-bottom: 0;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 0;
    text-align: left !important;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
  }

  .responsive-table td.actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .responsive-table td.actions::before {
    content: "";
    display: none;
  }

  .actions .button,
  .button-row .button {
    width: 100%;
  }

  .actions form {
    width: 100%;
  }

  .timer-console,
  .side-panel,
  .form-section,
  .login-panel {
    padding: 12px;
  }

  .tournament-card-grid {
    gap: 10px;
  }

  .tournament-card {
    padding: 10px;
  }

  .tournament-card-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 8px;
  }

  .tournament-card-head strong {
    font-size: 15px;
  }

  .tournament-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .tournament-card-metrics div {
    padding: 6px;
  }

  .tournament-card-metrics strong {
    font-size: 13px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .tournament-card-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .tournament-card-actions .button {
    min-height: 32px;
    padding: 5px 6px;
    font-size: 13px;
  }

  .login-panel {
    width: calc(100vw - 56px);
    max-width: calc(100vw - 56px);
  }

  .timer-value {
    font-size: clamp(62px, 19vw, 92px);
    margin: 20px 0 14px;
  }

  .status-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .console-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
  }

  .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .button-row .button.primary,
  .button-row .button.amber,
  .button-row .button.danger {
    grid-column: span 2;
  }

  .inline-form,
  .inline-form:has(button + button),
  .projection-link,
  .projection-actions {
    grid-template-columns: 1fr;
  }

  .projection-actions {
    display: grid;
  }

  .projection-actions .button,
  .projection-actions form {
    width: 100%;
  }

  .event-list li {
    grid-template-columns: 1fr;
    gap: 2px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .form-grid,
  .form-grid.tight {
    gap: 12px;
  }

  .settings-grid .form-grid,
  .settings-grid .form-grid.tight {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .settings-grid .checkline {
    min-height: 40px;
  }

  .settings-grid input[type="file"] {
    font-size: 12px;
    padding: 7px;
  }

  textarea {
    min-height: 180px;
  }

  .blind-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .blind-table-wrap {
    border: 0;
    overflow: visible;
  }

  .blind-table {
    min-width: 0;
  }

  .blind-table thead {
    display: none;
  }

  .blind-table,
  .blind-table tr,
  .blind-table td {
    display: block;
    width: 100%;
  }

  .blind-table tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
  }

  .blind-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    margin-bottom: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .blind-table tr::before {
    content: attr(data-level-title);
    display: block;
    font-weight: 800;
    color: var(--ink);
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 6px;
    margin-bottom: 2px;
  }

  .blind-table td {
    display: block;
    padding: 0;
    border-bottom: 0;
  }

  .blind-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 3px;
  }

  .blind-table input,
  .blind-table select {
    min-height: 32px;
    padding: 5px 7px;
    font-size: 13px;
  }

  .blind-actions {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .blind-actions::before {
    grid-column: 1 / -1;
    margin: 0;
  }

  .icon-action {
    min-width: 0;
    width: 100%;
    height: 32px;
  }

  .asset-preview-row figure,
  .asset-preview-row img {
    width: 100%;
  }

  .asset-preview-row img {
    height: 140px;
  }

  .password-field {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .tournament-card-grid,
  .blind-table tbody {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .projection-stage {
    overflow: auto;
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
  }

  .projection-top,
  .projection-left,
  .projection-center,
  .projection-right,
  .projection-bottom {
    grid-column: 1;
  }

  .projection-top {
    grid-template-columns: 1fr;
    min-height: 150px;
    text-align: center;
  }

  .projection-top time {
    text-align: center;
  }

  .projection-left,
  .projection-right {
    border: 0;
    grid-template-columns: repeat(3, 1fr);
    padding: 18px;
  }

  .projection-right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
  }

  .projection-right strong {
    font-size: 24px;
  }

  .projection-divider,
  .projection-left small {
    display: none;
  }

  .projection-info {
    grid-template-columns: 1fr;
  }
}
