:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #131a2a;
  --muted: #5c6780;
  --line: #e2e7f1;
  --brand: #2b47d6;
  --brand-dark: #1f36ab;
  --brand-soft: #eaefff;
  --accent: #f0a63c;
  --ink: #0c1424;
  --ink-2: #16203a;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 26px 60px rgba(10, 18, 40, 0.22);
  --max: 1100px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Hiragino Sans GB", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
blockquote { margin: 0; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 22px; }

.kicker {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
}

.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; color: var(--text); font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(140deg, var(--brand), #6d3ff0);
  color: #fff; display: grid; place-items: center; font-size: 17px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(43, 71, 214, 0.3);
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

.nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav a { padding: 9px 13px; border-radius: 9px; color: var(--muted); font-size: 15px; font-weight: 500; }
.nav a:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.nav a.active { color: var(--brand); background: var(--brand-soft); font-weight: 700; }

.nav-toggle {
  display: none; border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 6px 11px; cursor: pointer; font-size: 16px;
}

main { min-height: 60vh; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(900px 460px at 82% -12%, rgba(240, 166, 60, 0.2), transparent 62%),
    radial-gradient(820px 480px at 6% 8%, rgba(43, 71, 214, 0.42), transparent 60%),
    linear-gradient(158deg, #0b1220 0%, #141e39 55%, #0b1220 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 78%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 56px;
  padding: 76px 22px 84px;
}

.hero-grid.solo { grid-template-columns: 1fr; padding: 84px 22px 92px; }
.hero-grid.solo .hero-copy { max-width: 720px; }

.hero-copy h1 {
  font-size: 46px;
  line-height: 1.2;
  margin: 0 0 16px;
  letter-spacing: -0.5px;
  font-weight: 800;
}
.hero-copy p { font-size: 17px; color: rgba(255, 255, 255, 0.76); max-width: 560px; margin: 0 0 28px; }
.hero-kicker {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: 0.18em;
  color: var(--accent); text-transform: uppercase; margin-bottom: 14px;
}

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 34px; }

.hero-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.hero-stats strong { display: block; font-size: 24px; font-weight: 800; line-height: 1.2; }
.hero-stats span { font-size: 13px; color: rgba(255, 255, 255, 0.62); }

.hero-photo {
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 350px;
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-lg);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 26%; }
.hero-photo-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 18px 15px;
  background: linear-gradient(transparent, rgba(8, 13, 26, 0.86));
  display: flex; align-items: baseline; gap: 9px;
}
.hero-photo-cap strong { font-size: 17px; font-weight: 700; }
.hero-photo-cap span { font-size: 13px; color: var(--accent); font-weight: 600; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block; border: 1px solid transparent; cursor: pointer;
  background: var(--brand); color: #fff; padding: 12px 22px;
  border-radius: 11px; font-size: 15px; font-weight: 700; font-family: inherit;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; transform: translateY(-1px); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { background: #f2f4f9; }
.btn.ghost-light {
  background: rgba(255, 255, 255, 0.08); color: #fff;
  border-color: rgba(255, 255, 255, 0.28); backdrop-filter: blur(6px);
}
.btn.ghost-light:hover { background: rgba(255, 255, 255, 0.18); }
.btn.danger { background: #e5484d; }
.btn.danger:hover { background: #c93a3f; }
.btn.small { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: 0.5; cursor: default; transform: none; }

/* ---------- sections ---------- */

.section { padding: 62px 0; }
.section + .section { padding-top: 6px; }
.section-head { margin-bottom: 30px; }
.section-head h2 {
  font-size: 27px; margin: 0 0 8px; font-weight: 800; letter-spacing: -0.3px;
  display: flex; align-items: center; gap: 12px;
}
.section-head h2::before {
  content: ""; width: 5px; height: 24px; border-radius: 3px;
  background: linear-gradient(var(--brand), var(--accent)); flex: none;
}
.section-head p { color: var(--muted); margin: 0; font-size: 15px; }

.more-link { margin: 24px 0 0; }

.grid { display: grid; gap: 22px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------- president ---------- */

.president-card {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 32px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow);
  margin-bottom: 34px;
}
.president-avatar {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(140deg, var(--brand-soft), #f3ecff);
}
.president-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.president-body blockquote {
  font-size: 17px; line-height: 1.85; color: var(--text);
  border-left: 3px solid var(--accent); padding-left: 16px; margin: 6px 0 14px;
}
.president-sign { font-weight: 700; }
.president-role { color: var(--muted); font-size: 14px; }
.president-name { font-size: 21px; font-weight: 800; }
.president-bio { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.poster-grid { align-items: start; }
.poster-card {
  position: relative;
  display: block;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--surface);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.poster-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}
.poster-card img { width: 100%; display: block; }
.poster-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 16px 12px;
  font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(8, 13, 26, 0.78));
}

/* ---------- news ---------- */

.news-item { display: flex; gap: 22px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: none; }
.news-date {
  flex: 0 0 100px; color: var(--muted); font-size: 14px;
  font-variant-numeric: tabular-nums; padding-top: 3px;
}
.news-item h3 { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.news-item p { margin: 0; color: var(--muted); }

.article { max-width: 760px; }
.article h1 { font-size: 31px; margin: 0 0 8px; font-weight: 800; letter-spacing: -0.4px; }
.article .meta { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.article .body { white-space: pre-wrap; font-size: 16px; }

/* ---------- forms ---------- */

.form { max-width: 680px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .req { color: #e5484d; }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--text);
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { resize: vertical; min-height: 120px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

.notice { padding: 14px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px; }
.notice.ok { background: #e7f8ee; color: #147a3d; border: 1px solid #bce9cd; }
.notice.err { background: #fdecec; color: #b32b2f; border: 1px solid #f6c6c7; }
.notice.info { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #cdd8ff; }

.empty { color: var(--muted); padding: 28px 0; text-align: center; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 40px 0; margin-top: 50px; color: var(--muted); font-size: 14px;
}
.site-footer .container { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.site-footer strong { color: var(--text); }

/* ---------- admin ---------- */

.admin-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; flex-wrap: wrap; }
.tabs button {
  border: none; background: none; padding: 11px 16px; cursor: pointer;
  font-size: 15px; font-family: inherit; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }

.row-card { border: 1px solid var(--line); border-radius: 13px; padding: 16px; margin-bottom: 14px; background: var(--surface); }
.row-card .row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.row-card .row-head strong { font-size: 15px; }
.row-actions { display: flex; gap: 8px; }
.row-body { display: grid; gap: 12px; }
.row-body.collapsed { display: none; }
.row-body .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- puzzles ---------- */

.puzzle-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.puzzle-head h3 { margin: 0; font-size: 18px; }
.badge {
  flex: none; font-size: 12px; font-weight: 700; padding: 3px 11px;
  border-radius: 999px; background: #eef1f6; color: var(--muted);
}
.badge.easy { background: #e7f8ee; color: #147a3d; }
.badge.mid { background: #fff4e0; color: #a86400; }
.badge.hard { background: #fdecec; color: #b32b2f; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tags span { font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 2px 9px; border-radius: 999px; }

.puzzle-author { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.puzzle-author::before { content: "✎ "; }

.puzzle .surface {
  margin: 0 0 16px; padding: 15px 17px; border-left: 3px solid var(--brand);
  background: #f7f8fd; border-radius: 0 11px 11px 0; color: var(--text); font-size: 15px;
}
.answer { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.answer-label {
  display: inline-block; font-size: 12px; font-weight: 700; color: #a86400;
  background: #fff4e0; padding: 2px 9px; border-radius: 999px; margin-bottom: 8px;
}
.answer p { margin: 0; color: var(--muted); font-size: 15px; }

.puzzle-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.puzzle-actions .btn[disabled] { opacity: 0.5; cursor: default; }
.puzzle-actions .btn[disabled]:hover { background: var(--surface); }

.hints, .qa { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.hint-label { color: #147a3d; background: #e7f8ee; }
.hint-list { margin: 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.hint-list li { margin-bottom: 6px; }

.qa-list { display: grid; gap: 10px; }
.qa-item { background: #f7f8fd; border-radius: var(--radius-sm); padding: 10px 14px; }
.qa-q { font-size: 14px; font-weight: 600; }
.qa-a { font-size: 14px; color: var(--muted); margin-top: 2px; }

.puzzle-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 26px; }
.puzzle-search { flex: 1 1 240px; max-width: 350px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: 8px 15px; border-radius: 999px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------- submission ---------- */

.submit-section { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.submit-section .form { max-width: 780px; }
.submit-section .field { margin-bottom: 16px; }

.subs-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.subs-text {
  white-space: pre-wrap; font-size: 14px; color: var(--text);
  background: #f7f8fd; border-radius: var(--radius-sm); padding: 10px 14px;
}
.subs-line { font-size: 14px; color: var(--muted); padding: 2px 0; }

/* ---------- daily ---------- */

.daily-bar { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.daily-stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px;
  padding: 13px 19px; min-width: 120px; box-shadow: var(--shadow-sm);
}
.daily-stat strong { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.daily-stat span { color: var(--muted); font-size: 13px; }
.daily-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

.daily-mark {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line);
}
.daily-state {
  font-size: 13px; font-weight: 600; padding: 3px 11px;
  border-radius: 999px; background: #eef1f6; color: var(--muted);
}
.daily-state.solved { background: #e7f8ee; color: #147a3d; }
.daily-state.unsolved { background: #fff4e0; color: #a86400; }

/* ---------- ai host ---------- */

.ai-host { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.ai-log { max-height: 260px; overflow-y: auto; display: grid; gap: 8px; margin-bottom: 10px; }
.ai-empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.ai-msg { font-size: 14px; border-radius: var(--radius-sm); padding: 8px 12px; background: #f7f8fd; white-space: pre-wrap; }
.ai-msg .ai-who { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.ai-msg.player { background: var(--brand-soft); }
.ai-msg.player .ai-who { color: var(--brand-dark); }
.ai-msg.host { background: #e7f8ee; }
.ai-msg.host .ai-who { color: #147a3d; }
.ai-msg.error { background: #fdecec; }
.ai-msg.error .ai-who { color: #b32b2f; }
.ai-msg.pending { opacity: 0.7; font-style: italic; }
.ai-input { display: flex; gap: 8px; }
.ai-input .ai-question { flex: 1; }
.ai-hint { color: var(--muted); font-size: 12px; margin-top: 8px; }

.ai-progress {
  margin-bottom: 10px; padding: 10px 13px;
  background: #f7f8fd; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.ai-kp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-kp-title { font-size: 13px; color: var(--muted); font-weight: 700; }
.ai-kp-count { color: var(--brand); }
.ai-kp-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.kp-chip {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: #eef1f6; color: var(--muted); border: 1px dashed var(--line);
}
.kp-chip.found { background: #e7f8ee; color: #147a3d; border: 1px solid #bce9cd; }
.ai-kp-bar { height: 6px; border-radius: 3px; background: #e8ebf3; overflow: hidden; }
.ai-kp-fill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), #6d3ff0);
  transition: width 0.4s ease;
}
.ai-msg.found { background: #fff4e0; }
.ai-msg.found .ai-who { color: #a86400; }
.ai-msg.celebrate { background: linear-gradient(90deg, #e7f8ee, #eaefff); font-weight: 700; }
.ai-msg.celebrate .ai-who { color: #147a3d; }
.ai-question[disabled] { opacity: 0.6; }

.login-wrap { display: flex; justify-content: center; padding-top: 40px; }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 40px 36px; max-width: 420px; width: 100%;
  text-align: center;
}
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px;
  background: linear-gradient(140deg, var(--brand), #6d3ff0);
  color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 800;
  box-shadow: 0 8px 24px rgba(43, 71, 214, 0.35);
}
.login-card h2 { margin: 0 0 6px; font-size: 20px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input { text-align: center; font-size: 16px; padding: 13px; }
.login-hint { color: var(--muted); font-size: 12px; margin-top: 14px; text-align: left; }
.login-card .notice { text-align: left; }
.register-panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); text-align: left; }
.register-panel summary { cursor: pointer; color: var(--brand); font-weight: 700; }
.register-panel .login-form { margin-top: 16px; }
.register-panel .login-hint { margin-bottom: 0; }

.news-badge {
  display: inline-block; font-size: 11px; font-weight: 700; color: #a86400;
  background: #fff4e0; border: 1px solid #f2d9a4;
  padding: 1px 8px; border-radius: 999px; margin-left: 8px; vertical-align: 2px;
}
.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed var(--line);
}
.member-row:last-child { border-bottom: none; }
.member-row-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.member-row strong { display: block; font-size: 15px; }
.member-row-dept { font-size: 12px; color: var(--muted); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; padding: 56px 22px 64px; }
  .hero-photo { justify-self: start; max-width: 280px; }
  .hero-copy h1 { font-size: 36px; }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .president-card { grid-template-columns: 130px 1fr; gap: 22px; padding: 24px; }
}

@media (max-width: 640px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .nav {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: 8px; gap: 2px;
    box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav-toggle { display: block; }
  .site-header .container { position: relative; }
  .hero-copy h1 { font-size: 30px; }
  .hero-stats { gap: 24px; }
  .news-item { flex-direction: column; gap: 4px; }
  .news-date { flex: none; }
  .president-card { grid-template-columns: 1fr; text-align: left; }
  .president-avatar { max-width: 150px; }
  .row-body .two { grid-template-columns: 1fr; }
  .section { padding: 44px 0; }
}
