@font-face {
  font-family: "Qingshan Motto";
  src: url("/guild-motto.woff2") format("woff2");
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}

:root {
  font: 16px/1.5 system-ui, "Microsoft YaHei", sans-serif;
  color: #202d2b;
  background: #eef3ef;
  color-scheme: light;
  --paper: #fffffd;
  --muted: #4d635a;
  --line: #d7e3dc;
  --green: #16634b;
  --attack: #974c35;
  --defense: #285978;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding: clamp(8px, 3vw, 30px); }
body::before { content: ""; position: fixed; inset: 0; background: linear-gradient(#ecf8f22b,#e2f3e85c), url("/river-valley.webp") center / cover no-repeat; pointer-events: none; }
[hidden] { display: none !important; }
.shell { position: relative; max-width: 1100px; margin: auto; background: #f4fbf2e6; border: 1px solid #f7fff2bf; border-radius: 20px; overflow: hidden; box-shadow: 0 20px 60px #2149383b; }
.hero { position: relative; display: flex; align-items: end; aspect-ratio: 3 / 1; overflow: hidden; background: #527f76; border-bottom: 1px solid #83ad8c; }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hero-copy { position: relative; width: 100%; padding: 2.8rem clamp(14px,4vw,38px) clamp(12px,2vw,22px); color: #fffefa; background: linear-gradient(0deg,#142c2be8,transparent); }
.hero h1 { margin: 0; font-size: clamp(1.3rem,3vw,2.35rem); line-height: 1.2; letter-spacing: .06em; }
.guild-motto { margin: .16rem 0 0; color: #fff5d9; font: 400 clamp(1.15rem,3vw,1.85rem)/1.35 "Qingshan Motto", "STKaiti", "KaiTi", serif; letter-spacing: .09em; text-shadow: 0 1px 5px #0c242b; }
.is-admin .hero { aspect-ratio: auto; min-height: 68px; }
.is-admin .hero-art { object-position: center 35%; }
.is-admin .hero-copy { display: flex; align-items: center; justify-content: space-between; gap: .65rem; min-height: 68px; padding: .66rem clamp(14px,3vw,28px); background: linear-gradient(90deg,#142c2bed,#142c2b90); }
.is-admin .hero h1 { font-size: clamp(1rem,2.5vw,1.45rem); }
.is-admin .guild-motto,.is-admin .hero-petals { display: none; }
.hero-petals { display: none; position: absolute; inset: 0; pointer-events: none; }
.hero-petals i { position: absolute; top: 2%; left: 4%; width: 12px; height: 7px; border-radius: 0 88% 0 88%; background: #d7eb95; box-shadow: 0 0 7px #263e2855; opacity: 0; --drift: 62px; --fall: 90px; animation: leaf-fall 3.6s .16s ease-out both; }
.hero-petals i:nth-child(2) { left: 10%; top: 7%; width: 8px; height: 6px; background: #fffaec; --drift: -35px; --fall: 88px; animation-delay: .63s; }
.hero-petals i:nth-child(3) { left: 94%; top: 8%; --drift: -58px; --fall: 112px; animation-delay: .48s; }
.hero-petals i:nth-child(4) { left: 91%; top: 3%; width: 9px; height: 6px; background: #fffaec; --drift: 42px; --fall: 110px; animation-delay: .95s; }
#event-time { margin: .3rem 0 0; font-size: .9rem; color: #f2fff6; font-weight: 550; }
.content { padding: clamp(14px, 4vw, 30px); }
.bar, .actions, .summary { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.bar { padding: .75rem clamp(14px, 4vw, 30px); border-bottom: 1px solid var(--line); background: #f5faf6; }
.bar .identity { overflow-wrap: anywhere; }
.summary { justify-content: space-between; }
.stack { display: grid; gap: .85rem; }
.panel { background: var(--paper); border: 1px solid var(--line); padding: clamp(1rem,3vw,1.45rem); border-radius: 14px; box-shadow: 0 4px 18px #28493808; }
.narrow { max-width: 520px; }
h2, h3, p { margin: 0 0 .55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.badge { display: inline-block; padding: .25rem .55rem; border-radius: .55rem; background: #e7f5ed; font-size: .9rem; }
.job { background: color-mix(in srgb, var(--job) 18%, var(--paper)); }
.notice { padding: .75rem 1rem; }
#notice { position: sticky; bottom: 0; padding: .75rem 1rem; margin: 0; background: #dfeee4; border-top: 1px solid #bfd6c7; overflow-wrap: anywhere; }
#notice.error { background: #fae9e3; color: #8a3521; }
#notice button { margin-inline-start: .75rem; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, .button { min-height: 44px; padding: .46rem .75rem; color: inherit; background: var(--paper); border: 1px solid #b9cbbf; border-radius: .6rem; }
button, .button { cursor: pointer; }
.button { display: inline-flex; align-items: center; text-decoration: none; }
button[aria-pressed="true"] { color: #174d37; border-color: #82ac92; background: #e6f1e9; }
button.primary { background: var(--green); border-color: var(--green); color: white; font-weight: 700; box-shadow: 0 3px 0 #0e4635; }
button:disabled { cursor: wait; opacity: .55; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
label { display: grid; gap: .32rem; min-width: 0; }
input, textarea, select { width: 100%; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%, 168px),1fr)); gap: .8rem; }
.event-list { padding-left: 0; list-style: none; }
.event-list li + li { margin-top: .4rem; }
.grid-scroll { overflow-x: auto; padding: .15rem; }
table { width: 100%; min-width: 690px; table-layout: fixed; border-spacing: 5px; }
th, td { text-align: left; padding: .5rem; font-size: .9rem; overflow-wrap: anywhere; }
th { background: #edf5ee; border-radius: .5rem; }
th:first-child { position: sticky; left: 0; z-index: 1; width: 52px; text-align: center; }
td { height: 66px; padding: 0; }
.seat, button.seat { display: grid; align-content: center; width: 100%; min-height: 66px; padding: .45rem; border: 1px solid var(--line); border-radius: .5rem; background: #f6f8f5; text-align: left; overflow-wrap: anywhere; }
.seat.filled { background: color-mix(in srgb,var(--job) 16%,var(--paper)); border-color: color-mix(in srgb,var(--job) 44%,var(--paper)); }
.seat.mine { outline: 2px solid var(--green); outline-offset: -2px; }
.seat small, th small { display: block; font-size: .78rem; color: var(--muted); font-weight: 400; }
.seat strong { font-size: .99rem; line-height: 1.3; }
.seat-mark { width: fit-content; margin-top: .22rem; padding: 0 .28rem; border-radius: .28rem; background: #ffffffc9; font-size: .69rem; font-weight: 700; }
dialog { width: min(550px,calc(100% - 24px)); max-height: calc(100% - 32px); padding: 1.2rem; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
dialog::backdrop { background: #20392f55; }
dialog [role="alert"] { color: #8a3521; }
.seat:focus { outline: 2px solid var(--green); outline-offset: 2px; }
.member-list { display: grid; gap: .5rem; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.member-row strong { overflow-wrap: anywhere; }

.nav-tabs,.nav-person { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.nav-person { margin-left: auto; }
.nav-tabs button,.quiet { border-color: transparent; background: transparent; }
.nav-tabs button { font-weight: 650; }
.nav-tabs button[aria-pressed="true"] { background: #dcefe5; border-color: #aad0ba; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px; background: #def0e5; color: #1a5840; font-weight: 800; }
.page-heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: .75rem; }
.page-heading h2 { position: relative; margin: 0; padding-left: .75rem; font-size: clamp(1.4rem,4vw,1.85rem); line-height: 1.25; letter-spacing: .035em; }
.page-heading h2::before { content: ""; position: absolute; inset: 12% auto 12% 0; width: 4px; background: #508b6e; border-radius: 2px; }
.event-picker { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; color: var(--muted); font-size: .88rem; }
.event-picker select { width: auto; max-width: min(100%,340px); color: #20392f; }
.event-sheet,.roster-board,.member-board { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.event-masthead { padding: clamp(16px,3vw,26px); border-bottom: 1px solid var(--line); background: linear-gradient(110deg,#e6f5eb,#f9fcf8 70%); }
.event-masthead h3 { margin: 0; font-size: clamp(1.2rem,3.5vw,1.65rem); overflow-wrap: anywhere; }
.event-timing,.choice-recap,.roster-stats { display: grid; margin: 0; }
.event-timing { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: .85rem; gap: .7rem; }
.event-timing dt,.choice-recap dt,.roster-stats dt { color: var(--muted); font-size: .82rem; }
.event-timing dd,.choice-recap dd,.roster-stats dd { margin: .2rem 0 0; font-weight: 650; }
.signup-form { padding: clamp(16px,3vw,26px); }
.team-picker { min-width: 0; padding: 0; margin: 0; border: 0; }
.team-picker legend { padding: 0; margin-bottom: .42rem; }
.team-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .62rem; }
.team-choice { --team-color: var(--attack); --team-bg: #fff7ed; position: relative; align-content: start; padding: .64rem .65rem; gap: .35rem; border: 1px solid #e2c2aa; border-radius: .7rem; background: var(--team-bg); color: var(--team-color); cursor: pointer; }
.team-choice[data-team="1"] { --team-color: var(--defense); --team-bg: #eff8fc; border-color: #b4d2dd; }
.team-choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.team-choice:has(input:focus-visible) { outline: 2px solid var(--team-color); outline-offset: 2px; }
.team-choice:has(input:checked) { border-color: var(--team-color); box-shadow: inset 0 0 0 1px var(--team-color); }
.team-choice-title { display: flex; justify-content: space-between; align-items: center; font-weight: 800; }
.team-check { display: inline-grid; place-items: center; width: 1.22rem; height: 1.22rem; border-radius: 50%; color: #fff; background: var(--team-color); opacity: 0; }
.team-choice:has(input:checked) .team-check { opacity: 1; }
.team-capacity { display: flex; flex-wrap: wrap; gap: .15rem .65rem; color: #3f544e; font-size: .78rem; }
.team-capacity span { white-space: nowrap; }
.team-heal-capacity { display: none; }
.needs-healing .team-heal-capacity { display: inline; }
.needs-healing .team-heal { color: var(--team-color); font-weight: 800; text-decoration: underline; text-underline-offset: .16em; }
.team-hint { margin: .55rem 0 0; color: #73501d; font-size: .87rem; }
.signup-result,.member-match { display: grid; gap: .24rem; overflow-wrap: anywhere; border-radius: .65rem; padding: .66rem .85rem; background: #edf6f0; border: 1px solid #c8dfd1; }
.signup-result strong { font-size: clamp(1.1rem,3vw,1.45rem); }
.signup-result .badge { width: fit-content; }
.signup-result.waiting { background: #fff6e4; border-color: #e8d0a4; color: #754b21; }
.member-match span { font-size: .87rem; color: var(--muted); }
.signup-actions { padding-top: .2rem; }
.signup-actions .primary { min-width: 7.5rem; }
.badge.positive { background: #dbf2e5; color: #145638; }
.badge.pending { background: #f9eddf; color: #78471f; }
.roster-stats { grid-template-columns: repeat(3,minmax(0,1fr)); gap: .6rem; }
.roster-stats > div { background: #eef7f0; border: 1px solid var(--line); border-top: 3px solid #7bae91; border-radius: 9px; padding: .65rem .8rem; }
.roster-stats > div:nth-child(2) { background: #fcf3f7; border-top-color: #cc8fa8; }
.roster-stats > div:nth-child(3) { background: #fdf7ed; border-top-color: #c8a36a; }
.roster-stats dd { font-size: clamp(1.3rem,4vw,1.8rem); font-variant-numeric: tabular-nums; }
.roster-stats small { font-size: .78rem; color: var(--muted); }
.board-toolbar { display: flex; justify-content: space-between; align-items: center; gap: .65rem; flex-wrap: wrap; padding: .7rem; border-bottom: 1px solid var(--line); }
.roster-tools,.roster-options { justify-content: flex-start; }
.roster-tools .actions { margin-inline-start: auto; }
.roster-options label { display: flex; flex-wrap: wrap; align-items: center; }
.roster-options select { width: auto; }
.roster-details { padding: .65rem .9rem; }
.roster-details summary { font-weight: 700; cursor: pointer; }
.roster-details[open] summary { margin-bottom: .65rem; }
.roster-details .actions button { min-height: 36px; }
.move-guide { margin: 0; padding: .42rem .7rem; color: var(--muted); font-size: .85rem; background: #f3f8f5; }
.seat[draggable="true"] { cursor: grab; }
.roster-board .seat.move-source { outline: 2px solid var(--green); outline-offset: -2px; }
.roster-board .seat.move-available { outline: 2px solid #607e65; outline-offset: -2px; }
.roster-board .seat.move-blocked { outline: 2px dashed #a5543a; outline-offset: -2px; }
.team-tabs { display: flex; gap: .3rem; padding: .25rem; background: #eef5f1; border-radius: 8px; }
.team-tabs button { border-color: transparent; background: transparent; font-weight: 650; min-height: 40px; }
.team-tabs button[aria-pressed="true"] { background: #f5e4da; border-color: #e4beaa; color: var(--attack); }
.roster-board[data-side="1"] .team-tabs button[aria-pressed="true"] { background: #e1eeff; border-color: #bacfea; color: var(--defense); }
.roster-board .grid-scroll { padding: .35rem; background: #fffefa; }
.mobile-quick { display: none; }
.roster-lookup .actions { align-items: end; }
.roster-lookup label { flex: 1 1 12rem; min-width: 0; }
.lookup-result { margin: .65rem 0 0; font-weight: 700; overflow-wrap: anywhere; }
.squad-view { padding: .8rem; }
.squad-view ol { display: grid; list-style: none; padding: 0; margin: 0; gap: .35rem; }
.squad-view li { display: grid; grid-template-columns: 2rem minmax(0,1fr); align-items: center; }
.squad-view .seat { min-height: 48px; }
.seat.located { outline: 2px solid #925617; outline-offset: -2px; }
.roster-board th { background: #f4eee7; }
.roster-board[data-side="1"] th { background: #ecf3fa; }
.seat.filled { box-shadow: inset 3px 0 var(--job); padding-left: .65rem; }
.seat:hover:where(button) { border-color: #6a927d; }
.waitlist h3,.member-heading h3,.profile-identity h3 { margin: 0; }
.waitlist ol { padding-left: 1.55rem; }
.waitlist li { padding: .4rem 0; }
.profile-identity { display: flex; align-items: center; gap: .7rem; min-width: 0; overflow-wrap: anywhere; }
.profile-identity .avatar { width: 40px; height: 40px; }
.member-heading { background: #edf6ef; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.member-list { gap: 0; padding: 0 1rem; }
.member-row:last-child { border: 0; }
.member-row p { margin: .2rem 0 0; }
.empty { padding-block: 2rem; }
dialog > .summary { padding-bottom: .8rem; margin-bottom: .8rem; border-bottom: 1px solid var(--line); }

.is-auth form.narrow { width: 100%; margin-inline: auto; }
.is-auth #app .panel { border-color: #d0e2d6; }
.is-auth button[type="submit"] { width: 100%; }
.is-auth .panel h2 { margin: 0; font-size: 1.55rem; }
@media (max-width: 600px) {
  body { padding: 8px; }
  body::before { background-position: 58% center; }
  .shell { border-radius: 14px; }
  .hero { aspect-ratio: 2 / 1; }
  .hero-copy { padding-top: 1.85rem; }
  #event-time { font-size: .78rem; }
  .mobile-quick { display: grid; gap: .45rem; padding: .55rem .65rem; background: #f5faf6; border-bottom: 1px solid var(--line); }
  .bar { padding: .4rem .5rem; }
  .nav-tabs { flex: 1 1 auto; }
  .nav-tabs button { flex: 1 1 auto; padding-inline: .3rem; font-size: .88rem; }
  .nav-person:has(.identity) { width: 100%; }
  .nav-person .quiet { margin-left: auto; padding-inline: .45rem; font-size: .88rem; }
  .hero-petals i:first-child,.hero-petals i:last-child { display: none; }
  .team-capacity { display: grid; }
  .roster-stats { gap: .32rem; }
  .roster-stats > div { padding: .45rem .5rem; }
  .board-toolbar { padding: .5rem; }
  .roster-tools .actions { margin-inline-start: 0; }
  .signup-actions .primary { flex: 1 1 7.5rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-petals { display: block; }
  .hero-copy,.signup-result,.member-match.appear { animation: appear 210ms ease-out both; }
  .team-choice,.team-check { transition: border-color 180ms, box-shadow 180ms, opacity 180ms; }
  .seat.located { animation: seat-glow 650ms ease-out; }
}
@keyframes appear {
  from { opacity: .35; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes leaf-fall {
  0% { opacity: 0; transform: translate(0,0) rotate(-30deg); }
  18% { opacity: .9; }
  78% { opacity: .7; }
  100% { opacity: 0; transform: translate(var(--drift),var(--fall)) rotate(155deg); }
}
@keyframes seat-glow {
  from { background: #f9e3b0; }
}
