:root {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  color: #18242b;
  background: #eef3f4;
  --ink: #18242b;
  --paper: #f6f8f8;
  --surface: #ffffff;
  --rail: #16313d;
  --rail-deep: #071922;
  --signal-blue: #0a80b7;
  --signal-cyan: #5fd6cc;
  --signal-red: #d84a3a;
  --signal-yellow: #ffd966;
  --line: #d8e2e4;
  --muted: #62717a;
  --shadow: 0 18px 46px rgba(20, 41, 49, .1);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(10, 128, 183, .08) 0 1px, transparent 1px 100%),
    var(--paper);
  background-size: 28px 28px;
}
a { color: inherit; text-decoration: none; }
h1, h2, p { margin-top: 0; }
h1, h2, strong { letter-spacing: 0; }
h1 { font-size: clamp(30px, 4vw, 48px); line-height: 1.08; }
h2 { margin-bottom: 12px; font-size: 20px; }
.muted { color: var(--muted); }

:focus-visible {
  outline: 3px solid rgba(10, 128, 183, .38);
  outline-offset: 3px;
}

.site-footer {
  padding: 18px 24px 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.auth-page .site-footer {
  position: static;
  align-self: end;
}
.screen-footer {
  position: relative;
  z-index: 1;
  color: rgba(70, 89, 98, .72);
  flex: 0 0 auto;
  padding: 2px 24px 8px;
  font-size: clamp(11px, 1vw, 13px);
  line-height: 1.35;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--rail);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.button:hover {
  background: #0e2631;
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(14, 38, 49, .16);
}
.button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--rail);
}
.button.danger { background: var(--signal-red); }
.button:disabled {
  opacity: .58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  padding: 24px 24px 0;
  background:
    linear-gradient(135deg, rgba(10, 128, 183, .14), transparent 36%),
    linear-gradient(315deg, rgba(216, 74, 58, .1), transparent 34%),
    var(--paper);
}
.auth-box {
  container-type: inline-size;
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid rgba(22, 49, 61, .12);
  border-top: 5px solid var(--signal-blue);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}
.register-box {
  width: min(560px, 100%);
  margin: 20px 0 12px;
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}
.auth-title {
  max-width: 100%;
  margin-bottom: 0;
  font-size: clamp(19px, 6.2cqw, 30px);
  line-height: 1.18;
  text-align: center;
  white-space: nowrap;
}
.auth-brand + .muted { text-align: center; }
.register-page .auth-brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
}
.register-page .auth-logo {
  width: 44px;
  height: 44px;
}
.register-page .auth-title {
  width: 100%;
  max-width: 100%;
  font-size: 28px;
  line-height: 1.22;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.register-activity-image {
  width: 100%;
  aspect-ratio: 16 / 7;
  margin: 14px 0 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  overflow: hidden;
}
.register-activity-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  background: transparent;
}

