:root {
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: #30263c;
  background: #fbf7e9;
}
body { background: #fbf7e9; }
.layout { display: block; min-height: 100vh; }
.site-header { background: #fff; border-bottom: 1px solid #e5e2e8; }
.header-inner {
  max-width: 1440px; min-height: 76px; margin: auto; padding: 0 42px;
  display: flex; align-items: center; gap: 42px;
}
.brand-button { border: 0; background: none; text-align: left; cursor: pointer; }
.brand { flex-shrink: 0; padding: 0; gap: 10px; }
.brand-icon {
  width: 40px; height: 40px; border-radius: 12px 12px 12px 4px;
  display: grid; overflow: hidden; background: #fff; box-shadow: none;
}
.brand-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand strong { color: #251e2d; font-size: 16px; letter-spacing: 1px; }
.brand small { display: block; margin-top: 3px; color: #978fa1; font-size: 10px; font-weight: 400; letter-spacing: 0; }
.nav { align-self: stretch; display: flex; align-items: stretch; gap: 8px; }
.nav button {
  position: relative; display: block; padding: 0 15px; border-radius: 0;
  color: #7a757f; font-size: 13px; white-space: nowrap;
}
.nav button.active, .nav button:hover { color: #392155; background: transparent; }
.nav button.active::after {
  content: ""; position: absolute; bottom: 0; left: 15px; right: 15px;
  height: 3px; background: #e6bb49; border-radius: 3px 3px 0 0;
}
.top-actions { margin-left: auto; gap: 12px; }
.user-badge { color: #69636f; white-space: nowrap; }
.avatar-dot { background: #f8edc4; color: #5a4273; }
.main { width: 100%; margin: 0; }
.content { max-width: 1440px; margin: auto; padding: 30px 42px 80px; }
.site-footer {
  padding: 18px 15px 24px; color: #766b7d; font-size: 12px; text-align: center;
}
.site-footer a { color: #665078; text-decoration: none; }
.site-footer a:hover { color: #51356e; text-decoration: underline; text-underline-offset: 3px; }
.btn {
  padding: 11px 16px; border-radius: 9px; background: #67468f;
  color: #fff; font-weight: 700; box-shadow: none;
}
.btn:hover { background: #533875; }
.btn.secondary { background: #ebe6f1; color: #3d215e; }
.btn.secondary:hover { background: #ded6e8; }
.btn.ghost { border: 1px solid #e4e0e8; color: #625c69; background: #fff; }
.btn.danger { background: #fff0ef; color: #b75252; }
.btn.small { padding: 8px 11px; }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible {
  outline: 3px solid #946dc3; outline-offset: 3px;
}

.race-hero {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 20px; overflow: hidden; padding: 28px 32px; border-radius: 12px;
  background: #f6d97e; color: #38294b;
}
.race-hero::after {
  content: ""; position: absolute; width: 300px; height: 100px; right: 210px; top: 15px;
  border: 1px solid #ffffff1a; border-radius: 50%; transform: rotate(-20deg);
  box-shadow: 0 0 0 14px #ffffff08, 0 0 0 15px #ffffff12, 0 0 0 30px #ffffff08;
  pointer-events: none;
}
.race-hero > * { position: relative; z-index: 1; }
.hero-label, .race-kicker { color: #654680; font-size: 11px; font-weight: 600; }
.race-hero h1 { margin: 8px 0 6px; font-size: 27px; letter-spacing: 1px; }
.race-hero p { margin: 0; color: #66533e; font-size: 13px; line-height: 1.6; }
.hero-primary { background: #67468f; color: #fff; }
.hero-primary:hover { background: #533875; }
.home-summary {
  display: flex; flex-wrap: wrap; gap: 8px 30px; margin: 20px 0 26px;
}
.home-summary > div { display: flex; align-items: baseline; gap: 8px; }
.home-summary span { color: #827c89; font-size: 12px; }
.home-summary strong { color: #473956; font-size: 16px; }
.home-dashboard { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; align-items: start; }
.home-section { margin: 0 0 13px; align-items: center; }
.home-section h2 { margin: 0; font-size: 18px; color: #31293a; }
.home-section h2 span {
  display: inline-grid; place-items: center; min-width: 23px; height: 23px;
  margin-left: 4px; border-radius: 7px; background: #f7e9b5; color: #604d24;
  font: 700 11px Arial, sans-serif; vertical-align: middle;
}
.home-section > span { color: #8f8996; font-size: 11px; }
.event-list { display: grid; gap: 10px; }
.card { background: #fff; border: 1px solid #e7e4ea; border-radius: 12px; box-shadow: none; }
.event-card {
  position: relative; display: flex; align-items: stretch; gap: 19px;
  width: 100%; min-width: 0; padding: 14px; text-align: left;
  cursor: pointer; transition: border-color .16s, transform .16s;
}
.event-card:hover { border-color: #b3a1c8; transform: translateY(-2px); box-shadow: 0 8px 22px #37254b0d; }
.event-index {
  width: 73px; min-height: 78px; flex-shrink: 0; padding: 12px;
  border-radius: 8px; background: #faf2d9; color: #71562a;
  display: flex; flex-direction: column; align-items: flex-start;
}
.event-index small { font-size: 11px; }
.event-index b { margin-top: 7px; font-size: 16px; overflow-wrap: anywhere; }
.event-body { display: block; flex: 1; min-width: 0; padding: 3px 0; }
.event-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.event-type { color: #897a9b; font-size: 11px; font-weight: 700; }
.tag { border-radius: 6px; padding: 5px 8px; background: #f9edc4; color: #70531e; font-size: 11px; }
.tag.closed { background: #efeef0; color: #847f89; }
.event-name { display: block; margin: 9px 0 8px; color: #2e2638; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.event-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: #9c96a2; font-size: 11px; overflow-wrap: anywhere; }
.event-arrow { align-self: center; padding: 0 8px; color: #9285a0; font-size: 25px; }
.home-empty {
  display: flex; align-items: center; gap: 17px; min-height: 142px; padding: 24px;
}
.empty-emblem { display: grid; place-items: center; width: 55px; height: 55px; flex-shrink: 0; border-radius: 15px; color: #7b5f9c; background: #ede8f3; font-size: 23px; }
.home-empty strong { color: #443655; font-size: 14px; }
.home-empty p { margin: 7px 0 0; color: #9b94a3; font-size: 12px; }
.home-empty .btn { margin-left: auto; }
.home-side { padding-top: 0; }
.side-guide { padding: 20px; border: 1px solid #e4e1e8; border-radius: 12px; background: #fff; }
.side-guide h2 { margin: 0 0 12px; color: #3d3449; font-size: 15px; }
.side-guide p { color: #7a7382; font-size: 12px; line-height: 1.8; }
.guide-row { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid #efeef1; font-size: 12px; }
.guide-row span { color: #938d99; }
.guide-row strong { color: #584e64; font-weight: 600; }
.side-guide .guide-note { margin: 9px 0; color: #9e98a4; }
.guide-link { padding: 5px 0; border: 0; background: transparent; color: #584073; font-size: 12px; font-weight: 600; }

.page-head { align-items: center; margin-bottom: 22px; }
.page-head h1 { color: #2d2439; font-size: 26px; }
.page-head p, .note, .muted { color: #8d8694; }
.event-masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 15px;
  padding: 27px 30px; border-radius: 14px; background: #f6d97e; color: #38294b;
}
.event-masthead h1 { margin: 10px 0 8px; font-size: 27px; overflow-wrap: anywhere; }
.event-masthead p { margin: 0; color: #66533e; font-size: 12px; line-height: 1.7; }
.event-masthead .tag { flex-shrink: 0; }
.event-tabs { margin: 15px 0 22px; padding: 5px; gap: 3px; border: 1px solid #e6e2ea; border-radius: 11px; background: #fff; }
.tabs button { color: #8c8693; }
.tabs button.active { background: #f8edc9; color: #503a62; }
.event-tabs button { padding: 10px 16px; }
.metrics { margin: 0 0 18px; gap: 12px; }
.metric { min-width: 0; }
.metric-icon, .metric:nth-child(n) .metric-icon { background: #f9efce; color: #71538c; }
.metric b { color: #392d46; }
.panel { padding: 23px; }
.panel .section-title h2 { color: #372c43; }
.panel + .panel { margin-top: 18px; }
.notice { background: #f4f2f7; border-color: #e8e2ee; color: #62576f; }
.field { gap: 8px; color: #5d5567; font-weight: 600; }
.field input, .field select {
  min-width: 0; min-height: 42px; padding: 10px 12px;
  border: 1px solid #dbd7e0; border-radius: 8px;
  background-color: #fdfcfe; color: #31293a; font-weight: 400;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.field input::placeholder { color: #aba6b0; }
.field input:hover, .field select:hover { border-color: #b6adc2; }
.field input:focus, .field select:focus {
  border-color: #715493; background-color: #fff; box-shadow: 0 0 0 3px #967ab535;
}
.field select {
  appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, #80758d 50%), linear-gradient(135deg, #80758d 50%, transparent 50%);
  background-position: right 17px center, right 12px center;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.field input:disabled, .field select:disabled { background-color: #f3f2f5; color: #a19ca6; }
.form-actions { gap: 10px; }
.form-actions .btn { min-height: 41px; }
th { background: #f7f6f9; color: #8b8493; }
th, td, .list-row { border-color: #edebf0; }
.empty { color: #a49eaa; }
.empty-icon { color: #c3bace; }
.horse-card.selected, .horse-picker .horse-card:has(input:checked) { border-color: #8b6bb0; background: #f3eff8; }
.fee-board-scroll { border-color: #e3dee8; }
.fee-board { background: #e3dee8; }
.fee-board-header, .fee-board-rank { background: #f8efd3; color: #634d74; }
.fee-board-add { background: #f8f7fa; border-color: #c8bdd4; color: #866fa0; }
.fee-board-avatar.selected, .fee-library-avatar.selected { border-color: #7e5aa8; background: #f0ebf6; }
.fee-library { min-width: 0; padding: 15px; border: 1px solid #e8e4ed; border-radius: 10px; background: #f9f8fb; }
.bp-layout {
  display: grid; grid-template-columns: minmax(180px, 1fr) minmax(320px, 2.3fr) minmax(180px, 1fr);
  grid-template-rows: auto auto auto 1fr; gap: 12px; align-items: start;
  margin-top: 16px; padding: 18px; border: 1px solid #e4d19d; border-radius: 12px;
  background: #f8ebbf; color: #3d3149;
}
.bp-board { display: contents; }
.bp-status {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 4px 4px 12px; border-bottom: 1px solid #e0c989;
}
.bp-status h2 { margin: 4px 0 0; color: #38294b; font-size: 20px; }
.bp-status-kicker { color: #765a91; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.bp-status p { margin: 0; color: #a33b2f; font-size: 12px; }
.bp-countdown { display: block; margin-top: 4px; color: #67468f; font-size: 12px; }
.bp-public {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 16px;
  min-width: 0; padding: 8px 10px; border: 1px solid #e5d6a5; background: #fff9e8;
}
.bp-public > strong { flex: 0 0 auto; color: #5c4a60; font-size: 12px; }
.bp-avatars, .bp-ban-slots { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.bp-public-item { position: relative; }
.bp-public-item > img { display: block; width: 34px; height: 34px; object-fit: cover; }
.bp-public-item .bp-remove { position: absolute; right: -5px; top: -5px; min-width: 20px; width: 20px; height: 20px; padding: 0; border-radius: 50%; background: #695c77; color: white; line-height: 20px; }
.bp-squad { display: grid; gap: 12px; min-width: 0; max-height: 840px; overflow: auto; }
.bp-squad-left { grid-column: 1; grid-row: 3 / span 2; }
.bp-squad-right { grid-column: 3; grid-row: 3 / span 2; }
.bp-team { min-width: 0; padding: 12px; border: 1px solid #e0d1a7; background: #fffaf0; }
.bp-squad-right .bp-team { border-color: #e0d1a7; background: #fffaf0; }
.bp-team.is-active { border-color: #8864a8; box-shadow: inset 3px 0 #8864a8; }
.bp-team-heading { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 10px; }
.bp-team-heading > span { color: #806b96; font-size: 11px; font-weight: 700; }
.bp-team h3 { flex: 1; min-width: 0; margin: 0; color: #3d3049; font-size: 14px; overflow-wrap: anywhere; }
.bp-team-heading small { color: #67468f; font-size: 11px; white-space: nowrap; }
.bp-team-row { margin-top: 9px; }
.bp-team-row > span { display: block; margin-bottom: 5px; color: #75677a; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.bp-ban-slot { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #d5c6a2; background: #f7eed7; color: #75677a; font-size: 12px; }
.bp-ban-slot img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.8); }
.bp-ban-slot.is-active, .bp-pick-slot.is-active { border-color: #8864a8; background: #eee5f4; }
.bp-pick-slots { display: grid; gap: 5px; max-height: 330px; overflow: auto; }
.bp-pick-slot { display: flex; align-items: center; min-width: 0; min-height: 44px; border: 1px solid #e5d9bb; background: #fffdf6; }
.bp-squad-right .bp-pick-slot { background: #fffdf6; border-color: #e5d9bb; }
.bp-squad-right .bp-pick-slot.is-active { border-color: #8864a8; background: #eee5f4; }
.bp-pick-portrait { display: grid; place-items: center; flex: 0 0 42px; align-self: stretch; color: #816e91; font-size: 11px; background: #f3e8cd; }
.bp-pick-portrait img { display: block; width: 42px; height: 42px; object-fit: cover; }
.bp-pick-label { min-width: 0; padding: 0 9px; color: #7a6d7f; font-size: 12px; overflow-wrap: anywhere; }
.bp-pick-slot.is-filled .bp-pick-label, .bp-pick-slot.is-active .bp-pick-label { color: #473752; }
.bp-empty { color: #817184; font-size: 12px; }
.bp-current { grid-column: 2; grid-row: 4; min-width: 0; padding: 12px; border: 1px solid #e0cd98; background: #fff8e4; }
.bp-current-heading { display: flex; justify-content: space-between; gap: 10px; color: #594171; font-size: 13px; }
.bp-current-heading > span { color: #7b6c71; font-size: 11px; }
.bp-drop { display: flex; align-items: center; gap: 12px; min-height: 68px; margin: 10px 0; padding: 8px; border: 1px dashed #b6a58e; color: #6f6072; background: #fffdf6; font-size: 12px; transition: border-color .15s, background .15s; }
.bp-drop.drag-over { border-color: #8864a8; background: #f3eaf7; }
.bp-draft-image { width: 50px; height: 50px; object-fit: cover; }
.bp-draft-image[hidden] { display: none; }
.bp-waiting { display: grid; place-items: center; min-height: 74px; color: #786779; font-size: 13px; }
.bp-library { grid-column: 2; grid-row: 3; min-width: 0; padding: 12px; border: 1px solid #e0cd98; background: #fffaf0; }
.bp-library .section-title h2 { margin: 0; color: #3d3049; font-size: 15px; }
.bp-library .section-title > span, .bp-library .field, .bp-library .note { color: #756877; }
.bp-library .field { font-size: 12px; }
.bp-library .note { margin: 8px 0 0; font-size: 11px; line-height: 1.5; }
.bp-library-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 5px; max-height: clamp(180px, 25vh, 280px); overflow: auto; margin-top: 10px; }
.bp-library-avatar { padding: 2px; min-width: 0; aspect-ratio: 1; background: #f2e7ca; border: 2px solid transparent; cursor: grab; }
.bp-library-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bp-library-avatar.selected { border-color: #8864a8; background: #8864a8; }
.bp-library-avatar:disabled { cursor: not-allowed; }
.bp-library-avatar.is-used { background: #353139; border-color: #353139; }
.bp-library-avatar.is-used img { filter: grayscale(1) brightness(.75); }
.bp-library-avatar[hidden] { display: none; }
.bp-library-avatar:focus-visible { outline: 2px solid #8864a8; outline-offset: 2px; }
.bp-layout.is-setup { grid-template-columns: minmax(0, 1fr); }
.bp-layout.is-setup .bp-current, .bp-layout.is-setup .bp-library { grid-column: 1; }
.bp-layout.is-setup .bp-squad { display: none; }
@media (max-width: 900px) {
  .bp-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; padding: 12px; }
  .bp-status, .bp-public, .bp-current, .bp-library, .bp-squad-left, .bp-squad-right { grid-column: 1; }
  .bp-status { grid-row: 1; }
  .bp-public { grid-row: 2; }
  .bp-library { grid-row: 3; }
  .bp-current { grid-row: 4; }
  .bp-squad-left { grid-row: 5; }
  .bp-squad-right { grid-row: 6; }
  .bp-squad { max-height: none; overflow: visible; }
  .bp-library-list { max-height: 260px; }
}
.overlay { padding: 20px; background: #1d1328a8; }
.modal {
  width: min(460px, 100%); max-height: calc(100vh - 40px);
  overflow: auto; padding: 28px; border: 1px solid #e9e5ed; border-radius: 14px;
  background: #fff; box-shadow: 0 24px 70px #1e142a50;
}
.modal-create { width: min(560px, 100%); }
.modal-top { align-items: flex-start; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid #edebef; }
.modal-heading { display: flex; align-items: flex-start; gap: 13px; min-width: 0; }
.modal-icon {
  display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px;
  border-radius: 10px; background: #ede9f2; color: #624b7d; font-size: 21px;
}
.modal h2 { margin: 0; color: #342941; font-size: 19px; line-height: 1.4; }
.modal-heading .note { margin: 5px 0 0; }
.close {
  display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: 8px; color: #8c8594; font-size: 23px; line-height: 1;
}
.close:hover { border-color: #e7e3eb; background: #f4f3f6; color: #463758; }
.modal .form-grid { margin-top: 21px; gap: 15px; }
.modal-auth .form-grid { grid-template-columns: 1fr; }
.modal form > .note { margin: 11px 0 0; }
.modal .form-actions { margin-top: 22px; }
.modal-auth .form-actions .btn { flex: 1; }
.modal-create .form-actions { justify-content: flex-end; }
.modal-create .form-actions .btn { min-width: 120px; }
.modal .notice { margin: 18px 0 0; padding: 15px; border-radius: 9px; }
.modal .notice p { margin: 8px 0; }
.modal .notice .field { margin-top: 13px; }
.modal .notice + .form-grid { margin-top: 18px; }
.privacy-consent { align-items: flex-start; gap: 9px; color: #7b7483; }
.privacy-consent input { flex-shrink: 0; width: 16px; height: 16px; margin: 2px 0 0; accent-color: #5a3c7c; }
.privacy-consent a { color: #503273; text-decoration: underline; text-underline-offset: 2px; }
.privacy-consent input:focus-visible { outline: 2px solid #946dc3; outline-offset: 2px; }
.confirm-dialog { width: min(440px, calc(100% - 30px)); margin: auto; }
.confirm-dialog::backdrop { background: #1d1328a8; }
.confirm-heading { display: flex; align-items: flex-start; gap: 14px; }
.confirm-heading > div { min-width: 0; }
.confirm-icon {
  display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px;
  border-radius: 10px; background: #ede9f2; color: #624b7d; font-size: 19px; font-weight: 700;
}
.confirm-destructive .confirm-icon { background: #fbefec; color: #bd6255; }
.confirm-heading h2 { margin: 0 0 8px; }
.confirm-heading p { margin: 0; color: #736b7c; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.confirm-actions .btn { min-width: 84px; min-height: 40px; }
.confirm-actions .btn.ghost:hover { background: #f3f2f5; color: #473a55; }
.confirm-destructive .confirm-submit { background: #bd574d; color: #fff; }
.confirm-destructive .confirm-submit:hover { background: #a9473e; }
#toast { background: #352647; }

@media (max-width: 900px) {
  .header-inner { padding: 0 22px; gap: 18px; }
  .brand div:not(.brand-icon) { display: block; }
  .nav button { padding: 0 10px; }
  .nav button.active::after { left: 10px; right: 10px; }
  .content { padding: 24px 22px 60px; }
  .home-dashboard { grid-template-columns: minmax(0, 1fr) 245px; gap: 16px; }
}
@media (max-width: 650px) {
  .header-inner { min-height: 0; padding: 13px 15px 0; gap: 0; flex-wrap: wrap; }
  .brand { padding: 0; }
  .brand-icon { width: 36px; height: 36px; }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 9px; }
  .top-actions { order: 2; }
  .nav { order: 3; width: 100%; overflow-x: auto; margin-top: 8px; }
  .nav button { min-height: 43px; padding: 0 15px; }
  .nav button.active::after { left: 15px; right: 15px; }
  .user-badge { display: none; }
  .content { padding: 16px 15px 50px; }
  .race-hero { padding: 22px 19px; flex-wrap: wrap; }
  .race-hero::after { right: -120px; }
  .race-hero h1 { font-size: 24px; }
  .home-summary { gap: 8px 20px; margin: 17px 0 24px; }
  .home-dashboard { display: block; }
  .home-section > span { display: none; }
  .home-side { margin-top: 20px; }
  .side-guide { padding: 20px; }
  .event-card { gap: 11px; padding: 10px; }
  .event-index { width: 59px; min-height: 76px; padding: 10px; }
  .event-index b { font-size: 14px; }
  .event-arrow { padding: 0 2px; }
  .home-empty { flex-wrap: wrap; padding: 20px; }
  .home-empty .btn { margin-left: 72px; }
  .event-masthead { padding: 22px 18px; align-items: flex-start; }
  .event-masthead h1 { font-size: 22px; }
  .event-tabs button { padding: 9px; }
  .panel { padding: 17px; }
  .field input, .field select { font-size: 16px; }
  .overlay { padding: 15px; }
  .modal { max-height: calc(100vh - 30px); padding: 22px; }
  .modal-create .form-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .event-card, .field input, .field select { transition: none; }
}
@media (forced-colors: active) {
  .field select { appearance: auto; background-image: none; }
}
