:root {
  --gold: #ffe8a3;
  --gold-strong: #ffd56f;
  --cream: #fffdf5;
  --muted-gold: #e8c6a2;
  --deep-red: #4d0611;
  --panel-red: rgba(86, 8, 17, 0.9);
  --row-a: rgba(154, 42, 47, 0.82);
  --row-b: rgba(140, 35, 42, 0.7);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #4d0611;
  color: var(--cream);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 210, 138, 0.16), rgba(183, 42, 42, 0.09) 38%, transparent 62%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 96px, rgba(0, 0, 0, 0.035) 96px 186px),
    linear-gradient(115deg, #9b2427 0%, #7f151f 43%, #4d0611 100%);
}

body::after {
  opacity: 0.18;
  background:
    radial-gradient(ellipse at 35% 92%, rgba(42, 5, 9, 0.7), transparent 42%),
    repeating-radial-gradient(ellipse at 28% 105%, transparent 0 17px, rgba(42, 5, 9, 0.65) 20px 27px, transparent 31px 44px);
}

.stage-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  width: 100vw;
  height: 100vh;
  min-width: 960px;
  min-height: 540px;
}

.screen {
  position: relative;
  padding: 1.7vh 1.4vw;
  background: rgba(70, 5, 13, 0.28);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.28);
}

.main-screen {
  border-inline: 6px solid rgba(37, 3, 8, 0.32);
}

.screen-border {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(247, 197, 90, 0.16);
  background: linear-gradient(135deg, rgba(139, 27, 36, 0.54), rgba(79, 7, 16, 0.72), rgba(42, 3, 8, 0.78));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.36);
}

.side-header {
  padding-top: min(6vh, 64px);
  text-align: center;
}

.side-header h1,
.main-header h1 {
  margin: 0;
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 0 14px rgba(247, 197, 90, 0.16);
}

.side-header h1 {
  font-size: clamp(28px, 2.1vw, 46px);
}

.round-subtitle {
  margin: 0.6vh 0 0;
  color: var(--muted-gold);
  font-size: clamp(14px, 1.1vw, 24px);
  font-weight: 700;
}

.history-list {
  display: grid;
  gap: min(2.2vh, 20px);
  width: min(72%, 560px);
  margin: min(7vh, 58px) auto 0;
}

.history-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  height: min(9.7vh, 88px);
  min-height: 58px;
  padding: 0 26px 0 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--row-a), rgba(95, 16, 24, 0.82));
}

.history-row:nth-child(even) {
  background: linear-gradient(135deg, var(--row-b), rgba(104, 20, 27, 0.72));
}

.history-label {
  color: #d6a884;
  font-size: clamp(14px, 1vw, 22px);
  font-weight: 800;
  white-space: nowrap;
}

.history-numbers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  row-gap: 0.15em;
  column-gap: 0.7em;
  justify-items: center;
  color: #fff7d7;
  font-size: clamp(16px, 1.28vw, 28px);
  font-weight: 900;
  line-height: 1.13;
  font-variant-numeric: tabular-nums;
}

.main-header {
  padding-top: min(5vh, 48px);
  text-align: center;
}

