:root {
  --ink: #25221e;
  --muted: #857d71;
  --paper: #f6f1e9;
  --white: #fffdf9;
  --orange: #ef724c;
  --orange-dark: #d85832;
  --gold: #efbb58;
  --mint: #4eaa97;
  --line: rgba(48, 39, 27, 0.1);
  --shadow: 0 22px 70px rgba(67, 48, 26, 0.12);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--paper);
}

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

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(460px, 0.86fr) 1.14fr;
  background: #f7f2e9;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(45px, 8vw, 135px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 70px;
  font-family: "STSong", "Songti SC", serif;
  font-size: 17px;
}

.login-brand span,
.side-brand > span,
.admin-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-family: "STSong", "Songti SC", serif;
  background: var(--orange);
  box-shadow: 0 8px 22px rgba(239, 114, 76, 0.25);
  transform: rotate(-4deg);
}

.login-kicker {
  margin: 0 0 16px;
  color: var(--orange-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.login-panel h1 {
  margin: 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: clamp(40px, 4vw, 64px);
  line-height: 1.22;
  letter-spacing: -0.06em;
}

.login-copy {
  margin: 20px 0 35px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.login-panel form label {
  display: block;
  margin-bottom: 8px;
  color: #6e655a;
  font-size: 11px;
  font-weight: 700;
}

.login-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  max-width: 430px;
}

.login-input-row input {
  min-width: 0;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: rgba(255, 255, 255, 0.7);
}

.login-input-row input:focus {
  border-color: rgba(239, 114, 76, 0.48);
  box-shadow: 0 0 0 3px rgba(239, 114, 76, 0.08);
}

.login-input-row button,
.primary-action,
.ghost-action,
.dark-action {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.login-input-row button,
.primary-action {
  color: #fff;
  background: var(--orange);
  box-shadow: 0 8px 20px rgba(239, 114, 76, 0.18);
}

.ghost-action {
  border: 1px solid var(--line);
  background: #fff;
}

.dark-action {
  color: #fff;
  background: var(--ink);
}

.login-input-row button:hover,
.primary-action:hover,
.ghost-action:hover,
.dark-action:hover {
  transform: translateY(-1px);
}

.login-panel form small {
  display: block;
  margin-top: 10px;
  color: #a0988d;
  font-size: 9px;
}

.login-art {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 35% 22%, rgba(255, 237, 184, 0.24), transparent 20%),
    linear-gradient(145deg, #ee7953, #c84a2b);
}

.login-art::after {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 51% 49% 0 0 / 25% 25% 0 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.orb-one {
  top: 12%;
  left: 12%;
  width: 330px;
  height: 330px;
  box-shadow: 0 0 0 55px rgba(255, 255, 255, 0.045), 0 0 0 110px rgba(255, 255, 255, 0.03);
}

.orb-two {
  right: -100px;
  bottom: -80px;
  width: 370px;
  height: 370px;
  background: rgba(100, 28, 9, 0.1);
}

.art-card {
  position: absolute;
  z-index: 2;
  top: 25%;
  left: 15%;
  width: min(420px, 60%);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 28px;
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  box-shadow: 0 25px 80px rgba(87, 24, 8, 0.18);
  backdrop-filter: blur(16px);
}

.art-card span {
  font-size: 10px;
  opacity: 0.62;
}

.art-card strong {
  display: block;
  margin-top: 20px;
  font-family: "STSong", "Songti SC", serif;
  font-size: clamp(26px, 3vw, 43px);
  line-height: 1.35;
}

.art-card i {
  position: absolute;
  right: 25px;
  bottom: 13px;
  color: rgba(255, 238, 183, 0.8);
  font-size: 32px;
  font-style: normal;
}

.art-gift {
  position: absolute;
  z-index: 3;
  right: 15%;
  bottom: 16%;
  font-size: clamp(100px, 14vw, 190px);
  filter: drop-shadow(0 35px 35px rgba(64, 14, 2, 0.24));
  transform: rotate(-8deg);
}

.admin-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 235px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 26px 18px 20px;
  border-right: 1px solid var(--line);
  background: #fffaf3;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  color: var(--ink);
  text-decoration: none;
}

.side-brand div {
  display: flex;
  flex-direction: column;
}

.side-brand strong {
  font-family: "STSong", "Songti SC", serif;
  font-size: 14px;
}

.side-brand small {
  margin-top: 2px;
  color: #a49b8f;
  font-size: 7px;
  letter-spacing: 0.14em;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 43px;
  overflow-y: auto;
}

.side-nav button {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 0 13px;
  border: 0;
  border-radius: 12px;
  color: #746b5f;
  font-size: 11px;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.side-nav button span {
  width: 19px;
  text-align: center;
  font-size: 14px;
}

.side-nav button:hover {
  background: rgba(239, 114, 76, 0.05);
}

.side-nav button.active {
  color: var(--orange-dark);
  font-weight: 700;
  background: #fff0e8;
}

.side-footer {
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid var(--line);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #82796e;
  font-size: 9px;
}

.live-indicator i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(78, 170, 151, 0.1);
}

.side-footer button {
  margin-top: 13px;
  padding: 0;
  border: 0;
  color: #999085;
  font-size: 9px;
  background: transparent;
  cursor: pointer;
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  min-height: 112px;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(26px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 241, 233, 0.84);
  backdrop-filter: blur(16px);
}

.breadcrumb {
  color: #a0978a;
  font-size: 9px;
}

.breadcrumb b {
  color: #70675c;
  font-weight: 600;
}

.topbar h1 {
  margin: 8px 0 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.update-time {
  color: #9f978c;
  font-size: 9px;
}

.preview-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #635a4f;
  font-size: 10px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.6);
}

.admin-avatar {
  width: 33px;
  height: 33px;
  border-radius: 11px;
  font-size: 14px;
}

.page-content {
  max-width: 1420px;
  padding: 34px clamp(26px, 4vw, 58px) 70px;
}

.loading-state {
  display: grid;
  min-height: 55vh;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}

.section-enter {
  animation: section-enter 0.25s ease both;
}

@keyframes section-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.86);
  box-shadow: 0 8px 30px rgba(69, 50, 29, 0.045);
}

