:root {
  --paper: #f5ead8;
  --paper-2: #fff8eb;
  --ink: #332417;
  --muted: #7e6a55;
  --coffee: #6f3e25;
  --brick: #a54f31;
  --gold: #d9a441;
  --green: #3d6652;
  --line: rgba(83, 55, 32, .18);
  --shadow: 0 24px 80px rgba(71, 44, 21, .18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Songti SC", "SimSun", "STSong", "Noto Serif CJK SC", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(217,164,65,.35), transparent 28rem),
    radial-gradient(circle at 90% 4%, rgba(61,102,82,.2), transparent 24rem),
    linear-gradient(135deg, #f8edda 0%, #ead8bd 100%);
  min-height: 100vh;
}

.grain { position: fixed; inset: 0; pointer-events: none; opacity: .2; z-index: 3; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E"); mix-blend-mode: multiply; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px clamp(18px, 4vw, 58px);
  backdrop-filter: blur(18px);
  background: rgba(245, 234, 216, .74);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--ink); text-decoration: none; display: flex; gap: 10px; align-items: baseline; }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; color: #fff8eb; background: radial-gradient(circle at 30% 25%, #d9a441, #a54f31 62%, #5b2317); box-shadow: 0 8px 24px rgba(165,79,49,.28); outline: 2px solid rgba(255,248,235,.72); outline-offset: -5px; }
.brand span { font-family: "Songti SC", "SimSun", serif; color: var(--brick); letter-spacing: .18em; }
.brand b { font-size: 20px; }
nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
nav a { color: var(--ink); text-decoration: none; font-size: 14px; opacity: .82; }
nav a:hover { color: var(--brick); }

button, input, textarea, select { font: inherit; }
input, textarea, select { min-width: 0; width: 100%; }
input[type="checkbox"] { width: auto; min-width: 0; padding: 0; accent-color: var(--brick); }
button { cursor: pointer; }
.primary-btn, .secondary-btn, .ghost-btn {
  border: 0; border-radius: 999px; padding: 12px 18px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .25s ease;
}
.primary-btn { background: var(--ink); color: var(--paper-2); box-shadow: 0 12px 30px rgba(51,36,23,.25); }
.primary-btn:hover { transform: translateY(-2px); background: #16100b; }
.secondary-btn { background: var(--gold); color: #2a1d10; }
.secondary-btn:hover { transform: translateY(-2px); filter: saturate(1.1); }
.ghost-btn { color: var(--coffee); background: rgba(255,248,235,.45); border: 1px solid var(--line); }
.ghost-btn:hover { background: rgba(255,248,235,.9); }

.hero { min-height: 720px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 50px; align-items: center; padding: 64px clamp(20px, 7vw, 100px) 34px; }
.eyebrow { color: var(--brick); letter-spacing: .2em; text-transform: uppercase; font-size: 13px; font-weight: 700; }
h1 { font-size: clamp(44px, 6vw, 86px); line-height: 1.04; margin: 8px 0 22px; letter-spacing: -.05em; }
.lead { font-size: 18px; line-height: 1.9; color: var(--muted); max-width: 720px; }
.hero-actions { display: flex; gap: 14px; margin-top: 34px; flex-wrap: wrap; }
.hero-visual { position: relative; min-height: 520px; }
.campus-art { position: absolute; right: 16px; bottom: 16px; width: min(560px, 92%); height: 360px; border-radius: 38px; background: linear-gradient(180deg, rgba(51,36,23,.05), rgba(51,36,23,.22)), url('assets/fzu-campus-art.png') center/cover; box-shadow: var(--shadow); border: 1px solid rgba(255,248,235,.72); overflow: hidden; }
.campus-art:after { content: '福大 · 十年'; position: absolute; left: 22px; bottom: 20px; color: #fff8eb; font-family: "STKaiti", "KaiTi", cursive; font-size: 38px; text-shadow: 0 6px 24px rgba(0,0,0,.35); }
.ticket { position: absolute; top: 25px; right: 20px; width: 320px; padding: 28px; background: rgba(255,248,235,.78); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); transform: rotate(4deg); }
.ticket span { color: var(--brick); font-weight: 900; letter-spacing: .16em; }
.ticket strong { display:block; font-size: 34px; margin: 16px 0; line-height: .95; }
.ticket em { color: var(--muted); }
.photo-stack { position: absolute; inset: 95px 0 0 20px; }
.polaroid { position: absolute; width: 260px; height: 330px; background: #fff7e8 center/cover no-repeat; border: 14px solid #fff7e8; border-bottom-width: 62px; border-radius: 8px; box-shadow: var(--shadow); display: grid; place-items: center; overflow: hidden; }
.polaroid:before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(165,79,49,.8), rgba(217,164,65,.25)), repeating-linear-gradient(45deg, transparent 0 12px, rgba(255,255,255,.25) 12px 14px); }
.polaroid.has-photo:before { background: linear-gradient(180deg, transparent 45%, rgba(51,36,23,.42)); }
.polaroid span { z-index: 1; position: absolute; bottom: -47px; font-family: "STKaiti", "KaiTi", cursive; font-size: 30px; }
.p1 { transform: rotate(-11deg); left: 20px; top: 60px; }
.p2 { transform: rotate(8deg); left: 190px; top: 8px; }
.p3 { transform: rotate(-1deg); left: 120px; top: 180px; }

.stats { margin: 0 clamp(20px, 7vw, 100px) 40px; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255,248,235,.52); border: 1px solid var(--line); border-radius: 30px; overflow: hidden; box-shadow: var(--shadow); }
.stats article { padding: 26px; border-right: 1px solid var(--line); }
.stats article:last-child { border-right: 0; }
.stats b { font-size: 38px; color: var(--brick); display: block; }
.stats span { color: var(--muted); }

.panel { margin: 52px clamp(20px, 7vw, 100px); padding: clamp(22px, 4vw, 52px); background: rgba(255,248,235,.58); border: 1px solid var(--line); border-radius: 36px; box-shadow: var(--shadow); }
.section-title { max-width: 780px; margin-bottom: 28px; }
.section-title p { color: var(--green); letter-spacing: .22em; text-transform: uppercase; font-size: 12px; font-weight: 900; }
.section-title h2 { font-size: clamp(32px, 4vw, 58px); margin: 0 0 10px; letter-spacing: -.04em; }
.section-title span { color: var(--muted); line-height: 1.8; }
.compact-title { margin-bottom: 20px; }
.leaderboard-panel { margin-top: 36px; }
.leaderboard-list { display: grid; gap: 12px; }
.leaderboard-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 20px; background: rgba(255,255,255,.42); border: 1px solid var(--line); }
.leaderboard-row .rank { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper-2); font-size: 18px; }
.leaderboard-main { min-width: 0; }
.leaderboard-main strong { display: block; font-size: 20px; color: var(--brick); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-main span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.ratio-badge { min-width: 66px; text-align: center; border-radius: 999px; padding: 8px 12px; background: rgba(165,79,49,.13); color: var(--brick); font-weight: 900; }
.empty-board { padding: 18px; border-radius: 18px; background: rgba(245,234,216,.66); color: var(--muted); text-align: center; }
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
.segmented { display: inline-flex; background: rgba(51,36,23,.08); border-radius: 999px; padding: 5px; }
.segmented button { border: 0; background: transparent; padding: 10px 16px; border-radius: 999px; color: var(--coffee); }
.segmented button.active { background: var(--ink); color: var(--paper-2); }
.soft-input, input, textarea, select { border: 1px solid var(--line); background: rgba(255, 252, 244, .86); border-radius: 16px; padding: 13px 14px; color: var(--ink); outline: none; }
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--brick); box-shadow: 0 0 0 4px rgba(165,79,49,.12); }
.upload-card { display: grid; grid-template-columns: .45fr 1fr; gap: 26px; padding: 24px; border-radius: 28px; background: rgba(255,255,255,.34); border: 1px dashed rgba(111,62,37,.32); margin-bottom: 30px; }
.upload-card h3 { margin: 0 0 10px; font-size: 26px; }
.upload-card p, .hint { color: var(--muted); line-height: 1.7; font-size: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-form textarea, .grid-form button { grid-column: 1 / -1; }
.photo-grid { columns: 4 230px; column-gap: 18px; }
.photo-card { break-inside: avoid; margin: 0 0 18px; background: #fff8ed; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(51,36,23,.12); cursor: pointer; transition: .25s ease; }
.photo-card:hover { transform: translateY(-4px) rotate(.4deg); }
.photo-img { min-height: 210px; background: linear-gradient(135deg, rgba(165,79,49,.8), rgba(61,102,82,.55)); display: grid; place-items: center; color: #fff8ed; font-size: 42px; font-family: "STKaiti", "KaiTi", cursive; }
.photo-img img { width: 100%; height: auto; display: block; }
.photo-meta { padding: 16px; }
.photo-meta h3 { margin: 0 0 8px; font-size: 20px; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.tag { border-radius: 999px; background: rgba(217,164,65,.22); color: var(--coffee); padding: 5px 10px; font-size: 12px; }
.badge { background: rgba(61,102,82,.14); color: var(--green); }

.inline-form { display: flex; gap: 12px; margin-bottom: 22px; }
.inline-form input { flex: 1; }
.topic-list { display: grid; gap: 18px; }
.topic-card { padding: 22px; border-radius: 26px; background: rgba(255,255,255,.36); border: 1px solid var(--line); }
.topic-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.topic-head h3 { margin: 0; font-size: 23px; }
.comment { margin-top: 13px; padding: 14px 16px; border-radius: 18px; background: rgba(245,234,216,.74); }
.comment b { color: var(--brick); }
.comment p { margin: 6px 0 0; line-height: 1.75; }
.comment-form { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; margin-top: 16px; align-items: center; }
.comment-form textarea { grid-column: 1 / -1; }
.checkbox { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; color: var(--muted); width: fit-content; white-space: nowrap; padding: 0 6px; }

.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 24px; align-items: stretch; }
.map-wrap { min-height: 540px; border-radius: 30px; overflow: hidden; background: radial-gradient(circle at 50% 50%, rgba(61,102,82,.34), rgba(24,47,43,.94)); border: 1px solid rgba(255,248,235,.35); box-shadow: inset 0 0 80px rgba(0,0,0,.25), var(--shadow); position: relative; }
#classmateMap { width: 100%; height: 100%; min-height: 540px; background: #243b34; }
.leaflet-container { font-family: "Songti SC", "SimSun", "STSong", serif; background: #243b34; }
.leaflet-tile { filter: sepia(.28) saturate(.78) hue-rotate(8deg) contrast(.94); }
.leaflet-control-attribution { font-size: 10px; }
.classmate-popup b { color: var(--brick); font-size: 16px; }
.origin-marker, .classmate-marker { width: 20px; height: 20px; border-radius: 50%; display: block; box-shadow: 0 0 0 8px rgba(217,164,65,.18), 0 0 28px rgba(217,164,65,.72); border: 2px solid #fff8eb; }
.origin-marker { background: #a54f31; }
.classmate-marker { background: #d9a441; }
.location-form { display: grid; gap: 12px; padding: 22px; border-radius: 28px; background: rgba(255,255,255,.35); border: 1px solid var(--line); min-width: 0; }
.location-form h3 { margin: 0; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.advanced-fields summary { cursor: pointer; color: var(--coffee); font-weight: 700; margin-bottom: 10px; }
.location-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.loc-pill { padding: 10px 14px; background: rgba(255,248,235,.64); border: 1px solid var(--line); border-radius: 999px; }

.game-dialog, .photo-dialog { border: 0; padding: 0; border-radius: 34px; width: min(760px, calc(100vw - 28px)); background: var(--paper-2); color: var(--ink); box-shadow: 0 30px 120px rgba(0,0,0,.36); }
dialog::backdrop { background: rgba(34,24,16,.55); backdrop-filter: blur(7px); }
.close-btn { position: absolute; right: 18px; top: 14px; z-index: 2; border: 0; width: 38px; height: 38px; border-radius: 50%; background: rgba(51,36,23,.1); font-size: 24px; }
.game-content { padding: 34px; text-align: center; }
.game-content h2 { font-size: 46px; margin: 0 0 18px; }
.game-photo { margin: 0 auto 18px; width: min(420px, 100%); min-height: 300px; border-radius: 24px; overflow: hidden; background: linear-gradient(135deg, var(--brick), var(--gold)); display: grid; place-items: center; color: white; }
.game-photo img { width: 100%; display: block; filter: none; transform: scale(1); }
.game-photo:not(.revealed):after { content: '猜猜我是谁'; position: absolute; inset: auto 18px 18px; padding: 10px 14px; border-radius: 999px; background: rgba(51,36,23,.72); color: #fff8eb; letter-spacing: .12em; }
.game-photo { position: relative; }
.guess-row { display: flex; justify-content: center; gap: 10px; margin: 14px 0; }
.game-result { min-height: 28px; color: var(--brick); font-weight: 900; }
.game-leaderboard-mini { margin-top: 20px; text-align: left; }
.game-leaderboard-mini h3 { margin: 0 0 10px; text-align: center; }
.leaderboard-list.mini { max-height: 190px; overflow: auto; }
.leaderboard-list.mini .leaderboard-row { grid-template-columns: 42px minmax(0, 1fr) auto; padding: 10px 12px; }
.leaderboard-list.mini .leaderboard-row .rank { width: 30px; height: 30px; font-size: 14px; }
.leaderboard-list.mini .leaderboard-main strong { font-size: 16px; }
.leaderboard-list.mini .ratio-badge { min-width: 56px; padding: 6px 10px; }
.photo-dialog { width: min(920px, calc(100vw - 28px)); }
#photoDetail { padding: 30px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
#photoDetail img { width: 100%; border-radius: 24px; }
.detail-side h2 { margin-top: 0; }
.tag-form { display: flex; gap: 8px; margin-top: 18px; }
.tag-form input { min-width: 0; flex: 1; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--paper-2); padding: 12px 18px; border-radius: 999px; z-index: 40; transition: .25s ease; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.reveal { animation: rise .7s ease both; }
.delay-1 { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .site-header { position: relative; align-items: flex-start; flex-direction: column; gap: 12px; }
  .hero, .upload-card, .map-layout, #photoDetail { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  .hero-visual { min-height: 430px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .comment-form { grid-template-columns: 1fr; }
  .map-wrap, #classmateMap { min-height: 460px; }
  .location-form { max-width: 100%; }
}
@media (max-width: 560px) {
  body { overflow-x: hidden; }
  .site-header, .panel, .stats, .hero { margin-left: 12px; margin-right: 12px; }
  .panel { padding: 18px; border-radius: 24px; }
  nav { gap: 10px; }
  nav a, nav button { font-size: 13px; }
  h1 { font-size: 42px; }
  .stats { grid-template-columns: 1fr; }
  .grid-form, .two-cols { grid-template-columns: 1fr; }
  .inline-form, .guess-row { flex-direction: column; }
  .leaderboard-row { grid-template-columns: 42px minmax(0, 1fr); }
  .ratio-badge { grid-column: 2; width: fit-content; }
  .ticket { width: 260px; right: 0; }
  .campus-art { height: 300px; width: 100%; right: 0; bottom: 0; }
  .polaroid { width: 210px; height: 280px; }
  .p2 { left: 110px; }
  .p3 { left: 65px; }
  .map-wrap, #classmateMap { min-height: 380px; }
  .game-content { padding: 26px 18px; }
  .game-content h2 { font-size: 36px; }
}
