:root {
  --bg: #0f172a;
  --surface: rgba(34, 46, 70, 0.84);
  --surface-strong: rgba(43, 56, 83, 0.97);
  --line: rgba(255, 255, 255, 0.11);
  --text: #f8fafc;
  --muted: #a7b2c8;
  --accent: #a855f7;
  --accent-2: #ec4899;
  --shadow: 0 20px 55px rgba(3, 7, 18, 0.32);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 50% -20%, #1e293b 0%, var(--bg) 52%); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.ambient { position: fixed; pointer-events: none; filter: blur(80px); opacity: .2; border-radius: 999px; }
.ambient-a { width: 420px; height: 420px; top: 6%; left: -180px; background: #a855f7; }
.ambient-b { width: 500px; height: 500px; top: 14%; right: -230px; background: #ec4899; }

.public-shell { position: relative; width: min(100% - 32px, 580px); margin: 0 auto; padding: 72px 0 48px; }
.hero { text-align: center; }
.hero-mark { width: 76px; height: 76px; display: grid; place-items: center; margin: 0 auto 24px; border-radius: 24px; color: white; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 34px color-mix(in srgb, var(--accent) 50%, transparent); font-size: 34px; }
.hero h1 { margin: 0; font-size: clamp(2.2rem, 7vw, 3.45rem); line-height: 1.14; letter-spacing: 0; }
.hero h1 span { display: block; color: var(--accent-2); }
.hero p { margin: 18px 0 42px; color: var(--muted); font-size: 1.06rem; }

.card-list { display: grid; gap: 14px; }
.link-card, .info-card, .thanks-card { border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.link-card { display: flex; align-items: center; gap: 16px; padding: 17px 18px; background: var(--surface); transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.link-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 62%, white 10%); background: var(--surface-strong); }
.card-icon { width: 54px; height: 54px; flex: 0 0 54px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--card-accent, var(--accent)); font-size: 25px; }
.card-copy { min-width: 0; flex: 1; }
.card-copy h3 { margin: 0; font-size: 1.13rem; line-height: 1.3; }
.card-copy p { margin: 5px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.35; overflow-wrap: anywhere; }
.card-arrow { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 999px; background: color-mix(in srgb, var(--card-accent, var(--accent)) 65%, transparent); font-size: 20px; transition: transform .2s ease; }
.link-card:hover .card-arrow { transform: translateX(3px); }

.info-card, .thanks-card { margin-top: 44px; padding: 20px 22px; background: var(--surface); }
.info-row { display: flex; align-items: flex-start; gap: 15px; }
.info-icon { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; border-radius: 12px; background: #eab308; font-size: 22px; }
.info-card h3, .thanks-card h3 { margin: 2px 0 7px; font-size: 1.08rem; }
.info-card p, .thanks-card p { margin: 0; color: var(--muted); line-height: 1.65; font-size: .9rem; }
.group-card { display: flex; align-items: center; gap: 14px; }
.group-card .info-icon { background: #2563eb; }
.group-copy { flex: 1; min-width: 0; }
.group-copy p + p { margin-top: 9px; }
.join-button { border: 0; padding: 11px 17px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px rgba(168, 85, 247, .28); white-space: nowrap; }
.thanks-card { text-align: center; background: linear-gradient(145deg, rgba(98, 47, 139, .35), rgba(32, 34, 73, .7)); }
.thanks-card p { max-width: 360px; margin: 0 auto; }
.footer { margin-top: 58px; color: #7f8ca5; text-align: center; font-size: .82rem; }
.empty-state { padding: 42px 20px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 16px; }

.admin-page { min-height: 100vh; padding: 30px 20px 50px; }
.admin-shell { width: min(100%, 1120px); margin: 0 auto; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-lockup .hero-mark { width: 46px; height: 46px; margin: 0; border-radius: 13px; font-size: 21px; }
.brand-lockup h1 { margin: 0; font-size: 1.35rem; }
.brand-lockup p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }
.admin-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.button { border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; color: var(--text); background: rgba(255,255,255,.06); }
.button.primary { border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.button.danger { color: #fecaca; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.25); }
.tabs { display: flex; gap: 7px; margin-bottom: 20px; overflow-x: auto; }
.tab { border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; color: var(--muted); background: transparent; white-space: nowrap; }
.tab.active { border-color: color-mix(in srgb, var(--accent) 60%, white 12%); color: #fff; background: rgba(168,85,247,.18); }
.panel { border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: rgba(24, 35, 58, .78); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; font-size: 1.1rem; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.table-wrap { overflow-x: auto; }
.cards-table { width: 100%; border-collapse: collapse; min-width: 670px; }
.cards-table th, .cards-table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cards-table th { color: #9aa7bf; font-size: .78rem; font-weight: 600; }
.cards-table td { font-size: .88rem; }
.table-title { display: flex; align-items: center; gap: 10px; }
.table-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #fff; font-size: 17px; }
.table-title strong { display: block; }
.table-title span { display: block; margin-top: 2px; color: var(--muted); font-size: .76rem; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; color: #a7f3d0; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #34d399; }
.status-dot.off { color: #fecaca; }
.status-dot.off::before { background: #f87171; }
.row-actions { display: flex; gap: 7px; }
.icon-button { width: 33px; height: 33px; border: 1px solid var(--line); border-radius: 8px; color: #dbe4f5; background: rgba(255,255,255,.05); }
.icon-button:hover { background: rgba(255,255,255,.12); }
.icon-button.danger:hover { color: #fecaca; border-color: rgba(239,68,68,.45); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #d8e0ef; font-size: .82rem; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; color: var(--text); background: rgba(10, 17, 31, .48); outline: none; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168,85,247,.17); }
.field textarea { min-height: 86px; resize: vertical; }
.field input[type="color"] { height: 42px; padding: 4px; }
.check-row { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: .84rem; }
.check-row input { accent-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.redirect-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 9px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line); }
.redirect-row:first-child { padding-top: 0; }
.redirect-row:last-child { border-bottom: 0; padding-bottom: 0; }
.muted { color: var(--muted); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(100%, 390px); border: 1px solid var(--line); border-radius: 18px; padding: 30px; background: rgba(24, 35, 58, .9); box-shadow: var(--shadow); }
.login-card .hero-mark { margin: 0 auto 18px; }
.login-card h1 { margin: 0; text-align: center; font-size: 1.35rem; }
.login-card > p { margin: 8px 0 25px; color: var(--muted); text-align: center; font-size: .88rem; }
.login-card .button { width: 100%; margin-top: 18px; }
.login-error { min-height: 18px; margin-top: 12px; color: #fda4af; text-align: center; font-size: .8rem; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; transform: translateY(20px); opacity: 0; pointer-events: none; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; color: #fff; background: #1e293b; box-shadow: var(--shadow); transition: .25s ease; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 650px) {
  .public-shell { width: min(100% - 24px, 580px); padding-top: 46px; }
  .hero h1 { font-size: 2.12rem; }
  .link-card { padding: 14px; }
  .card-icon { width: 47px; height: 47px; flex-basis: 47px; }
  .group-card { align-items: flex-start; flex-wrap: wrap; }
  .group-copy { min-width: calc(100% - 61px); }
  .join-button { margin-left: 61px; }
  .admin-page { padding: 20px 12px 35px; }
  .admin-topbar { align-items: flex-start; flex-direction: column; }
  .admin-actions { width: 100%; justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .redirect-row { grid-template-columns: 1fr; }
}
