:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  background: #f2f5fc;
  color: #1e2942;
  --ink: #1e2942;
  --muted: #5b6780;
  --border: #dde4f2;
  --primary: #4838b8;
  --teal: #126d62;
}
* { box-sizing: border-box }
body { margin: 0; min-width: 304px }
[hidden] { display: none !important }
button, input, textarea, select { font: inherit; color: inherit }
button, select, input, textarea { border: 1px solid var(--border); border-radius: 9px }
button { cursor: pointer; background: #fff; padding: 8px 13px }
button:disabled { opacity: .5; cursor: default }
button:hover:not(:disabled) { border-color: #9484d9 }
button:focus-visible, input:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #8b72dc; outline-offset: 2px }
input, textarea, select { width: 100%; padding: 9px 11px; background: #fff }
textarea { resize: vertical }
label { display: grid; gap: 6px; color: var(--muted); font-size: .86rem; font-weight: 600 }
h1,h2,p { margin: 0 }
h1 { font-size: clamp(1.55rem, 3.4vw, 2rem); line-height: 1.28 }
h2 { font-size: 1.04rem }
small { color: var(--muted) }
a { color: #6654ca }
.primary { color: white; background: var(--primary); border-color: var(--primary); font-weight: 650 }
.mono { font: .87rem "Cascadia Mono", Consolas, monospace }
.muted { color: var(--muted) }
.login { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(ellipse at 22% 18%, #514693 0, #1f244b 47%, #151b3a 90%) }
.sign-in { display: grid; gap: 16px; width: min(100%, 394px); background: white; border-radius: 24px; padding: 38px; box-shadow: 0 28px 85px #0b113866 }
.sign-in h1 { margin: 0 0 -9px }
.sign-in .emblem { margin-bottom: 7px }
.sign-in [role=alert]:empty, #player-error:empty { display: none }
[role=alert] { color: #963648; line-height: 1.55 }
.layout { display: grid; min-height: 100vh; grid-template-columns: 214px minmax(0,1fr) }
.sidebar { background: #1e2246; color: #fff; padding: 25px 15px; display: flex; flex-direction: column; gap: 29px; position: sticky; top: 0; height: 100vh }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 7px }
.brand strong { display: block; letter-spacing: .06em }
.brand small { color: #adb4d8; font-size: .75rem }
.emblem { display: grid; place-items: center; width: 40px; height: 40px; background: linear-gradient(145deg,#80f4da,#9bb2ff); border-radius: 13px; color: #272055; font-weight: 800 }
nav, .sidebar-bottom { display: grid; gap: 6px }
nav button, .sidebar-bottom button, .sidebar-bottom a { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: #d9dff8; text-align: left; padding: 11px 13px; border-radius: 9px; text-decoration: none; font-size: .92rem }
nav button[aria-current],nav button:hover,.sidebar-bottom button:hover,.sidebar-bottom a:hover { color: white; background: #ffffff18 }
nav button[aria-current] span { color: #9af1e0 }
nav span { width: 1em; color: #b8afe8 }
.sidebar-bottom { margin-top: auto }
.admin-session { padding: 5px 13px; color: #adb4d8 }
.workspace { width: 100%; max-width: 1480px; padding: clamp(16px, 3.3vw, 45px); margin: 0 auto }
.page-header { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin: 0 0 28px }
.page-header p { margin-top: 7px; color: var(--muted); font-size: .92rem }
.page-header label { min-width: 162px }
#error { background: #ffedf0; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 19px }
.metric, .panel { border: 1px solid var(--border); border-radius: 15px; background: #fff; box-shadow: 0 3px 8px #272d5706 }
.metric { padding: 19px; border-top: 3px solid #8c7bda }
.metric:nth-child(even) { border-top-color: #5abdac }
.metric strong { font-size: clamp(1.45rem,3.4vw,2.2rem); display: block; margin: 6px 0 0; font-variant-numeric: tabular-nums }
.panel { padding: 18px; margin: 0 0 18px; overflow: hidden }
.panel h2 { margin-bottom: 13px }
.chart { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 10px; background: #f6f7fd; padding: 14px; border-radius: 11px; text-align: center }
.column { display: flex; flex-direction: column; align-items: center; justify-content: end; min-height: 134px; gap: 5px; color: var(--muted); font-size: .75rem }
.bar-pair { display: flex; align-items: end; gap: 3px; height: 100px }
.bar { width: clamp(8px, 2vw, 24px); border-radius: 4px 4px 0 0; background: #7061ca }
.bar.win { background: #39a48b }
.legend { font-size: .8rem; color: var(--muted); margin-top: 9px }
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: end; margin-bottom: 17px }
.toolbar label { flex: 1 1 115px; min-width: 105px; max-width: 235px }
.toolbar .search { flex-basis: 245px }
.configuration details { border: 1px solid var(--border); border-radius: 10px; margin: 9px 0 }
.configuration summary { cursor: pointer; font-weight: 650; padding: 13px }
.config-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 12px; padding: 0 13px 14px }
.config-fields .check { min-height: 36px }
.publish { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 17px }
.publish [role=status] { color: var(--teal); font-size: .9rem }
.table-wrap { overflow: auto }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .87rem; font-variant-numeric: tabular-nums }
th { background: #f5f6fc; color: #505d79; white-space: nowrap; text-align: left; font-weight: 630 }
td,th { padding: 11px 10px; border-bottom: 1px solid #e8edf6 }
td { white-space: nowrap }
td.note { max-width: 145px; overflow: hidden; text-overflow: ellipsis }
td button { margin-right: 5px; padding: 5px 8px; font-size: .8rem }
.tag { padding: 4px 8px; border-radius: 999px; background: #edeafb; color: #4c35aa; white-space: nowrap }
.tag.ok { background: #e0f4ed; color: var(--teal) }
.tag.muted { background: #f1f1f5; color: #50566b }
.empty { padding: 34px 10px; color: var(--muted); text-align: center }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; color: var(--muted); font-size: .86rem }
.pagination div { display: flex; gap: 6px }
dialog { border: 1px solid var(--border); border-radius: 18px; padding: 24px; width: min(420px,calc(100vw - 30px)); color: var(--ink); box-shadow: 0 28px 90px #11183d43 }
dialog::backdrop { background: #19223f78 }
dialog form { display: grid; gap: 14px }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500 }
.check input { width: auto }
.dialog-actions { display: flex; gap: 8px; justify-content: end }
@media(max-width: 760px) {
  .layout { grid-template-columns: 1fr }
  .sidebar { position: static; height: auto; gap: 11px; padding: 14px 13px }
  nav { display: flex; flex-wrap: wrap }
  nav button { gap: 5px; padding: 6px 8px; font-size: .82rem }
  .sidebar-bottom { display: flex; margin-top: 0 }
  .sidebar-bottom button,.sidebar-bottom a { padding: 5px 8px }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)) }
}
@media(max-width: 430px) {
  .page-header { align-items: flex-start; flex-direction: column }
  .chart { gap: 5px; padding: 7px }
  .metric, .panel { padding: 12px }
}
