:root {
  font-family: Inter, "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: #f4efe4;
  background: #090807;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 16% -10%, rgba(125, 31, 28, 0.42), transparent 34rem),
    radial-gradient(circle at 95% 10%, rgba(185, 126, 47, 0.16), transparent 28rem),
    linear-gradient(145deg, #0c0a08, #080706 62%, #0d0908);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.18;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

button, input, select { font: inherit; }

.shell { width: min(1420px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 30px; }

.hero { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; margin-bottom: 26px; }
.sigil { display: grid; place-items: center; width: 74px; height: 74px; border: 1px solid #8f6a31; border-radius: 50%; color: #e4b963; font: 42px Georgia, serif; background: radial-gradient(circle, #3d2217, #17100d 68%); box-shadow: 0 0 0 5px #0e0b09, 0 0 0 6px rgba(191,139,55,.28), 0 15px 45px rgba(0,0,0,.45); }
.eyebrow { margin: 0 0 7px; color: #a98d61; font-size: 11px; font-weight: 800; letter-spacing: .21em; }
h1, h2 { margin: 0; font-family: Georgia, "STSong", serif; font-weight: 500; }
h1 { font-size: clamp(30px, 4vw, 48px); letter-spacing: .02em; }
h2 { font-size: 24px; }
.subtitle { margin: 9px 0 0; color: #a9a199; font-size: 15px; }
.status-pill { display: flex; gap: 9px; align-items: center; padding: 11px 15px; border: 1px solid #3d3731; border-radius: 999px; color: #bcb3a8; background: #14110f; font-size: 13px; }
.status-pill span { width: 8px; height: 8px; border-radius: 50%; background: #6c655f; box-shadow: 0 0 0 4px rgba(108,101,95,.12); }
.status-pill[data-status="running"] span { background: #65c38b; box-shadow: 0 0 0 4px rgba(101,195,139,.13), 0 0 16px #65c38b; }
.status-pill[data-status="connecting"] span, .status-pill[data-status="stopping"] span { background: #e2b45e; animation: pulse 1s infinite alternate; }
.status-pill[data-status="error"] span, .status-pill[data-status="degraded"] span { background: #e36e61; }
@keyframes pulse { to { opacity: .35; } }

.panel { border: 1px solid rgba(166,130,72,.22); border-radius: 16px; background: linear-gradient(145deg, rgba(28,23,19,.95), rgba(17,14,12,.96)); box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.control-panel { padding: 20px; }
form { display: grid; grid-template-columns: 1fr 1.15fr auto; gap: 14px; align-items: end; }
.field { display: grid; gap: 7px; }
.field > span { color: #a99f94; font-size: 12px; font-weight: 700; letter-spacing: .06em; }
input, select { width: 100%; height: 46px; padding: 0 14px; border: 1px solid #413a33; border-radius: 9px; outline: none; color: #f0e9df; background: #0e0c0b; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { border-color: #a97d38; box-shadow: 0 0 0 3px rgba(169,125,56,.13); }
input:disabled, select:disabled { color: #706a64; cursor: not-allowed; }
.actions { display: flex; gap: 9px; }
button { height: 46px; padding: 0 20px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; font-weight: 800; white-space: nowrap; transition: transform .15s, opacity .15s, background .15s; }
button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: .35; cursor: not-allowed; }
.primary { color: #1b1008; background: linear-gradient(#e3bc70, #b68135); box-shadow: inset 0 1px rgba(255,255,255,.35), 0 8px 24px rgba(132,86,31,.18); }
.secondary { border-color: #55473c; color: #cfc4b8; background: #171210; }
.form-error { min-height: 18px; margin: 10px 2px -4px; color: #f08b7e; font-size: 13px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.metrics article { position: relative; overflow: hidden; padding: 18px 20px; border: 1px solid rgba(166,130,72,.16); border-radius: 13px; background: rgba(20,17,14,.76); }
.metrics article::after { position: absolute; right: -18px; bottom: -35px; width: 90px; height: 90px; border: 1px solid rgba(204,154,77,.1); border-radius: 50%; content: ""; }
.metrics span { display: block; color: #8f8881; font-size: 12px; }
.metrics strong { display: block; margin-top: 8px; color: #e7d7bd; font: 28px Georgia, serif; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.seats-panel, .log-panel { min-height: 470px; padding: 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.055); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: #8d857d; font-size: 11px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.player { background: #a16d4d; }
.dot.bot { background: #d7ad58; }
.dot.empty { border: 1px solid #655f58; }
.seat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; padding-top: 20px; }
.seat-grid.empty-state { display: grid; min-height: 340px; place-items: center; color: #6f6861; }
.seat-card { position: relative; display: grid; justify-items: center; min-height: 155px; padding: 16px 10px 12px; border: 1px solid #342f2b; border-radius: 12px; text-align: center; background: rgba(10,9,8,.55); }
.seat-card.bot { border-color: rgba(201,153,73,.5); background: linear-gradient(155deg, rgba(89,56,26,.35), rgba(14,11,9,.75)); box-shadow: inset 0 0 28px rgba(205,146,50,.05); }
.seat-card.player { border-color: rgba(130,80,58,.48); }
.seat-number { position: absolute; top: 9px; left: 10px; color: #5e5852; font: 10px ui-monospace, monospace; }
.seat-token { display: grid; place-items: center; width: 58px; height: 58px; margin: 6px 0 11px; border: 1px solid #49413a; border-radius: 50%; background: radial-gradient(circle, #28211c, #0c0a09 70%); box-shadow: 0 0 0 4px #14110f, 0 0 0 5px #302a25; }
.seat-token span { color: #8c8278; font: 18px Georgia, serif; }
.seat-token img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.seat-card.bot .seat-token { border-color: #a77a39; box-shadow: 0 0 0 4px #17110d, 0 0 0 5px #6f5026, 0 0 24px rgba(203,145,55,.14); }
.seat-card.bot .seat-token span { color: #ecc87d; font-size: 14px; font-weight: 800; }
.seat-card strong { overflow: hidden; max-width: 100%; color: #d8d0c7; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.seat-card small { margin-top: 5px; color: #6f6963; font-size: 10px; }
.seat-card.bot small { color: #a9854e; }
.remove-bot { height: 28px; margin-top: 10px; padding: 0 12px; border-color: rgba(210,104,86,.38); color: #dca195; background: rgba(90,29,24,.28); font-size: 11px; }
.remove-bot:hover:not(:disabled) { border-color: rgba(232,126,105,.7); background: rgba(119,38,31,.42); }

.log-panel { max-height: 650px; }
.log-list { display: grid; gap: 0; max-height: 540px; margin: 0; padding: 12px 0 0; overflow: auto; list-style: none; }
.log-list li { display: grid; grid-template-columns: 65px 1fr; gap: 10px; padding: 12px 2px; border-bottom: 1px solid rgba(255,255,255,.045); }
.log-list time { color: #5f5a54; font: 10px ui-monospace, monospace; }
.log-list p { margin: 0; color: #9d958d; font-size: 12px; line-height: 1.55; }
.log-list li.success p { color: #a9c7a9; }
.log-list li.error p { color: #df8d82; }
.log-list li.warning p { color: #d4b271; }
.log-list .placeholder { display: block; color: #6f6861; font-size: 12px; }

footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 19px; color: #6f6861; font-size: 11px; line-height: 1.6; }
footer p { margin: 0; }
footer a { color: #9f8152; text-decoration: none; white-space: nowrap; }

@media (max-width: 1000px) {
  form { grid-template-columns: 1fr 1fr; }
  .actions { align-self: end; }
  .workspace { grid-template-columns: 1fr; }
  .log-panel { min-height: 330px; }
}

@media (max-width: 650px) {
  .shell { width: min(100% - 24px, 1420px); padding-top: 24px; }
  .hero { grid-template-columns: auto 1fr; }
  .sigil { width: 56px; height: 56px; font-size: 32px; }
  .status-pill { grid-column: 1 / -1; width: fit-content; }
  form { grid-template-columns: 1fr; }
  .actions button { flex: 1; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .seat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  footer { flex-direction: column; }
}
