:root {
  color-scheme: dark;
  --bg: #070608;
  --panel: rgba(18, 16, 17, .9);
  --panel2: rgba(31, 25, 24, .92);
  --text: #f4eadc;
  --muted: #ad9b88;
  --line: rgba(255,255,255,.13);
  --accent: #c9a35d;
  --blood: #8d302d;
  --red: #cf6f6f;
  --green: #83d18f;
  --shadow: 0 24px 90px rgba(0,0,0,.52);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(128, 58, 34, .34), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(70, 26, 24, .34), transparent 32%),
    linear-gradient(135deg, #050405, #14100f 54%, #070608);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .12;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 34px 34px;
}
.shell { width: min(1180px, 100%); margin: 0 auto; padding: 26px; position: relative; }
.hero { display: flex; gap: 18px; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
h1 { margin: 0; font-size: clamp(34px, 8vw, 74px); letter-spacing: -.08em; line-height: .95; }
h2 { margin: 0 0 14px; letter-spacing: -.04em; }
.sub { margin: 12px 0 0; color: var(--muted); max-width: 780px; line-height: 1.7; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.status { padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(0,0,0,.28); color: var(--muted); white-space: nowrap; }
.status.ok { color: var(--green); }
.status.bad { color: var(--red); }
.grid { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.card { border: 1px solid var(--line); background: var(--panel); border-radius: 26px; box-shadow: var(--shadow); padding: 22px; backdrop-filter: blur(18px); }
.setup, .uploadBox { position: sticky; top: 18px; }
.uploadBox { grid-column: 1; }
.room { grid-column: 2; grid-row: 1 / span 2; min-height: 72vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }
label { display: grid; gap: 8px; margin: 14px 0; color: var(--muted); }
input, textarea, button {
  font: inherit;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(5, 5, 6, .82);
  color: var(--text);
}
input, textarea { width: 100%; padding: 13px 14px; outline: none; }
input[type="file"] { padding: 10px; color: var(--muted); }
textarea { resize: vertical; line-height: 1.55; }
button { padding: 12px 15px; cursor: pointer; transition: .16s ease; font-weight: 900; }
button:hover { transform: translateY(-1px); border-color: rgba(201, 163, 93, .62); }
button.primary { background: linear-gradient(135deg, #d4b16e, #8b4e2a); color: #161007; border: none; }
.buttons { display: grid; grid-template-columns: 1fr 110px 90px; gap: 10px; align-items: center; }
.hint { color: var(--muted); line-height: 1.6; font-size: 14px; white-space: pre-wrap; }
.ruleStatus { color: var(--accent); border: 1px solid rgba(201,163,93,.25); border-radius: 16px; padding: 12px; background: rgba(201,163,93,.08); line-height: 1.55; font-size: 14px; }
.uploadForm { display: grid; gap: 10px; margin-top: 12px; }
.lookup { display: grid; grid-template-columns: 1fr 70px; gap: 10px; margin-top: 14px; }
.lookupResults { color: var(--muted); line-height: 1.58; font-size: 13px; max-height: 280px; overflow: auto; }
.lookupResults p { border-top: 1px solid var(--line); padding-top: 10px; }
.lookupResults b { color: var(--accent); }
.roomTop { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.players { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; }
.player { padding: 7px 10px; border-radius: 999px; background: rgba(201,163,93,.1); color: var(--accent); border: 1px solid rgba(201,163,93,.24); font-size: 13px; }
.log { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow: auto; min-height: 360px; max-height: 62vh; padding: 10px 4px 14px; scroll-behavior: smooth; }
.msg { border: 1px solid var(--line); background: var(--panel2); border-radius: 18px; padding: 14px 15px; }
.msg.player { margin-left: 8%; background: rgba(43, 39, 42, .9); }
.msg.gm { margin-right: 8%; border-color: rgba(201,163,93,.26); background: rgba(27, 21, 19, .92); }
.msg.system { opacity: .78; font-size: 13px; }
.msgHead { display: flex; justify-content: space-between; gap: 10px; color: var(--accent); margin-bottom: 8px; }
.msgHead time { color: var(--muted); font-size: 12px; }
.msg p { margin: 0; line-height: 1.72; white-space: pre-wrap; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.quick button { padding: 9px 11px; color: var(--muted); }
.composer { display: grid; grid-template-columns: 1fr 138px; gap: 10px; align-items: stretch; margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #171211; border: 1px solid var(--line); padding: 12px 16px; border-radius: 999px; box-shadow: var(--shadow); z-index: 10; }
@media (max-width: 850px) {
  .shell { padding: 18px; }
  .hero, .roomTop { flex-direction: column; }
  .grid { grid-template-columns: 1fr; }
  .room, .uploadBox { grid-column: auto; grid-row: auto; }
  .setup, .uploadBox { position: static; }
  .buttons, .composer { grid-template-columns: 1fr; }
  .lookup { grid-template-columns: 1fr; }
  .msg.player, .msg.gm { margin-left: 0; margin-right: 0; }
}
