#chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  font-size: 13px;
  min-height: 80px;
  background: rgba(3, 5, 9, 0.22);
}

#chat-log .msg {
  margin-bottom: 8px;
}

#chat-log .msg .from {
  font-weight: bold;
  color: var(--gold);
  font-family: var(--font-display);
  letter-spacing: 0.6px;
}

#chat-log .msg.system {
  color: var(--parchment-muted);
  font-style: italic;
}

#chat-form {
  display: flex;
  padding: 8px;
  border-top: 1px solid rgba(216,187,103,0.16);
  gap: 6px;
}

#chat-form input {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(216,187,103,0.22);
  background: rgba(2, 4, 8, 0.66);
  color: var(--parchment);
  font-family: var(--font-body);
}

#chat-form input:focus {
  outline: none;
  border-color: var(--accent);
}

#chat-form button {
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.045);
  border-color: rgba(216, 187, 103, 0.2);
  color: var(--parchment);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

#chat-form button:hover {
  background: var(--accent-hover);
}

#chat-log .roll {
  color: var(--info);
  font-family: var(--font-mono);
  font-size: 12px;
}

.roll-mode {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.roll-mode.adv {
  background: #1f5c3a;
  color: #8ee6ae;
}

.roll-mode.dis {
  background: #5c1f1f;
  color: #e68e8e;
}

.roll-conditions {
  display: inline-flex;
  gap: 4px;
  margin-left: 4px;
}

.roll-condition-chip {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: #5c1f1f;
  color: #e68e8e;
  font-family: var(--font-body);
  text-transform: none;
  cursor: help;
}

#chat-log .msg.rulecard {
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--gold-strong);
  border-radius: var(--radius-sm);
  background: var(--ink-800);
  padding: 9px 11px;
  margin-bottom: 10px;
}
.rulecard-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.rulecard-type { color: var(--gold-strong); font-weight: 700; }
.rulecard-variant {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 0 6px;
  color: var(--parchment-muted);
}
.rulecard-from { margin-left: auto; color: var(--parchment-muted); }
.rulecard-title {
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--parchment);
  font-weight: 700;
}
.rulecard-subtitle { color: var(--parchment-muted); font-size: 11px; margin-top: 1px; }
.rulecard-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 7px; }
.rulecard-meta span {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-soft);
  color: var(--parchment-dim);
}
.rulecard-meta span b { color: var(--parchment-muted); font-weight: 600; }
.rulecard-section { margin-top: 8px; }
.rulecard-section-label {
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--parchment-muted);
  font-family: var(--font-mono);
  margin-bottom: 2px;
}
.rulecard-text { line-height: 1.5; color: var(--parchment-dim); }
.rulecard-translation {
  margin-top: 9px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255,255,255,0.03);
}
.rulecard-translation-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--parchment);
  text-align: left;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.rulecard-translation-toggle:hover { background: rgb(255 255 255 / .04); }
.rulecard-translation-icon { color: var(--gold-strong); }
.rulecard-translation-body {
  padding: 0 9px 9px;
  line-height: 1.5;
  color: var(--parchment-dim);
}

.send-to-chat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.send-to-chat-btn {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.05);
  color: var(--parchment);
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-display);
  letter-spacing: 0.4px;
}
.send-to-chat-btn:hover { background: rgba(255,255,255,0.10); }
.send-to-chat-btn[disabled] { opacity: 0.55; cursor: default; }
.send-to-chat-note { font-size: 11px; color: var(--parchment-muted); }
.send-to-chat-note.error { color: var(--danger, #e68e8e); }

html[data-theme="light"] #chat-log .msg.rulecard,
html[data-theme="light"] .send-to-chat-btn {
  background: var(--theme-panel-bg);
  border-color: rgba(168,120,40,0.20);
}
html[data-theme="light"] .rulecard-meta span,
html[data-theme="light"] .rulecard-translation {
  background: rgba(168,120,40,0.10);
  border-color: rgba(168,120,40,0.20);
}
html[data-theme="light"] #chat-log {
  background: rgba(255,255,255,0.22);
}
html[data-theme="light"] #chat-form {
  border-top-color: rgba(168,120,40,0.18);
}
html[data-theme="light"] #chat-form input {
  border-color: rgba(168,120,40,0.22);
  background: var(--theme-panel-input-bg);
}
html[data-theme="light"] #chat-form button {
  background: var(--theme-chip-bg);
  border: 1px solid rgba(168,120,40,0.22);
}
html[data-theme="light"] #chat-form button:hover {
  background: var(--accent-hover);
  color: #fff;
}
