:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f4f5fb;
  color: #1b2035;
  --accent: #5a46d4;
  --muted: #626982;
  --line: #e3e5f0;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
a { color: var(--accent); }
button {
  border: 1px solid transparent; border-radius: 9px; padding: .66rem 1rem;
  background: var(--accent); color: white; cursor: pointer; font-weight: 650;
}
button:hover { filter: brightness(.93); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #927fff; outline-offset: 2px; }
.secondary { background: #f0edff; color: #4937ac; border-color: #e4defd; }
.dashboard { display: grid; grid-template-columns: 230px minmax(0,1fr); min-height: 100vh; }
aside {
  display: flex; flex-direction: column; gap: 38px; padding: 30px 18px;
  background: #17172d; color: #fff;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; color: inherit; text-decoration: none; }
.brand small { display: block; color: #b6b5d2; font-weight: 450; margin-top: 4px; }
.mark { display: inline-grid; place-items: center; width: 39px; height: 39px; background: #7058ed; color: #fff; border-radius: 12px; font-size: 24px; flex-shrink: 0; }
nav { display: grid; gap: 8px; }
nav button { text-align: left; background: transparent; color: #d1d0e6; }
nav button span { margin-left: 8px; }
nav button[aria-current=page] { background: #3b315f; color: white; }
.preview { margin-top: auto; color: #ded9ff; text-decoration: none; padding: 10px; }
.dashboard main { padding: 35px clamp(20px, 4vw, 58px); width: 100%; max-width: 1500px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h1 { font-size: clamp(25px, 3vw, 36px); margin: 0; letter-spacing: -.035em; }
h2 { font-size: 18px; margin: 0 0 17px; }
p { color: var(--muted); line-height: 1.55; }
#status { margin: 8px 0; color: #513bad; min-height: 1.5em; }
.stats, .cards { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4,minmax(0,1fr)); margin: 0 0 20px; }
.cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
article, section { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 21px; }
article span { color: var(--muted); font-size: 14px; }
article strong { display: block; font-size: 32px; margin-top: 7px; }
section + section { margin-top: 16px; }
.cards section + section { margin-top: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: 14px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); }
th { background: #f5f5fc; color: #555b75; }
tbody tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 26px; }
form, label { display: grid; gap: 8px; }
form { gap: 14px; }
label { font-size: 14px; font-weight: 600; }
input, textarea, select { border: 1px solid #d6d9ea; border-radius: 8px; padding: 9px 10px; background: white; color: inherit; width: 100%; }
textarea { resize: vertical; min-height: 65px; }
.check { display: flex; align-items: center; }
.check input { width: auto; accent-color: var(--accent); }
.actions, .game-links { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.card-preview { background: #f5f2ff; padding: 12px; border-radius: 10px; display: grid; gap: 5px; }
.card-preview small, .card-preview span { color: var(--muted); }
.arcade { min-height: 100vh; background: radial-gradient(ellipse at top, #e7e0ff, #f4f5fb 70%); }
.arcade main { max-width: 600px; margin: auto; padding: 25px 16px; }
.arcade .brand { justify-content: center; }
.hero { text-align: center; padding: 32px 20px; }
.hero > .game-icon { margin: 0 auto 16px; width: 76px; height: 76px; font-size: 36px; }
.game-icon { display: grid; place-items: center; flex-shrink: 0; width: 43px; height: 43px; background: #eeebff; border-radius: 12px; font-size: 22px; }
.game-links { justify-content: center; margin: 15px 0; }
.catalog { display: grid; gap: 10px; margin: 15px 0; }
.game-card { display: flex; align-items: center; gap: 13px; width: 100%; background: #f7f5ff; color: #242044; text-decoration: none; text-align: left; border: 1px solid #e6e0fc; border-radius: 12px; padding: 12px; cursor: pointer; }
.game-card strong, .game-card small { display: block; }
.game-card small { margin-top: 4px; color: var(--muted); font-weight: 400; }
.game-card span:last-child { margin-left: auto; }
.tap { width: min(100%,260px); height: 150px; touch-action: manipulation; }
.number-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; max-width: 300px; margin: auto; }
.number-grid button { aspect-ratio: 1; font-size: 25px; }
.result-score { font-size: 74px; color: var(--accent); font-weight: 800; line-height: 1; margin-top: 17px; }
.ranking { margin: 15px 0; padding: 0; }
.ranking li { display: flex; justify-content: space-between; gap: 12px; padding: 11px; border-bottom: 1px solid var(--line); }
.ranking .mine { background: #f0edff; border-radius: 8px; }
@media(max-width: 760px) {
  .dashboard { display: block; }
  aside { padding: 14px; gap: 12px; }
  nav { display: flex; flex-wrap: wrap; gap: 4px; }
  nav button { padding: 7px; font-size: 13px; }
  .preview { padding: 4px; }
  .dashboard main { padding: 20px 14px; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cards { grid-template-columns: 1fr; }
}
.dashboard main { background: linear-gradient(150deg,#f3efff 0,#f4f5fb 320px); }
.dashboard header { margin-bottom: 12px; }
.stats article { box-shadow: 0 5px 18px #2d22570a; }
.stat-icon { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 12px; border-radius: 9px; background: #efe9ff; color: #523ab8; font-weight: 800; }
.stats article:nth-child(2) .stat-icon { background: #e5eefc; color: #2d55a5; }
.stats article:nth-child(3) .stat-icon { background: #dcf5ec; color: #1c7156; }
.stats article:nth-child(4) .stat-icon { background: #fce8de; color: #a64327; }
.sidebar-footer { display: grid; gap: 8px; margin-top: auto; }
.sidebar-footer button { text-align: left; background: #25253e; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 18% 20%, #ded4ff, transparent 53%), #f5f4fc; }
.login-layout { display: grid; grid-template-columns: 1.1fr 1fr; width: min(920px,100%); overflow: hidden; border: 1px solid #e2dcf3; border-radius: 24px; background: white; box-shadow: 0 24px 75px #28195b21; }
.login-brand { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: 95px; min-height: 400px; overflow: hidden; padding: clamp(24px,5vw,48px); background: linear-gradient(148deg,#19152f,#3f2d80); color: white; }
.login-brand p { color: #dbd4f3; margin-bottom: 0; }
.orbit { pointer-events: none; position: absolute; z-index: -1; width: 250px; height: 250px; right: -35px; top: 22px; display: grid; place-items: center; border: 1px solid #aa96ff55; border-radius: 50%; transform: rotate(-24deg); box-shadow: inset 0 0 0 30px #a38afa10, inset 0 0 0 62px #a38afa12; }
.orbit span { font-size: 110px; line-height: 1; color: #bfaaff66; }
.login-form { display: flex; flex-direction: column; justify-content: center; border: 0; padding: clamp(24px,5vw,48px); }
.login-form h2 { font-size: 25px; }
.login-form button { margin-top: 6px; }
@media(max-width: 620px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 210px; gap: 26px; }
  .orbit { width: 190px; height: 190px; }
  .sidebar-footer { grid-template-columns: 1fr auto; }
}
/* Operations workspace */
.dashboard { --accent: #5542cb; --line: #e5e5ef; }
.dashboard aside { position: sticky; top: 0; height: 100dvh; gap: 32px; }
.dashboard .brand { padding: 0 7px; }
.dashboard main { min-width: 0; }
.dashboard header p { margin-bottom: 0; }
.dashboard header > button { align-self: flex-start; }
.dashboard section { box-shadow: 0 6px 22px #27204808; }
.dashboard th { font-weight: 650; }
.dashboard #status:empty { min-height: 0; margin: 0 0 18px; }
.dashboard #status:not(:empty) {
  background: #efebff; color: #48339e; border: 1px solid #ded5ff;
  border-radius: 9px; padding: 8px 12px; margin: 0 0 16px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.list-panel { padding: 0; overflow: hidden; }
.list-toolbar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding: 16px 20px; }
.search-field { flex: 1 1 230px; }
.list-toolbar .add-game { margin-left: auto; white-space: nowrap; }
.list-panel th:first-child, .list-panel td:first-child { padding-left: 20px; }
.list-panel th:last-child, .list-panel td:last-child { padding-right: 20px; }
.list-footer { padding: 13px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.game-cell { display: flex; align-items: center; gap: 12px; }
.game-cell strong, .game-cell code, .game-cell small { display: block; }
.game-cell code, .game-cell small { color: var(--muted); margin-top: 3px; }
.game-icon { overflow: hidden; }
.game-icon img { width: 100%; height: 100%; object-fit: cover; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: #565e72; background: #eff0f4; padding: 4px 9px; border-radius: 999px; }
.state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state.live { color: #176547; background: #e4f5ee; }
.row-actions { display: flex; align-items: center; gap: 10px; }
.row-actions button { padding: 6px 10px; font-size: 13px; }
.row-actions a { font-size: 13px; text-decoration: none; }
.text-button { background: transparent; color: var(--accent); padding: 7px 9px; }
.empty-state { padding: 44px 18px; text-align: center; }
.empty-state p { margin: 5px 0 0; }
.panel-heading { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 20px; }
.panel-heading h2, .panel-heading p { margin: 0; }
.panel-heading p { margin-top: 6px; }
.panel-heading label { min-width: min(190px, 100%); }
.promotion-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.promotion-layout h3 { font-size: 14px; margin: 0 0 8px; }
.promotion-layout .card-preview { background: #f4f0ff; border: 1px solid #e5dcfd; padding: 14px; }
#workspace-dialog { border: 1px solid #e2deee; border-radius: 18px; padding: 0; width: min(550px,calc(100% - 28px)); max-height: calc(100dvh - 32px); color: inherit; box-shadow: 0 24px 70px #19133549; }
#workspace-dialog::backdrop { background: #17152d85; }
.dialog-inner { padding: 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; font-size: 21px; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; font-size: 24px; background: #f1eff8; color: #4c426b; }
.dialog-inner > label + label { margin-top: 12px; }
.dialog-message { margin: 12px 0 0; color: #5038a6; font-size: 14px; }
.dialog-message:empty { display: none; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: end; margin-top: 8px; }
.dialog-inner > .dialog-actions { margin-top: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.icon-upload { display: flex; align-items: center; gap: 15px; padding: 13px; border: 1px dashed #d9d2ec; border-radius: 12px; background: #faf8ff; }
.icon-upload .game-icon { width: 64px; height: 64px; font-size: 32px; }
.icon-upload small { display: block; margin-top: 6px; color: var(--muted); }
.upload-choice { position: relative; display: inline-grid; padding: 7px 9px; background: #ebe5ff; color: #4934b1; border-radius: 7px; }
.upload-choice input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-choice:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.danger { background: #a53540; }
@media(max-width:760px) {
  .dashboard aside { position: static; height: auto; gap: 12px; }
  .dashboard .sidebar-footer { display: flex; flex-wrap: wrap; }
  .dashboard .list-toolbar { align-items: stretch; }
  .panel-heading, .promotion-layout { display: grid; grid-template-columns: 1fr; }
}
@media(max-width:420px) {
  .form-grid { grid-template-columns: 1fr; }
}
.funnel { display: grid; gap: 10px; margin: 0 0 20px; padding: 0; }
.funnel li { display: grid; grid-template-columns: 76px minmax(0,1fr) 55px; align-items: center; gap: 12px; font-size: 14px; }
.funnel strong { text-align: right; font-variant-numeric: tabular-nums; }
.funnel meter { width: 100%; height: 16px; }
.funnel meter::-webkit-meter-bar { background: #efedf8; border: 0; }
.funnel meter::-webkit-meter-optimum-value { background: #7560e6; }
.funnel-empty { padding: 12px 14px; border-radius: 9px; background: #f5f3fc; }
.leaderboard-periods { justify-content: flex-start; }
.leaderboard-periods button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.environment-label { padding: 7px 10px; color: #ded9ff; font-size: 13px; }