.form-stack { display: grid; gap: 16px; }
.field {
  display: grid;
  gap: 8px;
  color: #223039;
  font-size: 14px;
  font-weight: 800;
}
.field input,
.field select,
.field textarea,
.draw-form input,
.round-picker select {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.field input,
.field select,
.draw-form input,
.round-picker select { height: 44px; }
.field textarea {
  min-height: 112px;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}
.field input[type="file"] {
  height: auto;
  padding: 11px;
}
.field select { appearance: auto; }
.alert {
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid #b9e6dc;
  border-radius: 6px;
  background: #e6f7f3;
  color: #075d53;
}
.alert.error {
  border-color: #f0b6aa;
  background: #fff0eb;
  color: #9b2d13;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--rail);
  font-size: 18px;
}
.brand-logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  object-fit: contain;
}
.auth-logo {
  width: 48px;
  height: 48px;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.container {
  width: min(1180px, calc(100% - 32px));
  margin: auto;
  padding: 30px 0 50px;
}
.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.page-head p { margin-bottom: 0; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(20, 41, 49, .05);
}
.stat {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  padding: 18px 20px;
  border-top: 4px solid var(--signal-blue);
}
.stat:nth-child(2) { border-top-color: var(--signal-cyan); }
.stat:nth-child(3) { border-top-color: var(--signal-red); }
.stat span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.stat strong {
  display: block;
  color: var(--rail);
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid > .backup-import-panel { grid-column: 1 / -1; }
.panel { padding: 20px; }
.panel p { line-height: 1.65; }
.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.module-card {
  position: relative;
  overflow: hidden;
  min-height: 252px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(10, 128, 183, .08), rgba(255, 255, 255, .72) 48%),
    #fff;
  box-shadow: 0 12px 32px rgba(20, 41, 49, .06);
}
.module-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 5px;
  background: var(--signal-blue);
}
.module-card-lottery::after { background: var(--signal-red); }
.module-card h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 36px);
}
.module-card p {
  margin: 0;
  max-width: 34em;
  color: var(--muted);
  line-height: 1.75;
}
.module-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}
.module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.module-meta span,
.fixed-fields span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6f8;
  color: #164b58;
  font-size: 12px;
  font-weight: 900;
}
.current-activity-card { margin-top: 16px; }
.home-create-panel { margin: 16px 0; }
.home-activity-list { margin-top: 16px; }
.activity-description-text,
.register-description {
  white-space: pre-wrap;
  tab-size: 4;
  overflow-wrap: anywhere;
}
.draw-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-title h2 { margin: 0; }
.section-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.activity-panel { margin-bottom: 16px; }
.activity-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 18px;
  align-items: start;
}
.activity-main {
  display: grid;
  gap: 16px;
}
.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}
.qr-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.qr-card img {
  width: 180px;
  height: 180px;
  border-radius: 6px;
}
.qr-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.qr-card small {
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  word-break: break-all;
}
.activity-image-preview {
  margin: -4px 0 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.activity-image-preview img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}
