:root {
  --y: #e8b93e;
  --r: #d0503f;
  --g: #4e9a63;
  --b: #8b5e3c;
  --bg: #f3eee2;
  --panel: #fffdf8;
  --ink: #3a352c;
  --sub: #8f8674;
  --line: #e6dfcd;
  --accent: #b98a2f;
  --accent-dark: #8f6a1f;
  --purple: #6d4fae;
  --orange: #c9822e;
  --shadow-s: 0 1px 2px rgba(80, 62, 30, .07), 0 2px 8px rgba(80, 62, 30, .06);
  --shadow-m: 0 6px 18px rgba(80, 62, 30, .16);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(180deg, #f6f1e5 0%, var(--bg) 40%, #ece5d4 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  font-size: 12px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
  transition: all .15s ease;
}
button:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(185, 138, 47, .12); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: linear-gradient(180deg, #c99a3d, var(--accent)); color: #fff; border-color: var(--accent-dark); font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.05); }

input, select {
  font: inherit;
  font-size: 12px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

/* ---------- 顶栏 ---------- */
#topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 16px;
  background: linear-gradient(180deg, #37301f, #2c2618);
  color: #f3ecdd;
  box-shadow: 0 2px 8px rgba(40, 30, 10, .25);
  flex-shrink: 0;
}
#topbar .brand { font-size: 16px; font-weight: 800; letter-spacing: 1.5px; white-space: nowrap; }
#topbar .sub { font-size: 10px; opacity: .5; font-weight: 400; margin-left: 4px; }
#topbar #turninfo { flex: 1; font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbtns button {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .18);
  color: #f3ecdd;
  margin-left: 5px;
  padding: 3px 10px;
}
.topbtns button:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); box-shadow: none; }

.turnpill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  font-size: 12px;
  margin-left: 4px;
}
.turnpill.mine { background: var(--accent); color: #fff; font-weight: 600; }
.turnpill.warn { background: #a33b2f; color: #fff; }
.turnpill.over { background: rgba(255, 255, 255, .18); }

/* ---------- 布局：一屏无滚动 ---------- */
#app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: 10px;
  padding: 8px 12px 10px;
  height: calc(100vh - 40px);
  max-width: 1600px;
  margin: 0 auto;
}
#board {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}
#logPanel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  overflow-y: auto;
  box-shadow: var(--shadow-s);
  min-height: 0;
}
#logPanel h3 { margin: 2px 0 6px; font-size: 12px; color: var(--sub); letter-spacing: 2px; }
.logline { font-size: 11px; color: #6b6455; padding: 3px 0; border-bottom: 1px dashed #efe8d8; line-height: 1.4; }

@media (max-width: 1000px) {
  #app { grid-template-columns: minmax(0, 1fr); height: auto; }
  html, body { overflow: auto; }
  #logPanel { max-height: 160px; }
}

.row-label {
  font-size: 10px;
  color: var(--sub);
  margin: 4px 0 4px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.row-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- 卡牌（紧凑） ---------- */
.card-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 8px;
  flex-shrink: 0;
}
.card-row.small .mcard { min-width: 92px; min-height: 104px; padding: 5px 6px; }
.card-row.small .dot { width: 10px; height: 10px; }
.card-row.small .cbody-label { font-size: 9px; }
.card-row.small .upchain { display: none; }
.card-row.small .card-top .cid { font-size: 8px; }

.slot { position: relative; flex-shrink: 0; }

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 8px;
  min-width: 114px;
  min-height: 122px;
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-m), 0 0 0 2px rgba(185, 138, 47, .35);
  border-color: var(--accent);
}
.card.empty { color: var(--sub); justify-content: center; align-items: center; min-height: 108px; }
.empty-note { color: var(--sub); font-size: 11px; }