.metric-card {
  padding: 20px;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #887f73;
  font-size: 10px;
}

.metric-label span {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 9px;
  background: #fbf2e7;
}

.metric-value {
  margin-top: 14px;
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.metric-foot {
  margin-top: 8px;
  color: #a1988c;
  font-size: 8px;
}

.panel {
  padding: 22px;
}

.panel + .panel {
  margin-top: 18px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 19px;
}

.panel-title {
  margin: 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.panel-sub {
  margin: 5px 0 0;
  color: #9a9185;
  font-size: 9px;
  line-height: 1.55;
}

.live-draw-card {
  position: relative;
  min-height: 240px;
  padding: 28px;
  overflow: hidden;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 86% 0%, rgba(255, 219, 135, 0.25), transparent 30%),
    #2c2925;
}

.live-draw-card::after {
  content: "✦";
  position: absolute;
  right: 25px;
  bottom: -35px;
  color: rgba(255, 255, 255, 0.06);
  font-size: 170px;
}

.live-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #efd58f;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.live-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f5b74a;
  box-shadow: 0 0 0 4px rgba(245, 183, 74, 0.12);
}

.draw-big-number {
  margin-top: 20px;
  font-family: "DIN Alternate", sans-serif;
  font-size: 62px;
  font-weight: 700;
  line-height: 1;
  color: #ffe09b;
}

.draw-caption {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 9px;
}

.draw-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 28px;
}

.draw-meta {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.draw-meta strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 12px;
}

.draw-actions-admin {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.draw-actions-admin .primary-action {
  flex: 1;
  min-height: 40px;
  color: #3b2706;
  background: #ffe09b;
  box-shadow: none;
}

.draw-actions-admin .ghost-action {
  flex: 1;
  min-height: 40px;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.05);
}

.marquee-mini-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.marquee-mini {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf2;
}

.marquee-mini > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: #fff0d3;
}

.marquee-mini strong {
  font-size: 10px;
}

.marquee-mini small {
  color: #9b9286;
  font-size: 8px;
}