.activity-image-preview label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.activity-image-preview input {
  width: auto;
  height: auto;
}
.activity-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}
.compact-list { margin-top: 12px; }
.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.activity-row strong,
.activity-row small { display: block; }
.activity-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #0f5d6b;
  background: #e5f7fa;
  font-size: 13px;
  font-weight: 900;
}
.mini-pill {
  min-height: 24px;
  margin-left: 6px;
  padding: 0 8px;
  font-size: 12px;
}
.fixed-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}
.field-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 14px;
}
.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.participant-table { min-width: 920px; }
.activity-table { min-width: 980px; }
.participant-table tr.is-winner-row td {
  background: #f4fbff;
}
.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.activity-detail summary {
  color: var(--rail);
  font-weight: 900;
  cursor: pointer;
}
.activity-detail p {
  margin: 8px 0 6px;
  color: var(--muted);
}
.activity-detail small {
  display: block;
  max-width: 360px;
  color: var(--muted);
  word-break: break-all;
}
.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}
.winner-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(10, 128, 183, .22);
  border-radius: 999px;
  background: rgba(10, 128, 183, .08);
  color: #0a5f7f;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.winner-badge.is-empty {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--muted);
}
.inline-confirm summary.button {
  list-style: none;
  cursor: pointer;
}
.inline-confirm summary.button::-webkit-details-marker {
  display: none;
}
.inline-confirm-panel {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid #efc2b7;
  border-radius: 7px;
  background: #fff8f6;
}
.inline-confirm-panel span {
  color: #7f321f;
  font-size: 12px;
  font-weight: 800;
}
.register-description {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  line-height: 1.7;
}
.register-page .muted {
  line-height: 1.65;
}
.register-page .form-stack {
  gap: 14px;
}
.register-page .button[type="submit"] {
  width: 100%;
  min-height: 46px;
}
.round-list { display: grid; gap: 10px; }
.round-history { margin-top: 16px; }
.round-detail {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}
.round-detail header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.round-detail header strong,
.round-detail header span { display: block; }
.backend-winners {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 8px;
}
.backend-winners > span {
  min-height: 78px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--signal-blue);
  border-radius: 6px;
  background: #fff;
}
.backend-winner strong,
.backend-winner small { display: block; }
.backend-winner strong {
  margin-bottom: 5px;
  color: var(--rail);
  font-size: 16px;
}
.backend-winner small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.danger-zone {
  margin-top: 18px;
  border: 1px solid #efc2b7;
  border-radius: var(--radius);
  background: #fff8f6;
}
.danger-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
}
.danger-content p {
  margin: 5px 0 0;
  color: #7f321f;
  line-height: 1.65;
}
.confirm-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(11, 31, 51, .28);
}
.confirm-dialog::backdrop { background: rgba(7, 25, 34, .72); }
.dialog-panel { padding: 28px; text-align: center; }
.dialog-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fff0eb;
  color: var(--signal-red);
  font-size: 26px;
  font-weight: 950;
}
.dialog-panel h2 { margin-bottom: 10px; }
.dialog-panel p { color: var(--muted); line-height: 1.65; }
.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.screen-page {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: #edf3f4;
  color: var(--ink);
  --screen-valid: var(--signal-blue);
  --screen-eligible: var(--signal-cyan);
  --screen-winner: var(--signal-red);
  --screen-primary: var(--screen-valid);
  --screen-primary-soft: rgba(10, 128, 183, .1);
  --screen-primary-line: rgba(10, 128, 183, .22);
  --screen-control: var(--screen-eligible);
  --screen-control-soft: rgba(95, 214, 204, .16);
  --screen-warn: #b57d00;
  --screen-warn-soft: rgba(181, 125, 0, .12);
  --screen-danger: var(--screen-winner);
}
.screen-shell {
  position: relative;
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(120deg, transparent 0 42%, rgba(10, 128, 183, .055) 42% 43%, transparent 43% 100%),
    linear-gradient(120deg, transparent 0 56%, rgba(216, 74, 58, .04) 56% 57%, transparent 57% 100%),
    linear-gradient(90deg, rgba(10, 128, 183, .04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(10, 128, 183, .035) 1px, transparent 1px),
    #edf3f4;
  background-size: 560px 100%, 680px 100%, 64px 64px, 64px 64px, auto;
}
.screen-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 128, 183, .11), rgba(95, 214, 204, .08) 34%, transparent 58%);
  pointer-events: none;
}
.screen-shell::after {
  content: "";
  position: fixed;
  inset: auto 8px 0;
  z-index: -1;
  height: 34%;
  background:
    repeating-linear-gradient(90deg, rgba(22, 49, 61, .04) 0 1px, transparent 1px 46px),
    linear-gradient(180deg, transparent, rgba(255, 255, 255, .34));
  pointer-events: none;
}
@supports (height: 100dvh) {
  .screen-page,
  .screen-shell {
    height: 100dvh;
  }
}
.screen-header {
  flex: 0 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}
