/* Foundation */
:root {
  color-scheme: light;
  font-family: var(--ui-font, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif);
  color: var(--ui-ink, #173b32);
  background: var(--ui-bg, #f5f7f3);
  --admin-shadow: 0 18px 50px rgba(23, 59, 50, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ui-bg, #f5f7f3);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ui-ink, #173b32);
  background:
    radial-gradient(circle at 88% 4%, rgba(40, 104, 79, 0.08), transparent 28rem),
    var(--ui-bg, #f5f7f3);
  font: 14px/1.65 var(--ui-font, sans-serif);
  -webkit-font-smoothing: antialiased;
}

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

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ui-accent, #28684f) 35%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  object-fit: contain;
}

/* Header and page navigation */
.admin-header,
main,
footer,
.gate {
  width: min(1160px, calc(100% - 48px));
  margin-inline: auto;
}

.admin-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--ui-line, #d7e1d7);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font: 600 21px/1.15 var(--ui-serif, serif);
  letter-spacing: 0.04em;
}

.brand > img {
  border-radius: 12px;
  box-shadow: 0 5px 14px rgba(23, 59, 50, 0.1);
}

.brand small {
  display: block;
  margin-top: 5px;
  color: var(--ui-muted, #5f7168);
  font: 500 12px/1.2 var(--ui-font, sans-serif);
  letter-spacing: 0.02em;
}

.quiet-link,
.quiet-button,
.primary,
.secondary,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border-radius: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.quiet-link {
  min-height: 44px;
  padding: 0 12px;
  color: var(--ui-muted, #5f7168);
  font-size: 13px;
}

.quiet-link:hover,
.quiet-button:hover {
  color: var(--ui-accent, #28684f);
  background: var(--ui-surface-soft, #eaf0e8);
}

.primary,
.secondary {
  min-width: 112px;
  padding: 0 18px;
  border: 1px solid transparent;
  font-size: 14px;
}

.primary {
  color: #fff;
  background: var(--ui-accent, #28684f);
  border-color: var(--ui-accent, #28684f);
  box-shadow: 0 8px 20px rgba(40, 104, 79, 0.16);
}

.primary:hover {
  background: var(--ui-ink, #173b32);
  border-color: var(--ui-ink, #173b32);
}

.primary .ui-icon {
  filter: brightness(0) invert(1);
}

.secondary {
  color: var(--ui-ink, #173b32);
  background: var(--ui-surface, #fff);
  border-color: var(--ui-line, #d7e1d7);
}

.secondary:hover {
  border-color: var(--ui-accent, #28684f);
  color: var(--ui-accent, #28684f);
}

.quiet-button {
  min-height: 44px;
  padding: 0 12px;
  color: var(--ui-muted, #5f7168);
  background: transparent;
  border: 0;
  font-size: 13px;
}

.icon-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--ui-line, #d7e1d7);
  color: var(--ui-ink, #173b32);
  background: var(--ui-surface, #fff);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 0 26px;
}

h1,
h2 {
  margin: 0;
  color: var(--ui-ink, #173b32);
  font-family: var(--ui-serif, serif);
  font-weight: 650;
}

h1 {
  font-size: clamp(34px, 4vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 20px;
  line-height: 1.3;
}

p {
  margin-block: 0;
}

.page-heading h1 {
  margin: 5px 0 8px;
}

.page-heading > div > p:last-child {
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
}

.section-kicker {
  margin: 0 0 3px;
  color: var(--ui-accent, #28684f);
  font-size: 12px;
  font-weight: 700;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 28px;
  padding: 6px;
  border: 1px solid var(--ui-line, #d7e1d7);
  border-radius: 16px;
  background: var(--ui-surface-soft, #eaf0e8);
}

.admin-tabs button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  color: var(--ui-muted, #5f7168);
  background: transparent;
  font-size: 14px;
  font-weight: 650;
}

.admin-tabs button[aria-selected="true"] {
  color: var(--ui-ink, #173b32);
  background: var(--ui-surface, #fff);
  box-shadow: 0 4px 14px rgba(23, 59, 50, 0.08);
}

/* Panels and overview */
.panel {
  min-height: 420px;
}

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

.section-heading .muted,
.section-heading div > .muted {
  margin-top: 6px;
}

.muted,
.note {
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
}

.note {
  line-height: 1.75;
}

.info-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 880px;
}

.info-note .ui-icon {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.card,
.metric,
.broadcast-item {
  border: 1px solid var(--ui-line, #d7e1d7);
  background: var(--ui-surface, #fff);
}

.card {
  border-radius: 20px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  min-height: 166px;
  padding: 20px;
  border-radius: 18px;
}

.metric-featured {
  background: linear-gradient(145deg, var(--ui-surface-soft, #eaf0e8), var(--ui-surface, #fff));
  border-color: color-mix(in srgb, var(--ui-accent, #28684f) 28%, var(--ui-line, #d7e1d7));
}

.metric > span {
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
  font-weight: 650;
}

.metric strong {
  display: block;
  margin: 10px 0 8px;
  color: var(--ui-ink, #173b32);
  font: 700 38px/1.15 var(--ui-serif, serif);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.metric small {
  display: block;
  color: var(--ui-muted, #5f7168);
  font-size: 11px;
  line-height: 1.55;
}

.game-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 24px;
}

.game-metrics > span {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--ui-line, #d7e1d7);
  border-radius: 16px;
  color: var(--ui-muted, #5f7168);
  background: var(--ui-surface-soft, #eaf0e8);
  font-size: 12px;
}

.game-metrics strong {
  color: var(--ui-accent, #28684f);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.trend-card {
  padding: 22px;
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
  white-space: nowrap;
}

.chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ui-accent, #28684f);
}

.chart-legend i:nth-of-type(2) {
  margin-left: 9px;
  background: var(--ui-gold, #a07835);
}

.trend-chart {
  min-height: 230px;
  margin: 4px 0 2px;
  overflow: hidden;
}

.trend-chart svg {
  width: 100%;
  max-height: 250px;
  display: block;
}

.trend-chart text {
  fill: var(--ui-muted, #5f7168);
  font: 12px var(--ui-font, sans-serif);
}

.trend-card details {
  margin-top: 10px;
  border-top: 1px solid var(--ui-line, #d7e1d7);
}

.trend-card summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  color: var(--ui-accent, #28684f);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.panel > .info-note {
  margin-top: 16px;
}

/* Tables, search, and forms */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--ui-line, #d7e1d7);
}

th {
  color: var(--ui-muted, #5f7168);
  background: var(--ui-surface-soft, #eaf0e8);
  font-size: 12px;
  font-weight: 650;
}

td strong {
  display: block;
  font-weight: 650;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--ui-muted, #5f7168);
  font-size: 11px;
}

.user-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.user-status.is-ready {
  color: var(--ui-accent, #28684f);
  background: var(--ui-surface-soft, #eaf0e8);
}

.user-status.is-muted {
  color: var(--ui-muted, #5f7168);
  background: color-mix(in srgb, var(--ui-line, #d7e1d7) 55%, white);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.user-table {
  overflow: hidden auto;
}

.search-row {
  max-width: 620px;
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-field .ui-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.62;
  pointer-events: none;
}

.search-field input {
  padding-left: 44px;
}

.group-directory { background: #1c1e1d; color: #f2f5f3; border-radius: 24px; padding: 24px; color-scheme: dark; }
.group-directory-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.group-directory-heading h2 { color: #f2f5f3; font-size: 23px; margin: 4px 0; }
.group-directory .section-kicker { color: #5fbba2; }
.group-directory-heading p { margin: 0; color: #9ea9a3; }
.group-refresh { display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 16px; background: #123e31; flex-shrink: 0; }
.group-refresh .ui-icon, .group-search .ui-icon { filter: brightness(0) invert(1); opacity: .7; }
.group-search { display: flex; align-items: center; gap: 12px; background: #121413; padding: 0 16px; border-radius: 16px; margin-bottom: 20px; }
.group-search input { border: 0; background: transparent; color: #f2f5f3; padding: 16px 0; min-width: 0; box-shadow: none; }
.group-search input::placeholder { color: #87918b; }
.group-directory-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.group-directory-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; border-radius: 20px; background: #0e100f; }
.group-entry-details { display: grid; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.group-entry-details strong { color: #f2f5f3; font-size: 17px; line-height: 1.45; }
.group-entry-details small { color: #9da59f; font-size: 12px; }
.group-enter { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-width: 74px; min-height: 44px; padding: 10px 14px; border: 0; border-radius: 13px; color: #72d6b9; background: #103d30; font-weight: 700; text-decoration: none; }
.group-enter:disabled { color: #8c9791; background: #242b27; opacity: .7; }
.group-directory-note, .group-directory-empty { color: #9da59f; font-size: 12px; }
.group-directory .pagination { color: #aab5ae; gap: 10px; }
.group-directory .pagination button { background: #262e29; color: #d5e2da; border-color: #38453d; }
@media (max-width: 600px) { .group-directory { padding: 16px; } .group-directory-card { padding: 16px; gap: 12px; } .group-entry-details strong { font-size: 16px; } }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--ui-line, #d7e1d7);
  border-radius: 12px;
  outline: 0;
  color: var(--ui-ink, #173b32);
  background: var(--ui-surface, #fff);
  font-size: 14px;
}

input:hover,
textarea:hover,
select:hover {
  border-color: color-mix(in srgb, var(--ui-accent, #28684f) 45%, var(--ui-line, #d7e1d7));
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--ui-accent, #28684f);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent, #28684f) 12%, transparent);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--ui-muted, #5f7168) 72%, white);
}

textarea {
  min-height: 108px;
  resize: vertical;
  line-height: 1.65;
}

select {
  appearance: auto;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(300px, 0.82fr);
  gap: 24px;
  align-items: start;
}

.form-card {
  padding: 22px;
}

.form-card > label,
.form-pair label {
  display: block;
  margin: 17px 0 7px;
  font-size: 14px;
  font-weight: 650;
}

.form-card > label:first-of-type {
  margin-top: 0;
}

.form-card label > span:not(.ui-icon) {
  margin-left: 5px;
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
  font-weight: 500;
}

.form-card .switch-row {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--ui-surface-soft, #eaf0e8);
}

.switch-row input {
  width: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  accent-color: var(--ui-accent, #28684f);
}

.form-pair {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: 14px;
}

.form-pair > div {
  min-width: 0;
}

.form-card .note {
  margin: 12px 0;
}

/* 单独暂停某个玩法：一排开关，不占整块表单的纵向空间。 */
.paused-games {
  margin: 16px 0 4px;
  padding: 0;
  border: 0;
}

.paused-games legend {
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 650;
}

.paused-games legend span {
  margin-left: 5px;
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
  font-weight: 500;
}

.paused-games-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.paused-game-row {
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  font-size: 13px;
}

/* 群内对局：棋盘刷新方式两选一，用整行开关的样式。 */
.groups-mode-row {
  margin-bottom: 8px;
  font-size: 13px;
}

.groups-mode-row em {
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.groups-chat-row {
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  font-size: 13px;
}

.form-card .primary {
  width: 100%;
  margin-top: 6px;
}

.inline-status {
  min-height: 20px;
  margin-top: 8px;
  color: var(--ui-accent, #28684f);
  font-size: 12px;
  font-weight: 650;
}

/* Live previews and broadcast history */
.preview-column {
  position: sticky;
  top: 18px;
}

.preview-column > .section-kicker {
  margin: 0 0 9px 4px;
}

.presence-layout .form-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.presence-preview {
  padding: 24px;
}

.presence-preview > span,
.presence-public-preview span {
  display: block;
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
  font-weight: 650;
}

.presence-preview > strong {
  display: block;
  margin: 5px 0 2px;
  font: 700 38px/1.15 var(--ui-serif, serif);
  font-variant-numeric: tabular-nums;
}

.presence-preview > small {
  color: var(--ui-muted, #5f7168);
}

.presence-public-preview {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0 12px;
  padding: 16px;
  border-radius: 14px;
  background: var(--ui-surface-soft, #eaf0e8);
}

.presence-public-preview strong {
  color: var(--ui-accent, #28684f);
  font: 700 28px/1 var(--ui-serif, serif);
  font-variant-numeric: tabular-nums;
}

.preview-frame,
.message-preview {
  border: 1px solid var(--ui-line, #d7e1d7);
  border-radius: 20px;
  background: var(--ui-surface-soft, #eaf0e8);
  box-shadow: var(--admin-shadow);
}

.preview-frame {
  padding: 16px;
}

.preview-start {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  border-radius: 12px;
  color: #fff;
  background: var(--ui-accent, #28684f);
  font-weight: 700;
}

.preview-start .ui-icon {
  filter: brightness(0) invert(1);
}

.ad-card {
  display: block;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ui-gold, #a07835) 30%, var(--ui-line, #d7e1d7));
  border-radius: 14px;
  background: var(--ui-surface, #fff);
}

.ad-card:hover {
  border-color: var(--ui-gold, #a07835);
}

.ad-card > img {
  width: 100%;
  max-height: 180px;
  display: block;
  object-fit: cover;
}

.ad-card > div {
  padding: 17px;
}

.ad-badge {
  display: block;
  color: var(--ui-gold, #a07835);
  font-size: 11px;
  font-weight: 700;
}

.ad-card strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font: 650 19px/1.35 var(--ui-serif, serif);
}

.ad-card p {
  margin: 7px 0 12px;
  overflow-wrap: anywhere;
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
}

.ad-cta {
  color: var(--ui-accent, #28684f);
  font-size: 12px;
  font-weight: 700;
}

.ad-cta:not(:empty)::after {
  width: 14px;
  height: 14px;
  display: inline-block;
  margin-left: 5px;
  vertical-align: -2px;
  background: currentColor;
  content: "";
  -webkit-mask: url("/static/assets/icons/arrow-up-right.svg") center / contain no-repeat;
  mask: url("/static/assets/icons/arrow-up-right.svg") center / contain no-repeat;
}

.message-preview {
  padding: 18px;
  background: #eef4f0;
}

.message-author {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}

.message-author > img {
  border-radius: 9px;
}

.message-author strong {
  font-weight: 700;
}

.message-author span {
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--ui-muted, #5f7168);
  background: var(--ui-surface, #fff);
  font-size: 11px;
}

.message-preview > p {
  min-height: 72px;
  margin: 15px 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 14px;
}

.message-preview > small {
  display: block;
  margin-top: 14px;
  color: var(--ui-muted, #5f7168);
  font-size: 11px;
}

.message-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  overflow-wrap: anywhere;
  border: 1px solid var(--ui-line, #d7e1d7);
  border-radius: 10px;
  color: var(--ui-accent, #28684f);
  background: var(--ui-surface, #fff);
  font-size: 13px;
  font-weight: 700;
}

.history-heading {
  margin-top: 32px;
}

.broadcast-list {
  display: grid;
  gap: 12px;
}

.broadcast-item {
  padding: 18px;
  border-radius: 16px;
}

.broadcast-item header,
.broadcast-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.broadcast-item header strong {
  font-size: 14px;
}

.broadcast-item > p {
  max-height: 124px;
  margin: 12px 0;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--ui-muted, #5f7168);
  font-size: 13px;
}

.broadcast-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.broadcast-meta span {
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--ui-muted, #5f7168);
  background: var(--ui-surface-soft, #eaf0e8);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.broadcast-footer {
  color: var(--ui-muted, #5f7168);
  font-size: 11px;
}

.broadcast-footer .secondary {
  min-height: 44px;
}

.status-badge {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--ui-accent, #28684f);
  background: var(--ui-surface-soft, #eaf0e8);
  font-size: 11px;
  font-weight: 700;
}

.status-badge.status-canceled,
.status-badge.status-failed {
  color: var(--ui-danger, #a54736);
  background: color-mix(in srgb, var(--ui-danger, #a54736) 10%, white);
}

.danger-action {
  color: var(--ui-danger, #a54736);
}

progress {
  width: 100%;
  height: 7px;
  margin: 2px 0 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  accent-color: var(--ui-accent, #28684f);
  background: var(--ui-surface-soft, #eaf0e8);
}

progress::-webkit-progress-bar {
  background: var(--ui-surface-soft, #eaf0e8);
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--ui-accent, #28684f);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--ui-accent, #28684f);
}

.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--ui-muted, #5f7168);
  font-size: 13px;
}

/* Access gate, footer, dialogs, and feedback */
.gate {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
  padding: 48px 0 72px;
}

.gate-card {
  width: min(480px, 100%);
  padding: 38px;
  text-align: center;
  border: 1px solid var(--ui-line, #d7e1d7);
  border-radius: 24px;
  background: var(--ui-surface, #fff);
  box-shadow: var(--admin-shadow);
}

.gate-icon {
  width: 56px;
  height: 56px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 18px;
  background: var(--ui-surface-soft, #eaf0e8);
}

.gate-icon .ui-icon {
  width: 26px;
  height: 26px;
}

.gate-card h1 {
  margin: 4px 0 12px;
}

.gate-card > p:not(.section-kicker) {
  color: var(--ui-muted, #5f7168);
}

.gate-card .primary {
  margin-top: 22px;
}

footer {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  border-top: 1px solid var(--ui-line, #d7e1d7);
  color: var(--ui-muted, #5f7168);
  font-size: 12px;
}

footer span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

footer .ui-icon {
  width: 15px;
  height: 15px;
}

dialog {
  width: min(500px, calc(100% - 32px));
  max-height: 90svh;
  padding: 24px;
  overflow: auto;
  color: var(--ui-ink, #173b32);
  border: 1px solid var(--ui-line, #d7e1d7);
  border-radius: 24px;
  background: var(--ui-surface, #fff);
  box-shadow: 0 28px 80px rgba(23, 59, 50, 0.22);
}

dialog::backdrop {
  background: rgba(23, 59, 50, 0.38);
  backdrop-filter: blur(4px);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading h2 {
  font-size: 22px;
}

.confirm-copy {
  max-height: 260px;
  margin: 14px 0;
  padding: 16px;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  border: 1px solid var(--ui-line, #d7e1d7);
  border-radius: 12px;
  background: var(--ui-surface-soft, #eaf0e8);
  font-size: 14px;
  line-height: 1.65;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

#admin-toast {
  position: fixed;
  z-index: 99;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  transform: translateX(-50%);
  border-radius: 12px;
  color: #fff;
  background: var(--ui-ink, #173b32);
  box-shadow: 0 14px 36px rgba(23, 59, 50, 0.24);
  font-size: 13px;
}

/* Responsive layouts */
@media (max-width: 820px) {
  .admin-header,
  main,
  footer,
  .gate {
    width: min(100% - 32px, 680px);
  }

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

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .preview-column {
    position: static;
  }
}

@media (max-width: 560px) {
  .admin-header,
  main,
  footer,
  .gate {
    width: calc(100% - 24px);
  }

  .admin-header {
    min-height: 68px;
  }

  .brand {
    gap: 9px;
    font-size: 18px;
  }

  .brand > img {
    width: 36px;
    height: 36px;
  }

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

  .quiet-link {
    padding-inline: 8px;
    font-size: 12px;
  }

  .quiet-link .ui-icon {
    width: 16px;
    height: 16px;
  }

  .page-heading {
    align-items: flex-start;
    padding: 18px 0 14px;
  }

  .page-heading h1 {
    font-size: 34px;
    margin-top: 0;
  }

  .page-heading #refresh-admin {
    min-width: 48px;
    width: 48px;
    padding: 0;
    font-size: 0;
  }

  .page-heading #refresh-admin .ui-icon {
    width: 19px;
    height: 19px;
  }

  .admin-tabs {
    gap: 3px;
    margin-bottom: 18px;
    padding: 4px;
    border-radius: 14px;
  }

  .admin-tabs button {
    min-width: 0;
    min-height: 54px;
    flex-direction: column;
    gap: 3px;
    padding: 5px 2px;
    font-size: 11px;
  }

  .admin-tabs .ui-icon {
    width: 17px;
    height: 17px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .metrics {
    gap: 9px;
  }

  .metric {
    min-height: 150px;
    padding: 16px 14px;
  }

  .metric strong {
    font-size: 33px;
  }

  .game-metrics {
    gap: 7px;
  }

  .game-metrics > span {
    min-height: 92px;
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 2px;
    padding: 12px;
  }

  .game-metrics .ui-icon {
    width: 16px;
    height: 16px;
    margin-bottom: 2px;
  }

  .game-metrics strong {
    font-size: 20px;
  }

  .trend-card,
  .form-card {
    padding: 16px;
  }

  .trend-card .section-heading {
    align-items: flex-end;
  }

  .trend-card h2 {
    font-size: 18px;
  }

  .trend-chart {
    min-height: 210px;
    margin-inline: -8px;
  }

  .chart-legend {
    font-size: 11px;
  }

  .search-row {
    gap: 8px;
  }

  .search-row .secondary {
    min-width: 72px;
    padding-inline: 12px;
  }

  .form-pair {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .preview-frame,
  .message-preview {
    border-radius: 16px;
  }

  .broadcast-item {
    padding: 15px;
  }

  .broadcast-footer {
    align-items: flex-start;
  }

  .gate {
    min-height: calc(100vh - 120px);
    padding: 32px 0 56px;
  }

  .gate-card {
    padding: 28px 20px;
  }

  .gate-card h1 {
    font-size: 34px;
  }

  footer {
    min-height: 96px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    margin-top: 36px;
  }

  dialog {
    width: calc(100% - 20px);
    padding: 20px;
    border-radius: 20px;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
  }

  .dialog-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
