:root {
  --navy: #061633;
  --navy-2: #0a234e;
  --blue: #1e62d0;
  --cyan: #34b7eb;
  --gold: #f0b84b;
  --white: #f8fbff;
  --muted: #9db4d4;
}

* { box-sizing: border-box; }

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

body {
  background: #031026;
  color: var(--white);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
}

button { font: inherit; }

.draw-app {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(24px, 2.4vw, 46px) clamp(28px, 4vw, 76px) 24px;
  background:
    linear-gradient(rgba(35, 101, 190, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 101, 190, .07) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, #12386c 0%, #071b3b 39%, #031026 78%);
  background-size: 48px 48px, 48px 48px, auto;
}

.draw-app::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 12, 31, .14), rgba(2, 12, 31, .46)),
    url("esports-rail-background-v2.png") center / cover no-repeat;
  opacity: .72;
}

.draw-app::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(4, 18, 44, .16) 0%, rgba(3, 16, 38, .48) 72%, rgba(1, 8, 22, .72) 100%);
}

.ambient { position: absolute; pointer-events: none; border-radius: 50%; filter: blur(50px); opacity: .35; }
.ambient-one { width: 320px; height: 320px; background: #2268db; top: 10%; left: -180px; }
.ambient-two { width: 260px; height: 260px; background: #0b83c9; right: -150px; bottom: 8%; }

.hero {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1800px;
  margin: 0 auto 24px;
  padding-bottom: 23px;
  border-bottom: 1px solid rgba(114, 161, 220, .24);
}

.hero::after {
  content: "";
  position: absolute;
  left: 78px;
  bottom: -1px;
  width: min(360px, 35vw);
  height: 2px;
  background: linear-gradient(90deg, #efbd59, rgba(239, 189, 89, 0));
  box-shadow: 0 0 13px rgba(239, 189, 89, .45);
}

.event-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border: 1px solid rgba(255, 202, 94, .82);
  background: linear-gradient(145deg, #18345a, #07162f);
  box-shadow: inset 0 0 22px rgba(240, 184, 75, .12), 0 0 24px rgba(240, 184, 75, .12);
  transform: rotate(45deg);
}

.event-mark span { color: var(--gold); font-size: 25px; font-weight: 800; transform: rotate(-45deg); }
.title-wrap { flex: 1; }
.eyebrow { margin: 0 0 6px; color: #afc9eb; font-size: clamp(15px, 1.15vw, 21px); font-weight: 600; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(27px, 2.25vw, 45px); line-height: 1.15; letter-spacing: .04em; }

.fullscreen-button {
  color: #d5e5fa;
  background: rgba(18, 48, 89, .72);
  border: 1px solid rgba(109, 157, 216, .35);
  border-radius: 8px;
  padding: 12px 18px;
  cursor: pointer;
}
.fullscreen-button:hover { background: rgba(31, 75, 133, .8); }
.fullscreen-icon { margin-right: 6px; font-size: 18px; }

.status-bar {
  position: relative;
  z-index: 1;
  max-width: 1800px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 17px;
  border-radius: 7px;
  color: #cde2ff;
  background: rgba(10, 34, 72, .78);
  border: 1px solid rgba(96, 145, 205, .26);
  box-shadow: inset 3px 0 0 rgba(240, 184, 75, .78), 0 10px 24px rgba(0, 0, 0, .13);
  backdrop-filter: blur(10px);
}
.status-bar strong { font-size: 17px; }
.status-detail { margin-left: auto; color: var(--muted); font-size: 14px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #7593bc; box-shadow: 0 0 0 4px rgba(117, 147, 188, .12); }
.status-rolling .status-dot { background: var(--gold); box-shadow: 0 0 0 4px rgba(240, 184, 75, .15), 0 0 12px var(--gold); animation: pulse 1s infinite; }
.status-locked .status-dot { background: #4bd39b; box-shadow: 0 0 0 4px rgba(75, 211, 155, .14); }

.groups-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(12px, 1.2vw, 24px);
  max-width: 1800px;
  margin: 0 auto;
}

.group-card {
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(19, 51, 94, .9), rgba(6, 25, 56, .93));
  backdrop-filter: blur(9px);
  border: 1px solid rgba(89, 145, 218, .32);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .19);
}
.group-card::before { content: ""; display: block; height: 3px; background: linear-gradient(90deg, transparent, #3985e8 25%, #47c3e9 75%, transparent); }
.group-card:nth-child(2n)::before { background: linear-gradient(90deg, transparent, #2475d8 20%, #efbd59 76%, transparent); }
.group-card:hover { border-color: rgba(88, 164, 240, .56); box-shadow: 0 18px 46px rgba(0, 9, 27, .32), 0 0 22px rgba(44, 119, 214, .1); }
.group-heading { display: flex; align-items: center; gap: 13px; padding: 18px 18px 15px; border-bottom: 1px solid rgba(100, 151, 213, .2); }
.group-letter { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 7px; color: #fff; background: linear-gradient(145deg, #2876dd, #104796); font-size: 27px; font-weight: 800; box-shadow: 0 8px 20px rgba(14, 78, 170, .3); }
.group-heading h2 { margin: 0 0 2px; font-size: 23px; }
.group-heading p { margin: 0; color: #d1a954; font-size: 10px; font-weight: 700; letter-spacing: .18em; }

.team-list { display: grid; gap: 10px; margin: 0; padding: 16px; list-style: none; }
.team-list li { display: flex; align-items: center; min-height: 64px; padding: 10px 12px; border: 1px dashed rgba(103, 149, 205, .28); border-radius: 7px; background: rgba(4, 18, 42, .5); color: #647e9f; transition: border .2s, background .2s; }
.team-list li.has-team { color: #f7fbff; border-style: solid; border-color: rgba(85, 150, 231, .32); background: linear-gradient(90deg, rgba(22, 67, 125, .72), rgba(10, 39, 79, .72)); }
.team-number { display: grid; place-items: center; flex: 0 0 26px; width: 26px; height: 26px; margin-right: 10px; border-radius: 50%; color: #7295bf; background: rgba(50, 91, 142, .25); font-size: 12px; font-weight: 700; }
.has-team .team-number { color: #9fcbff; background: rgba(50, 126, 220, .28); }
.team-name { overflow-wrap: anywhere; font-size: clamp(14px, 1.04vw, 19px); font-weight: 700; line-height: 1.34; }
.is-rolling .team-name { animation: flicker .18s linear infinite alternate; }

.control-panel {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1800px;
  margin: 22px auto 0;
  padding: 18px 22px;
  border: 1px solid rgba(86, 134, 194, .27);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(5, 24, 54, .92), rgba(11, 39, 77, .9), rgba(5, 24, 54, .92));
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .2);
}
.control-copy { display: flex; align-items: center; gap: 12px; flex: 1; }
.control-copy strong { display: block; margin-bottom: 3px; color: #dbeaff; font-size: 16px; }
.control-copy p { margin: 0; color: #708bae; font-size: 13px; }
.shield { display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid rgba(61, 180, 211, .35); border-radius: 50%; color: #63d8ed; background: rgba(33, 136, 171, .12); }
.actions { display: flex; gap: 12px; }
.button { min-width: 138px; border: 1px solid transparent; border-radius: 7px; padding: 14px 22px; color: #fff; font-size: 17px; font-weight: 700; cursor: pointer; transition: transform .15s, filter .15s, opacity .15s; }
.button:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.12); }
.button:disabled { cursor: not-allowed; opacity: .36; }
.button-primary { background: linear-gradient(135deg, #267be5, #164ca8); box-shadow: 0 8px 22px rgba(21, 90, 191, .28); }
.button-stop { background: linear-gradient(135deg, #df9d2c, #ac6711); box-shadow: 0 8px 22px rgba(184, 109, 15, .22); }
.button-reset { color: #a9bfdc; border-color: rgba(103, 143, 192, .36); background: #122b50; }
.play-icon { margin-right: 7px; font-size: 13px; }
.stop-icon { display: inline-block; width: 11px; height: 11px; margin-right: 8px; background: currentColor; }

footer { position: relative; z-index: 1; max-width: 1800px; margin: 20px auto 0; color: #6f87a7; text-align: center; font-size: 13px; letter-spacing: .1em; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(1, 8, 19, .78); backdrop-filter: blur(8px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(430px, 100%); padding: 34px; border: 1px solid rgba(102, 153, 217, .35); border-radius: 13px; background: linear-gradient(160deg, #122d55, #07172f); box-shadow: 0 24px 80px rgba(0,0,0,.5); text-align: center; }
.modal-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 17px; border-radius: 50%; color: var(--gold); background: rgba(240, 184, 75, .1); font-size: 31px; }
.modal h2 { margin: 0 0 10px; font-size: 24px; }
.modal p { margin: 0; color: #95accb; line-height: 1.7; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.modal-actions button { border: 1px solid rgba(111, 151, 199, .32); border-radius: 7px; padding: 12px; color: #bed2ec; background: #102747; cursor: pointer; }
.modal-actions .confirm-reset { color: white; border-color: #a06d20; background: #a96c16; }

@keyframes pulse { 50% { opacity: .45; transform: scale(.8); } }
@keyframes flicker { from { opacity: .58; transform: translateY(-1px); } to { opacity: 1; transform: translateY(1px); } }

@media (max-width: 1100px) {
  .groups-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .control-panel { align-items: stretch; flex-direction: column; }
  .actions { justify-content: center; }
}

@media (max-width: 700px) {
  .draw-app { padding: 18px 14px; }
  .hero { align-items: flex-start; gap: 13px; }
  .event-mark { width: 44px; height: 44px; flex-basis: 44px; }
  .event-mark span { font-size: 20px; }
  .fullscreen-button { position: absolute; right: 0; top: 66px; padding: 8px 10px; font-size: 12px; }
  .eyebrow { padding-right: 10px; font-size: 12px; line-height: 1.5; }
  h1 { font-size: 23px; }
  .status-bar { align-items: flex-start; flex-wrap: wrap; }
  .status-detail { width: 100%; margin-left: 21px; }
  .groups-grid { grid-template-columns: 1fr; }
  .group-heading { padding: 13px 15px; }
  .group-letter { width: 40px; height: 40px; }
  .team-list { grid-template-columns: 1fr 1fr; padding: 12px; }
  .team-list li { min-height: 58px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .button { min-width: 0; padding: 13px 8px; font-size: 15px; }
  .button-reset { grid-column: 1 / -1; grid-row: 2; }
  .control-copy { align-items: flex-start; }
}

@media (min-width: 1400px) and (min-height: 800px) {
  .draw-app { display: flex; flex-direction: column; }
  .groups-grid { flex: 1; }
  .team-list { height: calc(100% - 84px); }
  .team-list li { min-height: clamp(66px, 8vh, 86px); }
}