.marquee-mini em {
  color: var(--orange-dark);
  font-size: 8px;
  font-style: normal;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > label {
  color: #786f63;
  font-size: 9px;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  font-size: 11px;
  background: #fffdfa;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.65;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(239, 114, 76, 0.45);
  box-shadow: 0 0 0 3px rgba(239, 114, 76, 0.06);
}

.field-hint {
  color: #aaa196;
  font-size: 8px;
  line-height: 1.5;
}

.ad-field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.ad-field-row input {
  min-width: 0;
}

.ad-field-row .toggle {
  white-space: nowrap;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.page-intro h2 {
  margin: 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.page-intro p {
  max-width: 500px;
  margin: 7px 0 0;
  color: #8c8377;
  font-size: 10px;
  line-height: 1.6;
}

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

.prize-table th {
  padding: 0 10px 10px;
  color: #9e9589;
  font-size: 8px;
  font-weight: 500;
  text-align: left;
}

.prize-table td {
  padding: 10px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  vertical-align: middle;
}

.prize-table input {
  width: 100%;
  min-width: 55px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}

.prize-table input:hover,
.prize-table input:focus {
  border-color: var(--line);
  outline: none;
  background: #fff;
}

.prize-name-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 185px;
}

.prize-thumb {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  font-size: 20px;
  background: var(--soft-bg, #fff3df);
}

.small-actions {
  display: flex;
  gap: 5px;
}

.small-actions button,
.icon-mini {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #766d62;
  background: #fff;
  cursor: pointer;
}

.small-actions button.danger {
  color: #bd5338;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #746b60;
  font-size: 9px;
}

.toggle input {
  accent-color: var(--orange);
}

.marquee-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.marquee-editor-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr 100px 60px 86px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffaf3;
}

.drag-handle {
  color: #b3aa9f;
  font-size: 15px;
  text-align: center;
  cursor: default;
}

.marquee-editor-row input {
  width: 100%;
  height: 35px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.benefit-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
}

.rules-editor textarea {
  min-height: 225px;
}

.info-callout {
  display: flex;
  gap: 10px;
  padding: 13px;
  border-radius: 12px;
  color: #776e62;
  font-size: 9px;
  line-height: 1.65;
  background: #fff4dc;
}

.info-callout span {
  color: var(--orange-dark);
}

.redemption-status {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 8px;
  background: #fff0e8;
}

.redemption-status.paid {
  color: #2e8a77;
  background: #e9f8f4;
}

.redemption-status.failed {
  color: #ad4930;
  background: #fff0ea;
}

.empty-table {
  padding: 55px 20px;
  color: #9b9286;
  font-size: 10px;
  text-align: center;
}

.admin-toast {
  position: fixed;
  z-index: 200;
  top: 25px;
  left: 50%;
  max-width: 420px;
  padding: 11px 18px;
  border-radius: 12px;
  color: #fff;
  font-size: 10px;
  background: rgba(35, 32, 28, 0.92);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: 0.22s ease;
}

.admin-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal-layer {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(35, 31, 26, 0.45);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(4px);
  transition: 0.2s ease;
}

.modal-layer.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 25px;
  border-radius: 22px;
  background: #fffdfa;
  box-shadow: var(--shadow);
}

.modal h3 {
  margin: 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: 21px;
}

.modal p {
  margin: 7px 0 20px;
  color: #8f867b;
  font-size: 9px;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-grid,
  .benefit-layout {
    grid-template-columns: 1fr;
  }

  .marquee-editor-row {
    grid-template-columns: 28px 1fr 1fr;
  }

  .marquee-editor-row > *:nth-child(n + 4) {
    grid-column: auto;
  }
}

@media (max-width: 780px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-art {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    padding: 35px;
  }

  .login-brand {
    margin-bottom: 50px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 15px;
  }

  .side-nav {
    flex-direction: row;
    margin-top: 15px;
    overflow-x: auto;
  }

  .side-nav button {
    flex: 0 0 auto;
  }

  .side-footer {
    display: none;
  }

  .topbar {
    min-height: 90px;
    padding: 18px;
  }

  .update-time,
  .admin-avatar {
    display: none;
  }

  .page-content {
    padding: 20px 16px 50px;
  }

  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .full {
    grid-column: auto;
  }

  .prize-table {
    min-width: 650px;
  }

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