:root {
  --ink: #101820;
  --muted: #66717d;
  --line: #dfe4e8;
  --paper: #ffffff;
  --canvas: #f4f6f7;
  --red: #c61d32;
  --red-dark: #981427;
  --gold: #d5a735;
  --green: #168260;
  --shadow: 0 18px 50px rgba(16, 24, 32, 0.13);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.screen-page {
  min-height: 100vh;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(121, 7, 27, .96), rgba(31, 11, 22, .97)),
    repeating-linear-gradient(45deg, transparent 0 24px, rgba(255,255,255,.04) 24px 25px);
}

.screen-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 70% 20%, rgba(213, 167, 53, .24), transparent 32%);
}

.screen-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(24px, 4vw, 64px);
}

.screen-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.brand-mark { display: flex; align-items: center; gap: 14px; font-weight: 750; font-size: 18px; }
.brand-glyph { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.45); color: #ffe4a3; }
.status-pill { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.09); font-size: 14px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #f0c45d; box-shadow: 0 0 0 6px rgba(240,196,93,.14); }
.is-running .status-dot { background: #65dfb2; box-shadow: 0 0 0 6px rgba(101,223,178,.14); }

.screen-content { align-self: center; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 31vw); align-items: center; gap: clamp(48px, 7vw, 120px); max-width: 1500px; width: 100%; margin: 0 auto; }
.event-kicker { color: #f0c45d; font-size: clamp(14px, 1.2vw, 20px); font-weight: 700; letter-spacing: 0; margin-bottom: 18px; }
.screen-title { font-size: clamp(48px, 6.2vw, 106px); line-height: 1.04; letter-spacing: 0; margin: 0; max-width: 900px; }
.screen-subtitle { margin: 24px 0 46px; color: rgba(255,255,255,.74); font-size: clamp(18px, 1.8vw, 29px); }
.qr-panel { background: #fff; color: var(--ink); padding: clamp(18px, 2.2vw, 30px); box-shadow: var(--shadow); text-align: center; border-top: 5px solid var(--gold); }
.qr-panel img { display: block; width: 100%; aspect-ratio: 1; }
.qr-panel h2 { margin: 16px 0 6px; font-size: clamp(20px, 2vw, 30px); }
.qr-panel p { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.screen-footer { display: flex; justify-content: space-between; align-items: center; color: rgba(255,255,255,.55); font-size: 13px; }

.winner-banner { display: flex; align-items: center; gap: 20px; margin-top: 34px; padding: 22px 24px; max-width: 650px; border: 1px solid rgba(255,226,156,.5); background: rgba(255,226,156,.1); }
.winner-seal { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 auto; color: #1f0b16; background: #f2c863; font-weight: 900; font-size: 22px; }
.winner-banner small { display: block; color: #f2c863; margin-bottom: 5px; }
.winner-banner strong { font-size: 24px; }

.mobile-page { background: #f3f4f2; }
.mobile-shell { min-height: 100vh; max-width: 540px; margin: 0 auto; background: #fff; display: flex; flex-direction: column; box-shadow: 0 0 42px rgba(16,24,32,.08); }
.mobile-hero { min-height: 270px; padding: 36px 28px; color: #fff; background: linear-gradient(145deg, #a00f28, #3d111c); position: relative; overflow: hidden; }
.mobile-hero::after { content: "奖"; position: absolute; right: -18px; bottom: -72px; color: rgba(255,255,255,.065); font-size: 210px; font-weight: 900; }
.mobile-hero .eyebrow { color: #f2c863; font-size: 13px; font-weight: 700; }
.mobile-hero h1 { margin: 42px 0 10px; font-size: 36px; line-height: 1.15; position: relative; z-index: 1; }
.mobile-hero p { margin: 0; color: rgba(255,255,255,.72); position: relative; z-index: 1; }
.mobile-main { flex: 1; padding: 28px; }
.mobile-status { display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.mobile-status strong { color: var(--ink); }

.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 8px; color: #3f4952; font-size: 14px; font-weight: 650; }
.input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #cfd6dc; border-radius: 4px; outline: none; background: #fff; transition: border .15s, box-shadow .15s; }
.input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(198,29,50,.1); }
.primary-btn, .secondary-btn, .danger-btn { min-height: 46px; padding: 10px 18px; border: 0; border-radius: 4px; font-weight: 700; }
.primary-btn { color: #fff; background: var(--red); }
.primary-btn:hover { background: var(--red-dark); }
.primary-btn:disabled { background: #aab1b8; cursor: not-allowed; }
.secondary-btn { color: var(--ink); background: #e9edef; }
.danger-btn { color: #a31025; background: #fdecef; }
.full-btn { width: 100%; min-height: 52px; }
.form-note { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 16px 0 0; }
.message { min-height: 22px; margin-top: 13px; color: var(--red); font-size: 14px; text-align: center; }

.result-view { text-align: center; padding-top: 20px; }
.result-icon { width: 92px; height: 92px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 50%; color: #fff; background: var(--green); font-size: 38px; font-weight: 900; }
.result-view.won .result-icon { color: #4a2600; background: #f1c75e; box-shadow: 0 0 0 12px #fff7df; }
.result-view h2 { margin: 0 0 12px; font-size: 32px; }
.result-view p { color: var(--muted); }
.admin-page { background: var(--canvas); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #171d22; }
.login-panel { width: min(420px, 100%); background: #fff; padding: 34px; border-top: 5px solid var(--red); box-shadow: var(--shadow); }
.login-panel h1 { margin: 0 0 8px; font-size: 28px; }
.login-panel > p { color: var(--muted); margin: 0 0 28px; }

.admin-shell { min-height: 100vh; }
.admin-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 28px; color: #fff; background: #171d22; }
.admin-brand { font-weight: 800; }
.admin-header-actions { display: flex; align-items: center; gap: 10px; }
.admin-header a { color: #fff; text-decoration: none; font-size: 14px; }
.icon-btn { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.2); color: #fff; background: transparent; font-size: 18px; }
.admin-main { width: min(1380px, calc(100% - 40px)); margin: 24px auto 50px; }
.admin-topline { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.admin-topline h1 { margin: 0 0 6px; font-size: 26px; }
.admin-topline p { margin: 0; color: var(--muted); }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: #fff; margin-bottom: 20px; }
.metric { padding: 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 7px; font-size: 26px; font-variant-numeric: tabular-nums; }
.admin-grid { display: grid; grid-template-columns: 370px minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); }
.panel-header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 16px; }
.panel-body { padding: 18px; }
.setting-form .field { margin-bottom: 14px; }
.setting-form .input { min-height: 42px; }
.helper { margin-top: 6px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.table-wrap { overflow: auto; max-height: 610px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid #edf0f2; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #fafbfb; font-size: 12px; }
.tag { display: inline-block; padding: 4px 8px; border-radius: 3px; font-size: 12px; font-weight: 700; background: #edf0f2; }
.tag.running, .tag.win { color: #0d6b4d; background: #ddf5eb; }
.tag.paused { color: #875800; background: #fff1c9; }
.tag.ended { color: #8d1829; background: #fbe5e8; }
.empty-state { padding: 80px 20px; color: var(--muted); text-align: center; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 360px; padding: 13px 16px; color: #fff; background: #171d22; box-shadow: var(--shadow); z-index: 10; }
.toast.error { background: #a9142a; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(5,10,14,.64); }
.modal { width: min(430px, 100%); padding: 26px; background: #fff; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 10px; }
.modal p { color: var(--muted); line-height: 1.65; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@media (max-width: 900px) {
  .screen-content { grid-template-columns: 1fr 280px; gap: 36px; }
  .screen-title { font-size: 52px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .screen-page { overflow: auto; }
  .screen-shell { padding: 22px; }
  .screen-content { grid-template-columns: 1fr; padding: 42px 0; }
  .screen-title { font-size: 40px; }
  .qr-panel { max-width: 330px; width: 100%; margin: 0 auto; }
  .screen-footer { align-items: flex-start; gap: 12px; flex-direction: column; }
  .admin-header { padding: 0 16px; }
  .admin-main { width: min(100% - 24px, 1380px); }
  .admin-topline { flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric strong { font-size: 22px; }
}
