/* Rules assistant: a tab on the right edge that slides out a chat with Claude (public/js/rules-chat.js) */
.rc-tab {
  position: fixed; right: 0; top: 58%; z-index: 41; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 5px 12px; border: 3px solid var(--gold); border-right: 0; border-radius: 6px 0 0 6px;
  background: linear-gradient(90deg, #8a6d2e, #4f3d16); color: var(--gold-hi); cursor: pointer;
  box-shadow: 0 0 0 2px #000, -3px 3px 10px #0009; font-family: var(--pixel); font-size: 8px; letter-spacing: 2px;
}
.rc-tab .rc-tab-ico { font-size: 13px; line-height: 1; }
.rc-tab .rc-tab-text { writing-mode: vertical-rl; transform: rotate(180deg); }
@media (hover: hover) { .rc-tab:hover { background: linear-gradient(90deg, #a8873c, #644d1c); color: #fff; } }
.rc-tab:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
/* the GM tools drawer uses the same edge */
#drawer:not(.hidden) ~ .rc-tab, .rc-open .rc-tab { display: none; }

.rc-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 42; width: min(440px, 100%);
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 0;
  border-right: 0; border-top: 0; border-bottom: 0;
  transform: translateX(105%); transition: transform .18s ease-out; visibility: hidden;
}
.rc-open .rc-panel { transform: none; visibility: visible; }
.rc-head { display: flex; align-items: center; gap: 6px; }
.rc-head h3 { flex: 1; margin: 0; font-size: 11px; }
.rc-head .btn { flex: none; }
.rc-note { font-size: 17px; line-height: 1.2; color: var(--muted); }
.rc-note b { color: var(--text); font-weight: normal; }
.rc-note.warn { color: var(--neutral); }

.rc-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 8px; overscroll-behavior: contain; }
.rc-msg { max-width: 92%; padding: 8px 10px; border-radius: 6px; font-size: 19px; line-height: 1.25; overflow-wrap: anywhere; }
.rc-msg.you { align-self: flex-end; background: #2a3a24; border: 2px solid #5a7a4a; white-space: pre-wrap; }
.rc-msg.bot { align-self: flex-start; background: #17140c; border: 2px solid #6d5d34; }
.rc-msg.err { align-self: flex-start; background: #2a1210; border: 2px solid var(--bad); color: #ffd0c8; }
.rc-msg.bot p { margin: 0 0 8px; }
.rc-msg.bot p:last-child, .rc-msg.bot ul:last-child, .rc-msg.bot ol:last-child, .rc-msg.bot table:last-child { margin-bottom: 0; }
.rc-msg.bot ul, .rc-msg.bot ol { margin: 0 0 8px; padding-left: 22px; }
.rc-msg.bot li { margin: 2px 0; }
.rc-msg.bot strong { color: var(--gold-hi); font-weight: normal; }
.rc-msg.bot em { color: #e8dcb8; }
.rc-msg.bot code { font-family: ui-monospace, monospace; font-size: 13px; background: #000a; padding: 1px 4px; border-radius: 3px; }
.rc-msg.bot pre { margin: 0 0 8px; padding: 6px 8px; background: #000a; border-radius: 4px; overflow-x: auto; }
.rc-msg.bot pre code { background: none; padding: 0; white-space: pre; }
.rc-msg.bot .rc-h { display: block; margin: 6px 0 4px; font-family: var(--pixel); font-size: 9px; letter-spacing: 1px; color: var(--gold-hi); }
.rc-msg.bot .rc-cite { color: var(--gold); white-space: nowrap; }
.rc-msg.bot table { border-collapse: collapse; margin: 0 0 8px; font-size: 17px; display: block; overflow-x: auto; }
.rc-msg.bot th, .rc-msg.bot td { border: 1px solid #5a5236; padding: 2px 6px; text-align: left; vertical-align: top; }
.rc-msg.bot th { color: var(--gold-hi); font-weight: normal; background: #0006; }
.rc-msg .rc-cost { display: block; margin-top: 6px; font-size: 15px; color: var(--muted); }
.rc-interim { align-self: flex-start; max-width: 92%; font-size: 16px; color: var(--muted); font-style: italic; padding: 0 10px; }
.rc-status { align-self: flex-start; font-size: 17px; color: var(--gold); padding: 0 10px; }
.rc-status::after { content: ''; animation: rc-dots 1.2s steps(4) infinite; }
@keyframes rc-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

.rc-welcome { color: var(--muted); font-size: 18px; line-height: 1.3; }
.rc-welcome p { margin: 0 0 8px; }
.rc-ideas { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.rc-ideas button { font-family: var(--body); font-size: 18px; text-align: left; color: var(--text); background: #0006; border: 2px dashed #5a5236; border-radius: 4px; padding: 4px 8px; cursor: pointer; }
@media (hover: hover) { .rc-ideas button:hover { border-color: var(--gold); color: #fff; } }

.rc-form { display: flex; gap: 6px; align-items: flex-end; }
.rc-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 160px; font-family: var(--body); font-size: 19px; line-height: 1.2; }
.rc-form .btn { flex: none; min-height: 44px; }
.rc-foot { font-size: 15px; line-height: 1.2; color: var(--muted); }

.rc-gm { border-top: 1px dashed #5a5236; padding-top: 6px; font-size: 17px; }
.rc-gm summary { cursor: pointer; font-family: var(--pixel); font-size: 8px; color: var(--gold); letter-spacing: 1px; padding: 4px 0; }
.rc-gm .rc-gm-body { display: flex; flex-direction: column; gap: 6px; max-height: 38vh; overflow-y: auto; padding: 4px 0; }
.rc-gm .rc-book { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.rc-gm .rc-book span { flex: 1; }
.rc-gm .ok { color: var(--good); }
.rc-gm .missing { color: var(--neutral); }
.rc-gm input[type=file] { font-size: 16px; padding: 2px; min-width: 0; }
.rc-gm .rc-book .btn { white-space: nowrap; }

@media (max-width: 600px) {
  .rc-panel { width: 100%; border-left: 0; padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); }
  .rc-tab { top: auto; bottom: 84px; transform: none; padding: 7px 3px 9px; font-size: 7px; }
  .rc-form textarea { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .rc-panel { transition: none; } .rc-status::after { animation: none; content: '…'; } }