.screen-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.screen-brand > div { min-width: 0; }
.screen-logo {
  width: 36px;
  height: 36px;
}
.screen-header h1 {
  margin: 0;
  color: var(--rail);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
}
.screen-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(72vw, 760px);
  color: var(--muted);
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.screen-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--screen-primary);
  box-shadow: 0 0 18px rgba(10, 128, 183, .34);
}
.is-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}
.screen-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(340px, .7fr) minmax(540px, 1.3fr);
  align-items: stretch;
  gap: clamp(10px, 1.3vw, 16px);
  padding: clamp(10px, 1.8vh, 16px) 28px clamp(8px, 1.2vh, 12px);
}
.screen-column {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.3vw, 16px);
}
.screen-panel {
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: clamp(13px, 1.6vw, 18px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(20, 41, 49, .06);
}
.control-panel,
.rolling-panel,
.result-panel {
  display: flex;
  flex-direction: column;
}
.control-panel {
  flex: 0 0 auto;
}
.control-panel {
  background:
    linear-gradient(135deg, rgba(95, 214, 204, .045), transparent 36%),
    #fff;
}
.rolling-panel {
  flex: 1;
  background:
    linear-gradient(135deg, rgba(181, 125, 0, .05), transparent 38%),
    #fff;
}
.result-panel {
  background:
    linear-gradient(135deg, rgba(10, 128, 183, .045), transparent 38%),
    #fff;
}
.result-titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(10px, 1.6vh, 14px);
}
.result-titlebar .panel-label {
  flex: 0 0 auto;
  margin-bottom: 0;
}
.screen-activity-chip {
  min-width: 0;
  max-width: min(52%, 430px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
  color: var(--muted);
}
.screen-activity-chip span {
  flex: 0 0 auto;
  color: var(--screen-valid);
  font-size: clamp(12px, .95vw, 14px);
  font-weight: 950;
}
.screen-activity-chip strong {
  min-width: 0;
  overflow: hidden;
  color: var(--rail);
  font-size: clamp(14px, 1.22vw, 17px);
  line-height: 1.25;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.screen-panel::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: var(--screen-primary);
  opacity: .9;
}
.control-panel::after {
  background: linear-gradient(90deg, var(--screen-primary), var(--screen-control));
}
.result-panel::after {
  background: var(--screen-valid);
}
.rolling-panel::after {
  background: var(--screen-warn);
}
.panel-label {
  width: min(42%, 220px);
  min-width: 150px;
  margin: -1px 0 clamp(10px, 1.6vh, 14px);
  padding: 0 0 8px;
  border-bottom: 4px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: var(--screen-primary);
  font-size: clamp(17px, 1.7vw, 24px);
  line-height: 1.1;
  font-weight: 950;
}
.control-panel .panel-label {
  color: var(--screen-control);
}
.panel-label-roll {
  color: var(--screen-warn);
}
.panel-label-hot {
  color: var(--screen-valid);
}
.round-picker { margin-bottom: clamp(8px, 1.4vh, 12px); }
.round-picker label {
  display: grid;
  gap: 8px;
  color: var(--rail);
  font-size: 13px;
  font-weight: 950;
}
.round-picker select {
  height: 44px;
  border-color: rgba(10, 128, 183, .24);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}
.screen-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 1.1vw, 10px);
  margin-bottom: clamp(8px, 1.4vh, 12px);
}
.screen-stats > div {
  min-height: clamp(68px, 10.5vh, 86px);
  display: grid;
  align-content: space-between;
  padding: clamp(10px, 1.4vh, 13px) 14px;
  border: 1px solid rgba(22, 49, 61, .1);
  border-left: 5px solid var(--screen-primary);
  border-radius: 7px;
  background: #f8fbfb;
}
.screen-stats > div:nth-child(2) { border-left-color: var(--screen-control); }
.screen-stats span,
.result-card span {
  display: block;
  color: var(--muted);
}
.screen-stats strong {
  display: block;
  color: var(--screen-primary);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: clamp(26px, 3.6vw, 42px);
  line-height: 1;
}
.screen-stats > div:nth-child(2) strong { color: var(--screen-control); }
.draw-round-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}
.round-summary {
  min-height: clamp(38px, 5.8vh, 46px);
  display: flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid rgba(10, 128, 183, .48);
  border-radius: 6px;
  background: rgba(10, 128, 183, .08);
  color: var(--rail);
  font-size: clamp(13px, 1.15vw, 16px);
  font-weight: 800;
}
.screen-message {
  min-height: 22px;
  display: flex;
  align-items: center;
  padding: 2px 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(98, 113, 122, .86);
  font-size: clamp(11px, .95vw, 13px);
  font-weight: 800;
  line-height: 1.3;
}
.screen-message[data-state="success"] {
  color: rgba(15, 93, 107, .78);
}
.screen-message[data-state="error"] {
  color: rgba(155, 45, 19, .82);
}
.rolling-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  margin-top: 0;
  border: 1px solid rgba(10, 128, 183, .18);
  border-radius: var(--radius);
  background: #fbfdfd;
  overflow: hidden;
}
.rolling-stage::before {
  content: none;
}
.rolling-caption {
  display: none;
}
.rolling-name {
  max-width: 100%;
  padding: clamp(16px, 2.5vh, 24px);
  color: var(--rail);
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1;
  font-weight: 950;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: none;
}
.screen-shell.is-drawing .rolling-name,
.screen-shell.has-drawn .rolling-name {
  color: var(--screen-warn);
  font-size: clamp(44px, 6.6vw, 86px);
  text-shadow: 0 8px 26px rgba(181, 125, 0, .18);
}
.screen-shell.is-drawing .rolling-stage,
.screen-shell.has-drawn .rolling-stage {
  border-color: rgba(181, 125, 0, .4);
  box-shadow: inset 0 0 44px rgba(181, 125, 0, .08);
}
.result-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  margin-bottom: clamp(8px, 1.4vh, 12px);
}
.result-heading h2 {
  margin: 0 0 5px;
  color: var(--rail);
  font-size: clamp(20px, 2.2vw, 28px);
}
.result-heading span {
  color: var(--muted);
  font-size: 13px;
}
.result-heading > strong {
  color: var(--screen-valid);
  font-size: clamp(26px, 3.1vw, 38px);
  line-height: 1;
}
.result-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  align-content: start;
  gap: 10px;
  max-height: none;
  overflow: auto;
  padding-right: 4px;
}
.result-card {
  position: relative;
  min-height: clamp(84px, 11.5vh, 98px);
  display: block;
  padding: 14px 14px 38px;
  border: 1px solid rgba(22, 49, 61, .12);
  border-left: 5px solid var(--screen-valid);
  border-radius: 7px;
  background: #fbfdfd;
}
.result-card-body {
  min-width: 0;
  padding-right: 4px;
}
.result-card:nth-child(3n + 2),
.result-card:nth-child(3n) { border-left-color: var(--screen-valid); }
.result-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--rail);
  font-size: clamp(21px, 2vw, 28px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.result-card .button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: none;
}
.screen-page .button {
  background: var(--rail);
  color: #fff;
}
.screen-page .button:hover { background: #0e2631; }
.screen-page .button.secondary {
  border: 1px solid rgba(22, 49, 61, .14);
  background: #fff;
  color: var(--rail);
}
.screen-page .button.danger {
  background: var(--screen-danger);
  color: #fff;
}

@media (max-width: 980px) {
  .screen-main { grid-template-columns: 1fr; }
  .rolling-stage { min-height: 0; }
  .screen-header h1 { font-size: 18px; }
  .result-titlebar {
    flex-direction: column;
    gap: 8px;
  }
  .screen-activity-chip {
    max-width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .stats,
  .grid,
  .home-grid,
  .activity-layout,
  .compact-form { grid-template-columns: 1fr; }
  .page-head,
  .screen-header,
  .topbar,
  .danger-content {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .screen-main,
  .screen-header {
    padding-left: 16px;
    padding-right: 16px;
  }
  .draw-form,
  .draw-round-form,
  .dialog-actions { grid-template-columns: 1fr; }
  .round-detail header {
    align-items: flex-start;
    flex-direction: column;
  }
  .actions { width: 100%; }
  .actions .button,
  .actions form,
  .actions button { width: 100%; }
  .auth-page .site-footer { position: static; }
}

@media (max-width: 560px) {
  .container { width: min(100% - 24px, 1180px); }
  .panel,
  .auth-box,
  .screen-panel { padding: 16px; }
  .register-page {
    place-items: start center;
    padding: 12px 12px 0;
  }
  .register-box {
    width: 100%;
    margin: 10px 0 8px;
    padding: 18px;
  }
  .register-page .auth-brand {
    gap: 8px;
    margin-bottom: 12px;
  }
  .register-page .auth-logo {
    width: 38px;
    height: 38px;
  }
  .register-page .auth-title {
    font-size: 22px;
    line-height: 1.24;
  }
  .register-activity-image {
    aspect-ratio: 16 / 9;
    margin: 12px 0 14px;
    border-radius: 6px;
  }
  .register-description {
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.65;
  }
  .register-page .field {
    gap: 6px;
    font-size: 13px;
  }
  .register-page .field input,
  .register-page .field select {
    height: 42px;
  }
  .register-page .field textarea {
    min-height: 104px;
  }
  .register-page .site-footer {
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    font-size: 12px;
    line-height: 1.45;
  }
  .screen-stats,
  .result-grid { grid-template-columns: 1fr; }
  .rolling-name { font-size: clamp(30px, 12vw, 58px); }
  .screen-shell.is-drawing .rolling-name,
  .screen-shell.has-drawn .rolling-name { font-size: clamp(42px, 16vw, 82px); }
  .result-card { min-height: 92px; }
  .result-card strong { font-size: clamp(20px, 7vw, 26px); }
}

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