.main-header h1 {
  font-size: clamp(48px, 4.8vw, 86px);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: min(2.5vh, 22px) min(6vw, 96px);
  width: min(72%, 1100px);
  margin: min(5.2vh, 46px) auto 0;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(112px, 0.48fr) 1fr;
  align-items: center;
  height: min(7.9vh, 72px);
  min-height: 56px;
  padding: 0 28px;
  border-radius: 8px;
  border: 1px solid rgba(247, 197, 90, 0.13);
  background: linear-gradient(135deg, #9a2a2f, #681219);
}

.result-row:nth-child(even) {
  background: linear-gradient(135deg, #93272c, #68141b);
}

.rank {
  color: var(--gold-strong);
  font-size: clamp(22px, 1.95vw, 34px);
  font-weight: 900;
  white-space: nowrap;
}

.number {
  color: var(--cream);
  text-align: center;
  font-size: clamp(46px, 4.3vw, 70px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 0 6px rgba(255, 240, 189, 0.58),
    0 0 18px rgba(247, 197, 90, 0.22);
}

.number.is-rolling {
  animation: numberPulse 0.18s linear infinite;
}

.actions {
  position: absolute;
  left: 50%;
  bottom: min(5.5vh, 54px);
  display: flex;
  gap: min(5vw, 96px);
  transform: translateX(-50%);
}

.action-button {
  width: min(8.4vw, 170px);
  min-width: 112px;
  height: min(7vh, 64px);
  min-height: 48px;
  border: 2px solid #f7c55a;
  border-radius: 6px;
  background: linear-gradient(135deg, #7b1a20, #3e080d 52%, #8a4a16);
  color: #fff7d7;
  font-size: clamp(20px, 1.8vw, 32px);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(247, 197, 90, 0.32);
}

.action-button:active {
  transform: translateY(1px);
}

.stage-shell[data-view="main"] {
  display: block;
}

.stage-shell[data-view="main"] .side-screen {
  display: none;
}

.stage-shell[data-view="main"] .main-screen {
  width: 100vw;
  height: 100vh;
  border-inline: 0;
}

.stage-shell[data-view="side"] {
  display: block;
}

.stage-shell[data-view="side"] .main-screen,
.stage-shell[data-view="side"] .side-screen[data-screen="right"] {
  display: none;
}

.stage-shell[data-view="side"] .side-screen {
  width: 100vw;
  height: 100vh;
}

.stage-shell[data-view="side"] .history-list {
  width: min(72%, 760px);
}

@keyframes numberPulse {
  0% { opacity: 0.72; transform: translateY(-1px); }
  100% { opacity: 1; transform: translateY(1px); }
}

.admin-body {
  min-height: 100%;
  overflow: auto;
}

.admin-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.admin-header {
  margin-bottom: 24px;
  color: var(--gold);
}

.admin-header h1 {
  margin: 0;
  font-size: 36px;
}

.admin-header p {
  margin: 8px 0 0;
  color: var(--muted-gold);
  font-size: 16px;
}

.admin-panel {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid rgba(247, 197, 90, 0.18);
  border-radius: 10px;
  background: rgba(84, 8, 17, 0.78);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.25);
}

.admin-panel h2 {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 22px;
}

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

.source-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 18px;
  color: var(--cream);
  font-weight: 800;
}

.source-switch label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted-gold);
  font-weight: 700;
}

.admin-panel input,
.admin-panel textarea,
.admin-panel select {
  width: 100%;
  border: 1px solid rgba(247, 197, 90, 0.28);
  border-radius: 8px;
  background: rgba(42, 3, 8, 0.72);
  color: var(--cream);
  font: inherit;
  outline: none;
}

.admin-panel input,
.admin-panel select {
  height: 44px;
  padding: 0 12px;
}

.admin-panel input[type="file"] {
  height: auto;
  padding: 10px 12px;
}

.admin-panel textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

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

.full-field.no-margin {
  margin-top: 0;
}

.file-import {
  display: grid;
  grid-template-columns: minmax(260px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  margin-top: 16px;
}

.file-import p {
  margin: 0;
  color: rgba(255, 239, 190, 0.76);
  font-size: 14px;
  line-height: 1.7;
}

.plan-builder {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr auto;
  gap: 14px;
  align-items: end;
}

.plan-builder button,
.plan-item button {
  height: 44px;
  padding: 0 18px;
  border: 1px solid #f7c55a;
  border-radius: 8px;
  background: linear-gradient(135deg, #7b1a20, #8a4a16);
  color: var(--cream);
  font-weight: 800;
  cursor: pointer;
}

.plan-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.plan-empty,
.plan-item {
  margin: 0;
  border-radius: 8px;
  background: rgba(154, 42, 47, 0.42);
}

.plan-empty {
  padding: 14px 16px;
  color: rgba(255, 239, 190, 0.68);
}

.plan-item {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  color: var(--cream);
}

.plan-item strong,
.plan-item span {
  color: var(--muted-gold);
}

.plan-item b {
  color: var(--cream);
  font-size: 22px;
  letter-spacing: 0;
}

.plan-item button {
  height: 34px;
  padding: 0 12px;
  border-color: rgba(255, 155, 155, 0.72);
  background: rgba(90, 7, 16, 0.72);
}

.bulk-plan {
  margin-top: 16px;
  color: var(--muted-gold);
}

.bulk-plan summary {
  cursor: pointer;
  font-weight: 800;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.admin-actions button {
  height: 42px;
  padding: 0 18px;
  border: 1px solid #f7c55a;
  border-radius: 8px;
  background: linear-gradient(135deg, #7b1a20, #8a4a16);
  color: var(--cream);
  font-weight: 800;
  cursor: pointer;
}

.admin-actions button.danger {
  border-color: rgba(255, 155, 155, 0.75);
  background: linear-gradient(135deg, #7b1a20, #4f0710);
}

.admin-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--gold);
}

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

.status-grid div {
  padding: 14px;
  border-radius: 8px;
  background: rgba(154, 42, 47, 0.52);
}

.status-grid span {
  display: block;
  color: var(--muted-gold);
  font-size: 13px;
}

.status-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--cream);
  font-size: 22px;
}

.admin-table-wrap {
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--cream);
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(247, 197, 90, 0.12);
  text-align: left;
}

.admin-table th {
  color: var(--gold);
  white-space: nowrap;
}