.card-top { display: flex; align-items: center; gap: 4px; }
.card-top .cid { margin-left: auto; color: #c3bba7; font-size: 9px; letter-spacing: .5px; }
.badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
}
.badge.tP { background: #e4f0e0; color: #38763f; }
.badge.tU { background: #eae5f7; color: #5b4d9e; }
.badge.tT { background: #fcecd9; color: #b06a1f; }
.badge.startb { background: #f0e7fb; color: #7b4bbd; }
.card.isstart { border-style: dashed; }

.cbody { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.cbody-label { font-size: 9px; color: var(--sub); letter-spacing: 1px; }
.sp-row { display: flex; flex-wrap: wrap; align-items: center; min-height: 14px; gap: 2px; }

.tarrow { display: flex; flex-direction: column; align-items: center; color: #b6ac96; margin: 0; }
.tarrow .line { width: 2px; height: 4px; background: currentColor; border-radius: 1px; }
.tarrow .tri { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid currentColor; }
.tarrow.big { transform: scale(1.5); margin: 4px 0; }

.upline { display: flex; align-items: center; }
.chev { display: inline-block; width: 12px; height: 9px; position: relative; margin-right: 3px; }
.chev i {
  position: absolute; left: 0; top: 1px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid var(--purple);
}
.upchain { font-size: 10px; color: var(--sub); }
.upchain .arr { color: #c9bfa8; margin: 0 2px; }

.card-bonus {
  font-size: 10px;
  color: #7a5c1e;
  background: #faf3df;
  border: 1px dashed #e0cf9a;
  padding: 2px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: auto;
}
.card-bonus .blabel { color: #a08338; margin-right: 2px; font-size: 9px; }

.pricetag {
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: #5a4f38;
  color: #f5eeda;
  font-size: 9px;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .18);
}
.pricetag.free { background: var(--g); }

/* ---------- 订单卡 ---------- */
.card.point { align-items: center; text-align: center; min-width: 112px; }
.ptop { display: flex; align-items: baseline; gap: 3px; margin-top: 2px; }
.card.point .score {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.card.point .unit { color: var(--sub); font-size: 11px; }
.card.point .pfoot { width: 100%; margin-top: auto; }
.card.point.hasgold { border-color: #d9a92c; box-shadow: 0 0 0 2px rgba(217, 169, 44, .4), var(--shadow-s); }
.card.point.hassilver { border-color: #93a0ab; box-shadow: 0 0 0 2px rgba(147, 160, 171, .35), var(--shadow-s); }
.coinb {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: #7a5c1e;
  background: #faf3df;
  border-radius: 999px;
  padding: 1px 7px;
  margin: 1px 0;
}

/* ---------- 香料与钱币 ---------- */
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  position: relative;
  background: #ccc;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .22), inset 0 1px 2px rgba(255, 255, 255, .35), 0 1px 2px rgba(0, 0, 0, .18);
}
.dot::after {
  content: '';
  position: absolute;
  left: 20%;
  top: 12%;
  width: 38%;
  height: 30%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  filter: blur(1px);
}
.dot.sm { width: 9px; height: 9px; }
.dot.c0 { background: var(--y); }
.dot.c1 { background: var(--r); }
.dot.c2 { background: var(--g); }
.dot.c3 { background: var(--b); }
.dot-none { color: #cfc7b4; font-size: 10px; }
.dot-none::after { display: none; }

.coin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 1px;
  position: relative;
}
.coin.gold { background: radial-gradient(circle at 35% 32%, #ffedaa, #e2b13c 60%, #b9861f); box-shadow: 0 1px 2px rgba(0,0,0,.25), inset 0 0 0 1px rgba(120, 84, 10, .5); }
.coin.silver { background: radial-gradient(circle at 35% 32%, #ffffff, #c7cfd8 60%, #97a2ad); box-shadow: 0 1px 2px rgba(0,0,0,.22), inset 0 0 0 1px rgba(90, 100, 110, .4); }

/* ---------- 牌库堆 ---------- */
.deckwrap { text-align: center; align-self: center; margin-left: 4px; flex-shrink: 0; }
.deckcard {
  width: 54px;
  height: 78px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 4px;
  position: relative;
  box-shadow: 2px 2px 0 #d8d2c2, 3px 3px 0 #e8e2d2, 0 3px 8px rgba(80, 62, 30, .12);
}
.deckcard.backpurple { background: linear-gradient(155deg, #7d5fc0 0%, #5a4092 55%, #4a3277 100%); }
.deckcard.backorange { background: linear-gradient(155deg, #e0a34a 0%, #c9822e 55%, #a5671e 100%); }
.deckcard::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 5px;
}
.deckcount { color: #fff; font-size: 15px; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, .3); z-index: 1; }
.decklabel { font-size: 10px; color: var(--sub); }

/* ---------- 供应区 ---------- */
.supply { display: flex; gap: 8px; margin-top: 2px; flex-wrap: wrap; flex-shrink: 0; }
.bowl {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  box-shadow: var(--shadow-s);
}

/* ---------- 玩家面板（含实时分数与上次行动） ---------- */
#opponents { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.pstrip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 11px;
  box-shadow: var(--shadow-s);
  transition: border-color .2s, box-shadow .2s;
  min-width: 0;
}
.pbody { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 6px; }
.pinfo { min-width: 0; }
.pstrip.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(185, 138, 47, .25), var(--shadow-s); }
.pstrip.human { background: #fdfaf0; }
.pname { font-weight: 700; display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.pnm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seatdot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #cfc7b4;
  flex-shrink: 0;
}
.pstrip.active .seatdot { background: var(--accent); animation: pulse 1.4s ease infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 138, 47, .5); }
  50% { box-shadow: 0 0 0 4px rgba(185, 138, 47, 0); }
}
.turntag {
  font-size: 9px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0 7px;
  font-weight: 400;
  white-space: nowrap;
}
.neartag {
  font-size: 9px;
  background: #a33b2f;
  color: #fff;
  border-radius: 999px;
  padding: 0 7px;
  font-weight: 400;
  white-space: nowrap;
}
.pscore-row { display: flex; align-items: baseline; gap: 4px; margin: 1px 0 3px; }
.pscore {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.plabel { color: var(--sub); font-size: 10px; }
.pmini { margin-left: auto; color: var(--sub); font-size: 10px; white-space: nowrap; }
.pline { margin: 2px 0; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.pline .lbl { color: var(--sub); margin-right: 2px; flex-shrink: 0; }
.spwrap { display: inline-flex; flex-wrap: wrap; gap: 2px; min-width: 0; }
.sptotal {
  margin-left: 4px;
  font-size: 10px;
  color: var(--sub);
  background: #f5efdf;
  border-radius: 999px;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.plast {
  border-left: 1px dashed var(--line);
  padding-left: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.plast-wrap { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.plast-wrap .card { min-width: 56px; min-height: 62px; padding: 3px 4px; font-size: 9px; gap: 1px; border-radius: 6px; box-shadow: none; }
.plast-wrap .card .dot { width: 8px; height: 8px; }
.plast-wrap .card .cbody-label { font-size: 8px; letter-spacing: 0; }
.plast-wrap .card .upchain { display: none; }
.plast-wrap .card .tarrow .line { height: 3px; }
.plast-wrap .card .ptop .score { font-size: 15px; }
.plast-wrap .card .coinb { font-size: 8px; padding: 0 5px; }
.plast-wrap .card .card-top { gap: 2px; }
.plast-wrap .card .badge { font-size: 7px; padding: 0 4px; }
.plast-wrap .card .card-top .cid { display: none; }
.plast-tag { font-size: 8px; color: var(--sub); }
.plast-tag.buy { color: #38763f; }
.plast-tag.play { color: #b06a1f; }
.plast-tag.claim { color: var(--accent-dark); }
.plast-tag.rest { color: var(--sub); }
.restmark { font-size: 18px; color: var(--sub); line-height: 1; }
.plast-none { color: #d5cdbb; font-size: 10px; }

/* ---------- 我的区域 ---------- */
#humanArea {
  margin-top: 2px;
  background: linear-gradient(180deg, #fdfaf1, #faf5e8);
  border: 1px solid #e9e0c8;
  border-radius: 12px;
  padding: 4px 10px 10px;
  box-shadow: var(--shadow-s);
  flex-shrink: 0;
}
.hud {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr) 300px;
  gap: 10px;
  align-items: stretch;
}
.hud-left, .hud-mid, .hud-right { min-width: 0; display: flex; flex-direction: column; }

/* 已打出：小卡牌行 */
.card-row.tiny { flex-wrap: wrap; overflow: visible; padding-bottom: 2px; gap: 6px; }
.card.tiny { min-width: 72px; min-height: 88px; padding: 4px 5px; font-size: 9px; gap: 2px; }
.card.tiny .dot { width: 8px; height: 8px; }
.card.tiny .cbody-label { font-size: 8px; letter-spacing: 0; }
.card.tiny .upchain { display: none; }
.card.tiny .tarrow .line { height: 3px; }
.card.tiny .card-top .cid { font-size: 7px; }
.card.tiny .card-top { gap: 2px; }
.card.tiny .badge { font-size: 7px; padding: 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; align-items: center; margin-bottom: 4px; }
.chip {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 600;
  cursor: default;
}
.chip.tP { background: #e4f0e0; color: #38763f; }
.chip.tU { background: #eae5f7; color: #5b4d9e; }
.chip.tT { background: #fcecd9; color: #b06a1f; }

#actionPanel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 10px;
  flex: 1;
}
.hintline { color: var(--sub); font-size: 11px; }
.hintline b { color: var(--accent-dark); }
.actbtn { font-size: 12px; }
.rest-btn { border-color: #d9cfae; background: #fdf8e9; }
.rest-btn:hover { border-color: var(--accent); }
.thinking { color: var(--accent-dark); font-size: 12px; display: flex; align-items: center; gap: 7px; }
.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dim { color: var(--sub); }

/* ---------- 模态 ---------- */
#modalRoot .mask {
  position: fixed;
  inset: 0;
  background: rgba(44, 36, 20, .45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadein .18s ease;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
  background: var(--panel);
  border-radius: 14px;
  padding: 16px 20px;
  min-width: 340px;
  max-width: 720px;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 18px 60px rgba(30, 22, 8, .35);
  animation: popin .2s ease;
}
@keyframes popin { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.modal-head { display: flex; align-items: center; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-head .x {
  border: none;
  background: none;
  font-size: 20px;
  color: var(--sub);
  line-height: 1;
  padding: 2px 8px;
}
.modal-body p { margin: 7px 0; font-size: 13px; }

.optlist { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.optbtn {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  text-align: left;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 12px;
}
.optbtn.sm { padding: 4px 9px; font-size: 12px; }
.optbtn.on { border-color: var(--accent); background: #fdf6e3; box-shadow: 0 0 0 2px rgba(185, 138, 47, .2); }
.optlbl { color: var(--sub); font-size: 11px; margin: 0 4px 0 2px; }
.dropsub { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; margin-top: 4px; }

.cubegrid { display: flex; gap: 9px; flex-wrap: wrap; margin: 9px 0; }
.cubebtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 12px;
}
.cubebtn .cbl { font-size: 9px; color: var(--sub); }

.upreview {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f8f3e6;
  border: 1px dashed #dfd3b2;
  border-radius: 8px;
  padding: 7px 11px;
  margin: 9px 0;
  flex-wrap: wrap;
}
.upreview .lbl { color: var(--sub); font-size: 11px; margin-right: 3px; }

.btnrow { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.btnrow input { flex: 1; min-width: 120px; }

.tradeview { display: flex; align-items: center; gap: 16px; justify-content: center; padding: 8px 0; }
.stepper { display: inline-flex; align-items: center; gap: 10px; margin: 7px 0; }
.stepper button { width: 36px; height: 32px; font-size: 16px; font-weight: 700; padding: 0; }
.stval { font-size: 16px; font-weight: 700; min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.qrow { margin-top: 4px; }
.qbtn { min-width: 40px; }
.qbtn.on { border-color: var(--accent); background: #fdf6e3; color: var(--accent-dark); font-weight: 700; }
.warnline { color: #a33b2f; font-size: 12px; }

.acqhead { display: flex; gap: 14px; align-items: flex-start; }
.acqcard .card { min-width: 140px; }
.acqinfo { flex: 1; }

.scoretable { border-collapse: collapse; width: 100%; }
.scoretable th, .scoretable td { border-bottom: 1px solid var(--line); padding: 6px 11px; text-align: center; font-size: 13px; }
.scoretable th { color: var(--sub); font-weight: 600; }
.scoretable tr.win td { background: #fdf3d5; }
.scoretable tr.win td:first-child { font-weight: 700; }

.rulesli { padding-left: 18px; line-height: 1.75; font-size: 13px; }
.saverow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.saverow span { flex: 1; }

.setlbl { font-size: 13px; font-weight: 600; margin: 9px 0 6px; }
.setlbl.inline { margin: 0; }
.segsel { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segsel button { border: none; border-radius: 0; border-right: 1px solid var(--line); padding: 6px 14px; }
.segsel button:last-child { border-right: none; }
.segsel button.on { background: var(--accent); color: #fff; }
.airrow { display: flex; align-items: center; gap: 12px; margin: 7px 0; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d8cfba; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #c5b998; }

.online-start, .lobby { min-width: min(520px, 82vw); }
.online-lead { margin: 0 0 16px; color: var(--sub); line-height: 1.6; font-size: 14px; }
.field-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 700; }
.online-start > input { width: 100%; padding: 10px 12px; font-size: 16px; }
.online-actions { display: grid; grid-template-columns: auto 28px minmax(130px, 1fr) auto; align-items: center; gap: 8px; margin-top: 12px; }
.online-actions > span { color: var(--sub); text-align: center; }
.online-actions input { padding: 9px 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .12em; }
.online-actions button { min-height: 38px; font-size: 14px; }
.online-error { min-height: 1.4em; margin: 8px 0 0; color: #b13f32; font-size: 14px; }
.local-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--sub); font-size: 13px; }
.local-divider::before, .local-divider::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.room-code { color: var(--accent-dark); letter-spacing: .14em; }
.invite-row { display: flex; gap: 8px; margin: 12px 0 16px; }
.invite-row input { min-width: 0; flex: 1; padding: 9px 10px; font-size: 14px; }
.invite-row button { font-size: 14px; }
.seat-list { display: grid; gap: 7px; }
.seat-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 14px; }
.seat-item.empty { color: var(--sub); background: rgba(255,255,255,.45); border-style: dashed; }
.seat-number { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: white; font-weight: 800; }
.seat-item.empty .seat-number { background: #c8c0ad; }
.host-tag { margin-left: auto; padding: 2px 7px; border-radius: 99px; background: #f4e7c5; color: var(--accent-dark); font-size: 12px; }
.ai-difficulty { margin-left: auto; padding: 2px 8px; border-radius: 99px; background: #edf1e7; color: #53633c; font-size: 12px; }
.ai-join-panel { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--line); }
.online-diff { display: flex; width: 100%; }
.online-diff button { flex: 1; padding-inline: 8px; }
.master-note { margin: 7px 0 0; color: var(--sub); font-size: 12px; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lobby-actions .primary { margin-left: auto; }
.waiting-note { margin-top: 14px; color: var(--sub); font-size: 14px; }

@media (max-width: 620px) {
  .online-actions { grid-template-columns: 1fr 1fr; }
  .online-actions > span { display: none; }
  .online-actions input { grid-column: 1; }
  .invite-row { flex-direction: column; }
  .lobby-actions .primary { width: 100%; margin-left: 0; }
}
