:root {
  color-scheme: dark;
  --bg: #0a0c12;
  --sidebar: #0d1018;
  --surface: #121621;
  --surface-raised: #171c29;
  --surface-input: #0c0f17;
  --line: #252c3c;
  --line-soft: #1d2330;
  --text: #f5f7ff;
  --muted: #8e98ab;
  --muted-bright: #b6bfd0;
  --accent: #8b7cff;
  --accent-strong: #7464f2;
  --accent-glow: rgba(139, 124, 255, .22);
  --green: #45d49b;
  --danger: #f0717d;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 76% -8%, rgba(101, 83, 218, .22), transparent 31rem),
    radial-gradient(circle at 38% 80%, rgba(34, 53, 111, .12), transparent 35rem),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.auth-loading::before {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: 50%;
  color: var(--muted);
  content: "正在验证 Discord 登录状态…";
  font-size: 13px;
  letter-spacing: .03em;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}
body.auth-loading .app-shell { opacity: 0; pointer-events: none; }
body.auth-ready .app-shell { opacity: 1; transition: opacity .18s ease; }

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: #a89fff; text-decoration: none; }
a:hover { color: #c4beff; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex: 0 0 248px;
  flex-direction: column;
  width: 248px;
  height: 100vh;
  padding: 26px 16px 18px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(16, 19, 29, .98), rgba(10, 12, 18, .98));
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark, .auth-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(183, 173, 255, .45);
  border-radius: 12px;
  background: linear-gradient(145deg, #9b8cff, #6658dc);
  box-shadow: 0 8px 24px rgba(111, 92, 239, .3);
  color: white;
  font-size: 20px;
}
.brand-copy { display: grid; gap: 0; line-height: 1.05; }
.brand-copy strong { font-size: 17px; letter-spacing: -.02em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .2em; }
.sidebar-section-label { margin: 44px 10px 11px; color: #626d81; font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.sidebar-section-label.server-label { margin-top: 34px; }
.nav-links { display: grid; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); font-weight: 600; transition: background .18s ease, color .18s ease, border-color .18s ease; }
.nav-link:hover { border-color: var(--line); background: rgba(139, 124, 255, .07); color: var(--text); }
.nav-link.active { border-color: rgba(139, 124, 255, .22); background: linear-gradient(90deg, rgba(139, 124, 255, .18), rgba(139, 124, 255, .06)); color: #ddd9ff; }
.nav-icon { display: inline-grid; place-items: center; width: 20px; color: #8f84f7; font-size: 18px; font-weight: 400; }
.server-picker { position: relative; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(24, 29, 42, .75); }
.server-picker:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.server-avatar { display: grid; flex: 0 0 30px; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #5965e8; color: white; font-size: 13px; font-weight: 800; }
.server-picker label { min-width: 0; flex: 1; }
.server-picker select { width: 100%; padding: 0 14px 0 0; border: 0; outline: 0; background: transparent; color: var(--muted-bright); font-size: 12px; font-weight: 600; text-overflow: ellipsis; }
.server-picker .chevron { color: var(--muted); pointer-events: none; }
.sidebar-spacer { flex: 1; }
.service-card { margin: 16px 2px 16px; padding: 13px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(21, 26, 38, .8); }
.service-title { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.service-dot { width: 7px; height: 7px; border-radius: 99px; background: #626b7c; box-shadow: 0 0 0 3px rgba(98, 107, 124, .12); }
.service-dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(69, 212, 155, .12), 0 0 9px var(--green); }
.service-card strong { display: block; color: var(--muted-bright); font-size: 13px; }
.service-card > span:last-child { display: block; margin-top: 2px; color: #687386; font-size: 11px; }
.sidebar-footer { color: #586274; font-size: 11px; text-align: center; }
.sidebar-footer span { float: right; color: #454e5f; }

.main-content { width: min(1220px, calc(100% - 248px)); margin: 0 auto; padding: 48px clamp(26px, 4vw, 62px) 72px; }
.page-header, .section-heading, .card-header, .header-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-header { margin-bottom: 30px; }
.page-header h1 { margin: 5px 0 5px; font-size: clamp(30px, 4vw, 42px); letter-spacing: -.055em; }
.page-header p, .card-header p { margin: 0; color: var(--muted); }
.section-kicker { display: inline-block; color: #9085f8; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.header-actions { align-items: flex-end; }
.filter-control { min-width: 190px; }
.action-button { display: flex; align-items: center; gap: 8px; }
.action-button span { font-size: 17px; line-height: 1; }
.account-summary { display: flex; align-items: center; gap: 8px; padding: 5px 7px 5px 5px; border: 1px solid var(--line); border-radius: 11px; background: rgba(24, 29, 42, .78); }
.account-avatar { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: #5965e8; color: white; font-size: 12px; font-weight: 800; }
.account-summary > span:nth-child(2) { display: grid; gap: 0; min-width: 72px; }
.account-summary strong { overflow: hidden; color: var(--muted-bright); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-summary small { color: #687386; font-size: 9px; }
.logout-link { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 7px; color: var(--muted); font-size: 18px; }
.logout-link:hover { background: rgba(240, 113, 125, .12); color: #ffadb5; }

.card, .stat-card { border: 1px solid var(--line-soft); background: linear-gradient(145deg, rgba(22, 27, 40, .96), rgba(15, 19, 29, .96)); box-shadow: 0 18px 45px rgba(0, 0, 0, .14); }
.card { margin-bottom: 20px; padding: 25px; border-radius: 16px; }
.card-header { align-items: flex-start; margin-bottom: 24px; }
.card-header.compact { margin-bottom: 27px; }
.card-header h2 { margin: 4px 0 4px; font-size: 18px; letter-spacing: -.025em; }
.card-symbol { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(139, 124, 255, .23); border-radius: 11px; background: rgba(139, 124, 255, .1); color: #aa9fff; font-size: 21px; }
.muted-symbol { color: var(--muted); border-color: var(--line); background: rgba(255, 255, 255, .03); font-size: 16px; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { display: flex; align-items: center; gap: 13px; min-height: 96px; padding: 17px; border-radius: 14px; }
.stat-card.stat-primary { border-color: rgba(139, 124, 255, .24); background: linear-gradient(135deg, rgba(55, 45, 128, .36), rgba(20, 24, 37, .96) 75%); }
.stat-icon { display: grid; flex: 0 0 40px; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(139, 124, 255, .15); color: #aaa1ff; font-size: 18px; }
.stat-icon.violet { background: rgba(190, 112, 255, .14); color: #c996ff; }
.stat-icon.green { background: rgba(69, 212, 155, .13); color: #6ee4b3; }
.stat-card div:last-child { min-width: 0; }
.stat-card span, .stat-card small { display: block; color: var(--muted); font-size: 11px; }
.stat-card strong { display: block; margin: 1px 0; color: var(--text); font-size: 18px; letter-spacing: -.03em; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); align-items: start; gap: 20px; }
.settings-card { position: sticky; top: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid.single-column { grid-template-columns: 1fr; }
.full { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: var(--muted-bright); font-size: 12px; font-weight: 600; }
.field-hint { color: #697488; font-size: 11px; font-weight: 400; }
.form-divider { height: 1px; margin: 2px 0 1px; background: var(--line-soft); }
input, select, textarea, button { width: 100%; border-radius: 9px; }
input, select, textarea { border: 1px solid var(--line); outline: none; background: var(--surface-input); color: var(--text); transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
input, select { min-height: 42px; padding: 10px 12px; }
textarea { padding: 11px 12px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #566174; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: #0e121c; box-shadow: 0 0 0 3px var(--accent-glow); }
select[multiple] { min-height: 122px; padding: 5px; }
select[multiple] option { padding: 7px 9px; border-radius: 5px; color: var(--muted-bright); }
select[multiple] option:checked { background: rgba(139, 124, 255, .24) linear-gradient(0deg, rgba(139, 124, 255, .24), rgba(139, 124, 255, .24)); color: white; }
button { min-height: 42px; padding: 10px 14px; border: 1px solid transparent; color: white; font-weight: 700; transition: transform .15s ease, filter .15s ease, background .15s ease; }
button:hover { filter: brightness(1.1); }
button:active { transform: translateY(1px); }
.primary-action { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); box-shadow: 0 10px 24px rgba(116, 100, 242, .2); }
.login-link { min-height: 48px; padding: 13px 15px; color: white; text-decoration: none; }
.login-link:hover { color: white; }
.primary-action b { font-size: 20px; font-weight: 400; line-height: 1; }
button.secondary { width: auto; border-color: var(--line); background: rgba(38, 45, 62, .9); color: var(--muted-bright); }
.single-column button.secondary { width: 100%; }
button.danger { width: auto; border-color: rgba(240, 113, 125, .2); background: rgba(106, 43, 54, .6); color: #ffcbd0; }
button.small-button { width: auto; min-height: 30px; padding: 5px 9px; font-size: 11px; }
.color-input { display: flex; align-items: center; gap: 8px; }
.color-input input { min-width: 0; flex: 1; }
.color-input > span { flex: 0 0 30px; width: 30px; height: 30px; border: 2px solid #fff3; border-radius: 8px; background: #5865F2; }
.settings-note { display: flex; gap: 9px; margin-top: 24px; padding: 11px 12px; border: 1px solid rgba(139, 124, 255, .16); border-radius: 10px; background: rgba(139, 124, 255, .06); }
.settings-note span { display: grid; flex: 0 0 17px; place-items: center; width: 17px; height: 17px; border: 1px solid #9185ff; border-radius: 99px; color: #aa9fff; font-size: 10px; }
.settings-note p { margin: 0; color: var(--muted); font-size: 11px; }
.settings-footnote { margin: 19px 0 0; }

.table-card { padding-bottom: 9px; }
.section-heading { align-items: flex-end; margin-bottom: 16px; }
.section-heading h2 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.025em; }
.table-caption { color: #687386; font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { color: #697488; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
td { color: var(--muted-bright); font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(139, 124, 255, .025); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 99px; background: #2a3142; font-size: 11px; }
.status::before { width: 5px; height: 5px; border-radius: 99px; background: #8791a4; content: ""; }
.status.active { background: rgba(45, 126, 92, .22); color: #87e9bb; }
.status.active::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status.ended { background: rgba(112, 121, 141, .15); color: #aeb7c8; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.giveaway-details-row td { padding-top: 0; background: rgba(139, 124, 255, .025); }
.giveaway-details-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px; border: 1px solid rgba(139, 124, 255, .16); border-radius: 11px; background: rgba(16, 20, 31, .7); }
.giveaway-detail-item { display: grid; min-width: 0; gap: 4px; padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(255, 255, 255, .025); }
.giveaway-detail-item span { color: #788398; font-size: 10px; font-weight: 700; }
.giveaway-detail-item strong { overflow-wrap: anywhere; color: var(--muted-bright); font-size: 12px; }
.giveaway-detail-wide { grid-column: span 3; }
.detail-description { white-space: pre-wrap; }
.giveaway-detail-item code { color: #b9b0ff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.notice { margin-bottom: 18px; padding: 12px 14px; border: 1px solid #665522; border-radius: 10px; background: rgba(91, 70, 21, .45); color: #ffe5a0; }
.notice.error { border-color: #713844; background: rgba(75, 29, 39, .65); color: #ffc5cb; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.auth-card { position: relative; display: grid; min-height: 620px; place-items: center; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 22px; background: linear-gradient(145deg, rgba(24, 28, 44, .94), rgba(14, 17, 27, .98)); box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.auth-content { position: relative; z-index: 1; width: min(100% - 48px, 390px); text-align: center; }
.auth-mark { width: 58px; height: 58px; margin: 0 auto 24px; border-radius: 18px; font-size: 28px; }
.auth-content h1 { margin: 9px 0 10px; font-size: 36px; letter-spacing: -.06em; }
.auth-lead { margin: 0 auto 28px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.auth-form { display: grid; gap: 14px; text-align: left; }
.auth-form .primary-action { margin-top: 3px; }
.oauth-login-panel { display: grid; gap: 12px; text-align: left; }
.login-security-note { margin: 0; color: #748097; font-size: 11px; line-height: 1.6; text-align: center; }
.login-security-note span { color: var(--green); }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 22px 0 14px; color: #596476; font-size: 10px; }
.login-divider::before, .login-divider::after { height: 1px; flex: 1; background: var(--line-soft); content: ""; }
.auth-status-message { margin: 18px 0 0; padding: 9px 11px; border: 1px solid rgba(240, 113, 125, .24); border-radius: 8px; background: rgba(106, 43, 54, .22); color: #ffb9c0; font-size: 11px; }
.auth-hint { margin: 17px 0 0; color: #697488; font-size: 11px; }
.auth-hint span { margin-right: 5px; color: #9a8fff; }
.auth-decoration { position: absolute; border-radius: 99px; filter: blur(1px); pointer-events: none; }
.auth-decoration-one { top: -180px; right: -80px; width: 450px; height: 450px; border: 1px solid rgba(139, 124, 255, .15); box-shadow: 0 0 0 35px rgba(139, 124, 255, .025), 0 0 0 70px rgba(139, 124, 255, .02); }
.auth-decoration-two { bottom: -250px; left: -180px; width: 480px; height: 480px; background: radial-gradient(circle, rgba(91, 75, 210, .17), transparent 68%); }

@media (max-width: 1000px) {
  .sidebar { flex-basis: 218px; width: 218px; }
  .main-content { width: calc(100% - 218px); padding-right: 28px; padding-left: 28px; }
  .content-grid { grid-template-columns: 1fr; }
  .settings-card { position: static; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: static; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center; gap: 14px; width: 100%; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .sidebar-section-label, .nav-links, .sidebar-spacer, .service-card, .sidebar-footer { display: none; }
  .server-picker { grid-column: 2 / -1; grid-row: 2; }
  .brand { padding: 0; }
  .main-content { width: 100%; padding: 30px 16px 48px; }
  .page-header, .header-actions { align-items: stretch; flex-direction: column; }
  .header-actions { width: 100%; gap: 10px; }
  .filter-control, .action-button, .account-summary { width: 100%; }
  .action-button { justify-content: center; }
  .account-summary { justify-content: flex-start; }
  .stats-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .giveaway-details-grid { grid-template-columns: 1fr; }
  .giveaway-detail-wide { grid-column: auto; }
  .card { padding: 19px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .auth-card { min-height: 560px; }
}
