/* ============ 操作台 ============ */
:root {
  --op-bg: #070b12;
  --op-panel: #0d141f;
  --op-line: rgba(217, 182, 120, .16);
}
body { overflow: hidden; background: var(--op-bg); }

.app {
  height: 100vh;
  display: grid;
  grid-template-rows: 54px 96px 1fr 62px;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% -10%, #101a2b, #070b12 60%);
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 0 16px;
  border-bottom: 1px solid var(--op-line);
  background: rgba(6, 10, 16, .7);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  font-family: var(--f-display); font-weight: 900; font-size: 16px; color: #0a0f18;
  background: linear-gradient(160deg, #f2dcae, #c79f5e);
}
.brand-text { font-family: var(--f-display); font-weight: 700; font-size: 16px; letter-spacing: .1em; color: #e8eef8; }
.stat { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-4); letter-spacing: .04em; }
.stat .dot { width: 7px; height: 7px; border-radius: 50%; background: #6b7a90; }
.stat .dot.on { background: #4ec9a0; box-shadow: 0 0 10px #4ec9a0; }
.stat .dot.off { background: #e0576a; box-shadow: 0 0 10px #e0576a; }
.stat .sep { width: 1px; height: 12px; background: rgba(255, 255, 255, .1); }

button.ghost {
  padding: 7px 14px; border-radius: 8px; font-size: 12.5px;
  border: 1px solid rgba(217, 182, 120, .22); color: #cfd9e8;
  background: rgba(255, 255, 255, .03); transition: .18s;
}
button.ghost:hover { border-color: rgba(217, 182, 120, .55); background: rgba(217, 182, 120, .1); color: #fff; }
button.solid {
  padding: 8px 18px; border-radius: 8px; font-size: 13px;
  color: #0b0f16; font-weight: 700;
  background: linear-gradient(160deg, #f2dcae, #cfa869);
  transition: .18s;
}
button.solid:hover { filter: brightness(1.08); }
button.solid:disabled, button.ghost:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- 回合条 ---------- */
.stagebar {
  display: grid; grid-template-columns: 168px minmax(0, 1fr) 216px; gap: 14px;
  align-items: center; padding: 10px 16px;
  border-bottom: 1px solid var(--op-line);
}
.turn {
  position: relative; height: 100%; border-radius: 12px; padding: 10px 14px;
  display: flex; flex-direction: column; justify-content: center;
  border: 1px solid rgba(78, 168, 255, .35);
  background: linear-gradient(150deg, rgba(78, 168, 255, .16), rgba(78, 168, 255, .03));
  transition: .3s;
}
.turn.red {
  border-color: rgba(255, 92, 108, .38);
  background: linear-gradient(150deg, rgba(255, 92, 108, .16), rgba(255, 92, 108, .03));
}
.turn.done { border-color: rgba(217, 182, 120, .3); background: rgba(217, 182, 120, .05); }
.turn-side { font-family: var(--f-display); font-weight: 900; font-size: 22px; color: #dbeaff; letter-spacing: .08em; }
.turn.red .turn-side { color: #ffd9dd; }
.turn-type { margin-top: 2px; font-family: var(--f-brush); font-size: 20px; color: var(--gold-1); }
.turn-step { position: absolute; right: 12px; top: 10px; font-size: 10px; letter-spacing: .1em; color: var(--ink-4); }

.seq { display: flex; gap: 5px; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; min-width: 0; }
.seq::-webkit-scrollbar { height: 4px; }
.seq-item {
  position: relative; width: 40px; height: 40px; flex: none; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .03);
  overflow: hidden; display: grid; place-items: center;
}
.seq-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.seq-item .si-tag {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 8px; text-align: center;
  background: rgba(0, 0, 0, .6); letter-spacing: .04em;
}
.seq-item.b { border-color: rgba(78, 168, 255, .45); }
.seq-item.r { border-color: rgba(255, 92, 108, .45); }
.seq-item.pick .si-tag { color: #a9d3ff; }
.seq-item.b.rpick .si-tag, .seq-item.r .si-tag { color: #ffb2ba; }
.seq-item.cur { box-shadow: 0 0 0 2px var(--gold-1), 0 0 18px rgba(217, 182, 120, .5); }
.seq-item.filled img { opacity: .95; }
.seq-item.banned img { filter: grayscale(.9) brightness(.6); }
.seq-item .si-num { font-size: 10px; color: rgba(255, 255, 255, .25); }

.timerctl { display: flex; align-items: center; gap: 10px; }
.timer-readout { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none; }
.tstate { font-size: 9px; letter-spacing: .04em; color: var(--ink-4); white-space: nowrap; }
.tstate.running { color: var(--gold-1); }
.tval {
  width: 62px; height: 62px; flex: none; display: grid; place-items: center; border-radius: 50%;
  font-family: var(--f-display); font-weight: 900; font-size: 26px; color: #f4e7cc;
  border: 1px solid rgba(217, 182, 120, .3); background: rgba(217, 182, 120, .06);
}
.tval.urgent { color: #ff8b95; border-color: rgba(255, 92, 108, .5); }
.tbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; flex: 1; }
.tbtns button {
  padding: 6px 0; border-radius: 6px; font-size: 11.5px; color: #cfd9e8;
  border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .03);
}
.tbtns button:hover { border-color: rgba(217, 182, 120, .5); color: #fff; }

/* ---------- 式神池 ---------- */
.pool { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.filters {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px 6px; flex-wrap: wrap;
}
#q {
  width: 220px; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  color: #e8eef8; border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04); outline: none;
}
#q:focus { border-color: rgba(217, 182, 120, .55); }
.roles { display: flex; gap: 6px; min-width: 0; overflow-x: auto; }
.roles button {
  padding: 6px 13px; border-radius: 7px; font-size: 12.5px; color: #b9c6d8;
  border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .03);
  transition: .16s; white-space: nowrap;
}
.roles button:hover { color: #fff; border-color: rgba(217, 182, 120, .45); }
.roles button.cur { color: #0b0f16; background: linear-gradient(160deg, #f2dcae, #cfa869); border-color: transparent; font-weight: 700; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); cursor: pointer; }
.chk.wide { margin: 6px 0 4px; }
.chk input { accent-color: #cfa869; }

.grid {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 16px 16px;
  display: grid; grid-template-columns: repeat(auto-fill, 92px);
  gap: 10px; align-content: start; justify-content: start;
}
.hero {
  position: relative; width: 92px; height: 92px; flex: none;
  border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .03);
  transition: transform .16s cubic-bezier(.2, .7, .3, 1), border-color .16s, box-shadow .16s;
}
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .hn {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 4px 4px;
  font-size: 11px; text-align: center; color: #eef4ff; letter-spacing: .02em;
  background: linear-gradient(0deg, rgba(4, 7, 12, .96), rgba(4, 7, 12, .0));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero .hm {
  position: absolute; left: 5px; top: 5px; padding: 1px 5px; border-radius: 4px;
  font-size: 9.5px; letter-spacing: .06em; color: #dfe9f8;
  background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .14);
}
.hero .hmotion {
  position: absolute; right: 5px; top: 5px; width: 6px; height: 6px; border-radius: 50%;
  background: #58c8b4; box-shadow: 0 0 8px #58c8b4;
}
.hero:hover { transform: translateY(-3px); border-color: rgba(217, 182, 120, .6); box-shadow: 0 12px 26px -14px rgba(217, 182, 120, .7); }
.hero:active { transform: scale(.96); }

.hero.sel-blue { border-color: #4ea8ff; box-shadow: inset 0 0 0 2px rgba(78, 168, 255, .7), 0 0 20px -6px #4ea8ff; }
.hero.sel-red { border-color: #ff5c6c; box-shadow: inset 0 0 0 2px rgba(255, 92, 108, .7), 0 0 20px -6px #ff5c6c; }
.hero.sel-blue img, .hero.sel-red img { opacity: 1; }
.hero.sel-ban { border-color: rgba(255, 255, 255, .12); }
.hero.sel-ban img { filter: grayscale(1) brightness(.45); }
.hero.locked { opacity: .3; cursor: not-allowed; }
.hero.locked img { filter: grayscale(1); }
.hero .mark {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 900; font-size: 14px; letter-spacing: .1em;
  color: #fff; opacity: 0;
}
.hero.sel-blue .mark { opacity: 1; background: rgba(30, 80, 140, .55); }
.hero.sel-red .mark { opacity: 1; background: rgba(140, 34, 46, .55); }
.hero.sel-ban .mark { opacity: 1; background: rgba(0, 0, 0, .45); color: #ff8b95; }
.hero.locked .mark { opacity: 1; color: #8695a9; font-size: 11px; }
.hero.locked .mark::after { content: '已用'; }

.pool-empty { padding: 40px; text-align: center; color: var(--ink-4); font-size: 13px; }

/* ---------- 底栏 ---------- */
.actions {
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  border-top: 1px solid var(--op-line); background: rgba(6, 10, 16, .8);
}
.act-left, .act-right { display: flex; align-items: center; gap: 8px; }
.act-left { margin-right: auto; }
.scene-label { font-size: 11px; color: var(--ink-4); letter-spacing: .16em; margin-right: 2px; }

/* ---------- 抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer-mask {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .6);
  opacity: 0; transition: .25s;
}
.drawer.open .drawer-mask { opacity: 1; }
.drawer-body {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 92vw);
  padding: 20px 22px 40px; overflow-y: auto;
  background: linear-gradient(180deg, #0e1622, #080c12);
  border-left: 1px solid var(--op-line);
  transform: translateX(100%); transition: transform .32s cubic-bezier(.2, .8, .3, 1);
}
.drawer.open .drawer-body { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.drawer-head h2 { font-family: var(--f-display); font-size: 19px; letter-spacing: .14em; color: #eef4ff; }

.field { margin-bottom: 14px; flex: 1; min-width: 0; }
.field label { display: block; font-size: 11px; letter-spacing: .14em; color: var(--ink-4); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: #e8eef8;
  border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04); outline: none;
}
.field select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #cfa869 50%), linear-gradient(135deg, #cfa869 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.field select option { color: #e8eef8; background: #101823; }
.field input:focus, .field select:focus { border-color: rgba(217, 182, 120, .55); }
.field-row { display: flex; gap: 12px; }
.timer-tip { margin: -4px 0 16px; }
.field input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.field input[type="number"]::-webkit-inner-spin-button { opacity: .55; }

.seg { display: flex; gap: 4px; padding: 3px; border-radius: 9px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); }
.seg button { flex: 1; padding: 7px 0; border-radius: 6px; font-size: 12.5px; color: #b9c6d8; }
.seg button.cur { color: #0b0f16; background: linear-gradient(160deg, #f2dcae, #cfa869); font-weight: 700; }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 8px; font-size: 16px; color: #dbe5f3;
  border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04);
}
.stepper button:hover { border-color: rgba(217, 182, 120, .5); }
.stepper span { flex: 1; text-align: center; font-family: var(--f-display); font-weight: 900; font-size: 19px; color: #f4e7cc; }

.sec { margin: 22px 0 12px; font-family: var(--f-display); font-size: 14px; letter-spacing: .16em; color: var(--gold-1); }
.netbox { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 12px; border: 1px solid var(--op-line); background: rgba(255, 255, 255, .025); }
.netinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.netrow { display: flex; flex-direction: column; gap: 3px; }
.netrow span { font-size: 10.5px; letter-spacing: .12em; color: var(--ink-4); }
.netrow code { font-size: 11.5px; color: #a9d3ff; word-break: break-all; font-family: ui-monospace, Consolas, monospace; }
.qr { width: 108px; height: 108px; border-radius: 8px; background: #f5ecd8; flex: none; }
.tip { margin-top: 10px; font-size: 11.5px; line-height: 1.75; color: var(--ink-4); }
.adv { display: flex; gap: 8px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px);
  padding: 11px 20px; border-radius: 10px; font-size: 13px; color: #fff;
  background: rgba(20, 28, 40, .96); border: 1px solid rgba(217, 182, 120, .35);
  opacity: 0; pointer-events: none; transition: .28s; z-index: 80;
  box-shadow: 0 18px 40px -18px #000;
}

.share-layer {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 8, 14, .78); backdrop-filter: blur(6px);
}
.share-layer[hidden] { display: none; }
.share-card {
  width: 360px; padding: 26px 26px 20px; border-radius: 18px; text-align: center;
  background: linear-gradient(180deg, #141d2b, #0b111a);
  border: 1px solid rgba(126, 170, 220, .22);
  box-shadow: 0 32px 80px rgba(0, 0, 0, .7);
}
.share-title { font-family: var(--f-display); font-size: 16px; letter-spacing: .18em; color: #e6f0fb; margin-bottom: 18px; }
.share-qr { width: 250px; height: 250px; border-radius: 12px; background: #f5ecd8; padding: 10px; }
.share-url { display: block; margin: 14px 0 16px; font-size: 11px; color: #8fb3d9; word-break: break-all; font-family: ui-monospace, Consolas, monospace; }
.share-row { display: flex; gap: 10px; justify-content: center; }
.share-tip { margin-top: 14px; font-size: 11px; line-height: 1.7; color: var(--ink-4); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 92, 108, .6); }

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  .app { grid-template-rows: 50px auto 1fr 56px; }
  .stagebar { grid-template-columns: 1fr; gap: 8px; padding: 8px 12px; }
  .turn { height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 8px 12px; }
  .turn-step { position: static; margin-left: auto; }
  .timerctl { display: none; }
  .seq { height: 46px; }
  .filters { padding: 8px 12px 4px; }
  #q { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, 78px); gap: 8px; padding: 8px 12px 12px; }
  .hero { width: 78px; height: 78px; }
  .actions { padding: 0 10px; gap: 6px; overflow-x: auto; }
  .act-left, .act-right { gap: 6px; }
  .actions button { padding: 7px 11px; font-size: 12px; white-space: nowrap; }
  .scene-label { display: none; }
  .brand-text { display: none; }
}

/* ---------- 赛事网站对接 ---------- */
.site-matches {
  margin-top: 10px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  background: rgba(0, 0, 0, .22);
  padding: 8px;
}
.sm-head {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted-2, #8a8f9c);
  padding: 6px 4px 4px;
}
.sm-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 8px;
  margin-bottom: 4px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 8px;
  background: rgba(255, 255, 255, .03);
  color: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.sm-item:hover { border-color: rgba(214, 178, 96, .45); background: rgba(214, 178, 96, .08); }
.sm-logo { width: 22px; height: 22px; object-fit: contain; flex: 0 0 22px; }
.sm-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 88px; }
.sm-vs { font-size: 10px; color: var(--muted-2, #8a8f9c); }
.sm-status { margin-left: auto; font-size: 10px; color: var(--muted-2, #8a8f9c); }
.sm-empty { margin: 6px; font-size: 12px; color: var(--muted-2, #8a8f9c); }
.site-roster { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.roster-row { display: flex; align-items: baseline; gap: 7px; font-size: 12px; }
.roster-side {
  flex: 0 0 18px;
  text-align: center;
  border-radius: 4px;
  font-size: 10px;
  line-height: 16px;
  border: 1px solid currentColor;
}
.roster-side.is-blue { color: #7cc0ff; }
.roster-side.is-red { color: #ff8e98; }
.roster-name { flex: 0 0 auto; font-weight: 600; }
.roster-list { color: var(--muted-2, #8a8f9c); font-size: 11px; line-height: 1.5; }
.site-current { margin: 4px 0 0; }
