/* Arena 商户台。设计：安静的工作台 + 唯一醒目的元素「席位票」（开局后发给玩家的链接）。 */
:root {
  color-scheme: light;
  --canvas: #eef0f3;
  --surface: #ffffff;
  --ink: #161922;
  --ink2: #3a3f4d;
  --muted: #697083;
  --line: #dadde4;
  --line2: #e8eaef;
  --act: #2f45d8;
  --act-ink: #ffffff;
  --act-soft: #e9ecfd;
  --ticket: #ffd24a;
  --ticket-ink: #3b2a00;
  --ok: #198754;
  --ok-soft: #e4f4ec;
  --warn: #9a6200;
  --warn-soft: #fff4d6;
  --bad: #c93a3a;
  --bad-soft: #fbe9e9;
  --r: 10px;
  --font: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.6 var(--font); color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
.num { font-variant-numeric: tabular-nums; }
a { color: var(--act); }
a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--act-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; }
.hidden { display: none !important; }

/* ── 布局 ── */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; background: var(--ink); color: #c9cdd8; }
.rail .shop { padding: 4px 10px 18px; }
.rail .shop b { display: block; color: #fff; font-size: 16px; line-height: 1.3; }
.rail .shop span { font-size: 12px; color: #8b91a3; }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.rail nav a:hover { background: #222634; color: #fff; }
.rail nav a.on { background: #fff; color: var(--ink); font-weight: 600; }
.rail nav a .ic { width: 18px; height: 18px; flex: none; }
.rail nav a .badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--ticket); color: var(--ticket-ink); font-size: 12px; font-weight: 600; text-align: center; }
.rail nav .sep { height: 1px; margin: 10px 8px; background: #2a2f3e; }
.rail .me { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #2a2f3e; font-size: 13px; }
.rail .me b { color: #fff; font-weight: 500; }
.rail .me button { margin-top: 6px; padding: 0; border: 0; background: none; color: #8b91a3; cursor: pointer; }
.rail .me button:hover { color: #fff; }
main { min-width: 0; padding: 28px 36px 60px; }
.page { max-width: 1180px; margin: 0 auto; }
.head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.head h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: .01em; }
.head p { margin: 2px 0 0; color: var(--muted); }
.head .grow { flex: 1; }

/* ── 控件 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9bdc8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--act); border-color: var(--act); color: var(--act-ink); font-weight: 600; }
.btn.primary:hover { background: #2337c4; }
.btn.big { height: 46px; padding: 0 22px; font-size: 16px; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
.btn.ghost:hover { background: #e3e6ec; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
textarea.input { height: auto; min-height: 76px; padding: 8px 11px; resize: vertical; line-height: 1.55; }
.input:focus { border-color: var(--act); outline: none; box-shadow: 0 0 0 3px var(--act-soft); }
.input[readonly], .input:disabled { background: #f4f5f8; color: var(--muted); }
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; }
label.f > small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--act); }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: #e2e5eb; }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; color: var(--ink2); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(22, 25, 34, .12); }
.search { position: relative; }
.search .input { padding-left: 34px; width: 260px; }
.search svg { position: absolute; left: 10px; top: 10px; width: 17px; height: 17px; color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--r); }
.panel > h2, .sec > h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panel.pad { padding: 20px 22px; }
.sec { margin-top: 26px; }
.sec > h2 { margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; margin-bottom: 6px; color: var(--ink); font-size: 16px; }
.empty .btn { margin-top: 14px; }

/* 状态 */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.waiting { color: var(--warn); }
.st.playing { color: var(--act); }
.st.ended { color: var(--ok); }
.st.cancelled, .st.expired, .st.aborted { color: var(--muted); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef0f4; color: var(--ink2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.act { background: var(--act-soft); color: var(--act); }

/* ── 表格 ── */
table.t { width: 100%; border-collapse: collapse; }
table.t th { padding: 10px 14px; text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line2); }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f7f8fa; }
table.t .who { display: flex; gap: 6px; flex-wrap: wrap; }
.dot-seat { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.dot-seat i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid #b5bac6; }
.dot-seat.in i { background: var(--ok); border-color: var(--ok); }

/* ── 开局 ── */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tcard { position: relative; display: flex; flex-direction: column; border: 1.5px solid var(--line2); border-radius: var(--r); background: var(--surface); cursor: pointer; text-align: left; padding: 0; overflow: hidden; }
.tcard:hover { border-color: #b9bdc8; }
.tcard.on { border-color: var(--act); box-shadow: 0 0 0 3px var(--act-soft); }
.tcard .art { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 10px; background: #12131c; aspect-ratio: 16 / 7; }
.tcard .art img { width: 100%; height: 100%; object-fit: contain; min-height: 0; }
.tcard .art.one { grid-template-columns: 1fr; }
.tcard .body { padding: 10px 12px 12px; }
.tcard .body b { display: block; font-size: 15px; line-height: 1.35; }
.tcard .facts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.tcard .tick { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--act); color: #fff; display: none; place-items: center; }
.tcard.on .tick { display: grid; }
.tcard .tick svg { width: 14px; height: 14px; }
.side { position: sticky; top: 24px; }
.side .panel { padding: 18px 20px 20px; }
.seatgrid { display: grid; grid-template-columns: 84px 1fr; gap: 8px 10px; align-items: center; margin: 6px 0 16px; }
.seatgrid .role { font-weight: 600; }
.seatgrid .role small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
details.more { margin: 4px 0 16px; }
details.more summary { cursor: pointer; color: var(--ink2); font-size: 13px; }
details.more[open] summary { margin-bottom: 10px; }

/* ── 席位票：唯一醒目的元素 ── */
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ticket { --notch: 9px; position: relative; display: grid; grid-template-columns: 1fr 132px; background: var(--surface); border-radius: 14px; filter: drop-shadow(0 1px 0 var(--line)) drop-shadow(0 6px 18px rgba(22, 25, 34, .08));
  -webkit-mask: radial-gradient(circle var(--notch) at calc(100% - 132px) 0, #0000 98%, #000) top / 100% 51% no-repeat, radial-gradient(circle var(--notch) at calc(100% - 132px) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
  mask: radial-gradient(circle var(--notch) at calc(100% - 132px) 0, #0000 98%, #000) top / 100% 51% no-repeat, radial-gradient(circle var(--notch) at calc(100% - 132px) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat; }
.ticket .main { padding: 16px 18px 14px; min-width: 0; border-left: 8px solid var(--ticket); border-radius: 14px 0 0 14px; }
.ticket .role { font-size: 22px; font-weight: 700; line-height: 1.2; }
.ticket .name { color: var(--muted); font-size: 13px; }
.ticket .state { margin: 8px 0 12px; }
.ticket .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ticket .stub { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-left: 2px dashed var(--line); }
.ticket .stub img { width: 104px; height: 104px; image-rendering: pixelated; }
.ticket .stub .seg button { height: 24px; padding: 0 8px; font-size: 12px; }
.ticket.off { opacity: .6; }
.ticket .url { margin-top: 10px; padding: 6px 8px; border-radius: 6px; background: #f4f5f8; font: 11px/1.4 ui-monospace, Consolas, monospace; color: var(--muted); word-break: break-all; max-height: 3.2em; overflow: hidden; }
.done-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 16px 20px; border-radius: var(--r); background: var(--ink); color: #fff; }
.done-head b { font-size: 18px; }
.done-head span { color: #b9bed0; }
.done-head .spacer + .btn { background: transparent; color: #fff; border-color: #444a5c; }

/* ── 抽屉 ── */
.drawer-mask { position: fixed; inset: 0; z-index: 40; background: rgba(22, 25, 34, .35); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(760px, 100vw); overflow: auto; background: var(--canvas); box-shadow: -12px 0 40px rgba(22, 25, 34, .18); animation: slide .18s ease-out; }
.drawer .dh { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--line2); }
.drawer .dh h2 { margin: 0; font-size: 18px; }
.drawer .db { padding: 20px 24px 40px; }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
dl.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; word-break: break-all; }
.result { padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line2); }
.result .sum { font-size: 17px; font-weight: 650; }
.verify { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; }
.verify.no { color: var(--bad); }

/* ── 模板编辑器 ── */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.fieldset { padding: 18px 20px 6px; background: var(--surface); border: 1px solid var(--line2); border-radius: var(--r); margin-bottom: 14px; }
.fieldset > .fh { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.fieldset > .fh b { font-size: 15px; }
.lock { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 400; }
.lock svg { width: 13px; height: 13px; }
.items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.item { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; padding: 12px; border: 1px solid var(--line2); border-radius: 10px; background: #fafbfc; }
.item.noimg { grid-template-columns: 1fr auto; }
.item .ops { display: flex; flex-direction: column; gap: 4px; }
.item .ops .btn { width: 30px; height: 30px; padding: 0; }
.item .ops svg { width: 15px; height: 15px; }
.item .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.item label.f { margin-bottom: 8px; }
.imgfield { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.imgfield .thumb { position: relative; width: 92px; height: 92px; border-radius: 10px; background: #12131c; display: grid; place-items: center; overflow: hidden; cursor: pointer; border: 0; padding: 0; }
.imgfield .thumb img { width: 84%; height: 84%; object-fit: contain; }
.imgfield .thumb.photo img { width: 100%; height: 100%; object-fit: cover; }
.imgfield .thumb .mark { position: absolute; left: 4px; bottom: 4px; padding: 0 5px; border-radius: 4px; font-size: 10px; background: var(--warn-soft); color: var(--warn); }
.imgfield .links { display: flex; gap: 8px; font-size: 12px; }
.imgfield .links button { padding: 0; border: 0; background: none; color: var(--act); cursor: pointer; }
.imgfield .links button:disabled { color: var(--muted); cursor: default; }
.chips { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.chips .line { display: flex; gap: 6px; }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 12px 0; background: linear-gradient(transparent, var(--canvas) 30%); }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; margin-bottom: 14px; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* ── 图片库 / 选择器 ── */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mcard { position: relative; padding: 0; border: 1.5px solid var(--line2); border-radius: 10px; background: var(--surface); overflow: hidden; text-align: left; }
button.mcard { cursor: pointer; }
button.mcard:hover { border-color: var(--act); }
.mcard .im { aspect-ratio: 1; display: grid; place-items: center; background: #12131c; }
.mcard .im img { width: 100%; height: 100%; object-fit: cover; }
.mcard .im.builtin img { width: 78%; height: 78%; object-fit: contain; }
.mcard .cap { padding: 7px 9px; font-size: 12px; }
.mcard .cap b { display: block; font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1; border: 1.5px dashed #b9bdc8; border-radius: 10px; background: transparent; color: var(--ink2); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--act); color: var(--act); background: var(--act-soft); }
.drop svg { width: 26px; height: 26px; }

/* ── 弹层 ── */
.modal-mask { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(22, 25, 34, .42); }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 22px 24px; border-radius: 14px; background: var(--surface); box-shadow: 0 24px 60px rgba(22, 25, 34, .3); }
.modal.wide { width: min(880px, 100%); }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.secret { margin: 10px 0; padding: 12px 14px; border-radius: 8px; background: #161922; color: #ffe38a; font: 13px/1.5 ui-monospace, Consolas, monospace; word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 10px 30px rgba(22, 25, 34, .3); }
.toast.bad { background: var(--bad); }

/* ── 市场 ── */
.market { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.market .tcard { cursor: default; }
.market .tcard .art { aspect-ratio: 16 / 8; }
.market .pub { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.market .foot { display: flex; align-items: center; gap: 8px; padding: 0 12px 12px; }
.price { font-weight: 650; }

/* ── 登录 ── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); }
.login .l { display: flex; flex-direction: column; justify-content: space-between; padding: 48px; background: var(--ink); color: #c9cdd8; overflow: hidden; }
.login .l h1 { margin: 0; color: #fff; font-size: 34px; line-height: 1.25; font-weight: 700; }
.login .l p { max-width: 26em; }
.login .l .deck { display: flex; gap: 12px; margin: 40px 0; }
.login .l .deck .ticket { width: 230px; grid-template-columns: 1fr 70px; --notch: 7px;
  -webkit-mask: radial-gradient(circle 7px at calc(100% - 70px) 0, #0000 98%, #000) top / 100% 51% no-repeat, radial-gradient(circle 7px at calc(100% - 70px) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
  mask: radial-gradient(circle 7px at calc(100% - 70px) 0, #0000 98%, #000) top / 100% 51% no-repeat, radial-gradient(circle 7px at calc(100% - 70px) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat; }
.login .l .deck .ticket:nth-child(2) { transform: translateY(18px) rotate(2deg); }
.login .l .deck .ticket .main { padding: 12px 14px; color: var(--ink); }
.login .l .deck .ticket .stub { padding: 8px; }
.login .l .deck .qr { width: 44px; height: 44px; border-radius: 4px; background: repeating-conic-gradient(var(--ink) 0 25%, #fff 0 50%) 0 0 / 11px 11px; }
.login .r { display: grid; place-items: center; padding: 40px; }
.login form { width: min(360px, 100%); }
.login form h2 { margin: 0 0 4px; font-size: 22px; }
.login form p { margin: 0 0 22px; color: var(--muted); }
.login .err { min-height: 22px; margin: 4px 0 10px; color: var(--bad); font-size: 13px; }

@media (max-width: 1080px) {
  .compose, .editor { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; }
  .rail .shop { padding: 0 8px 0 4px; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
  .rail nav .sep, .rail .me { display: none; }
  main { padding: 20px 14px 50px; }
  .login { grid-template-columns: 1fr; }
  .login .l { display: none; }
  .search .input { width: 100%; }
  .item { grid-template-columns: 1fr; }
}

/* 编辑器：简单字段两列排布；由游戏设定的字段收在一行 */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.grid2 > .wide { grid-column: 1 / -1; }
.fixed { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 0 14px; border-top: 1px solid var(--line2); color: var(--muted); font-size: 13px; }
.fixed b { color: var(--ink2); font-weight: 500; }
.fixed .lock { margin-right: 4px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; border: 1px solid rgba(0,0,0,.15); }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
