/* =========================================================
   THE ROYAL AUDIENCE: styles
   Uses the Kingdom's palette and fonts from styles.css.
   ========================================================= */
:root { --kwc-floor: 18px; }

/* ---------- The bell ---------- */
.kwc-bell {
  position: fixed; right: 18px; bottom: var(--kwc-floor); z-index: 78;
  display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px;
  background: var(--oxblood, #7a1f1f); color: var(--paper-light, #fbf4e2);
  border: 2px solid var(--ink, #1b1612); border-radius: 40px; cursor: pointer;
  box-shadow: 0 0 0 3px var(--gold, #d4a017), 0 0 0 5px var(--ink, #1b1612), 0 14px 28px -10px rgba(40,15,5,.6);
  font-family: var(--heraldic, Georgia, serif); font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  transition: transform .2s ease, background .2s ease;
}
.kwc-bell:hover { background: var(--oxblood-deep, #521212); transform: translateY(-2px); }
.kwc-bell:focus-visible { outline: 3px solid var(--stamp-blue, #2f4f8f); outline-offset: 6px; }
.kwc-bell__icon { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6d6, #f1e6cf 60%, #d9c79f); border: 2px solid var(--ink, #1b1612); display: grid; place-items: center; }
.kwc-bell__icon svg { width: 34px; height: 34px; overflow: visible; }
.kwc-bell__label { display: flex; flex-direction: column; line-height: 1.05; font-size: 14px; text-align: left; }
.kwc-bell__label small { font-size: 9.5px; letter-spacing: .22em; color: #f3cf63; }
.kwc-bell .kwc-bell__body { transform-origin: 24px 10px; transform-box: view-box; }
.kwc-bell .kwc-bell__clapper { transform-origin: 24px 30px; transform-box: view-box; }
.kwc-bell.is-ringing .kwc-bell__body { animation: kwc-swing .9s ease-out; }
.kwc-bell.is-ringing .kwc-bell__clapper { animation: kwc-clap .9s ease-out; }
.kwc-bell.is-open { background: var(--ink, #1b1612); }
@keyframes kwc-swing { 0% { transform: rotate(0); } 15% { transform: rotate(18deg); } 35% { transform: rotate(-14deg); } 55% { transform: rotate(9deg); } 75% { transform: rotate(-5deg); } 100% { transform: rotate(0); } }
@keyframes kwc-clap { 0% { transform: rotate(0); } 15% { transform: rotate(-22deg); } 35% { transform: rotate(18deg); } 55% { transform: rotate(-10deg); } 100% { transform: rotate(0); } }

/* ---------- The panel ---------- */
.kwc-panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--paper-light, #fbf4e2); background-image: var(--grain);
  color: var(--ink, #1b1612); font-family: var(--body, Georgia, serif);
  border: 2px solid var(--ink, #1b1612); outline: 1px solid var(--ink, #1b1612); outline-offset: -7px;
}
.kwc-panel[hidden] { display: none !important; }
.kwc-panel--float {
  position: fixed; z-index: 86; right: 18px; bottom: calc(var(--kwc-floor) + 74px);
  width: min(420px, calc(100vw - 36px)); height: min(640px, calc(100vh - var(--kwc-floor) - 110px));
  box-shadow: 0 0 0 4px var(--gold, #d4a017), 0 0 0 6px var(--ink, #1b1612), 0 30px 60px -20px rgba(40,15,5,.6);
  opacity: 0; transform: translateY(12px) scale(.985); transform-origin: bottom right; transition: opacity .2s ease, transform .25s ease;
}
.kwc-panel--float.is-shown { opacity: 1; transform: none; }
.kwc-panel--inline { height: 600px; box-shadow: var(--shadow); }

.kwc-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px 16px; border-bottom: 3px double var(--ink, #1b1612); background: linear-gradient(180deg, rgba(212,160,23,.18), rgba(212,160,23,0)); }
.kwc-head__crest svg { width: 32px; height: 37px; display: block; }
.kwc-head__titles { flex: 1; min-width: 0; }
.kwc-head__title { font-family: var(--display, Georgia, serif); font-weight: 900; font-size: 22px; line-height: 1.05; margin: 0; }
.kwc-head__sub { margin: 3px 0 0; font-family: var(--mono, monospace); font-size: 11.5px; color: var(--ink-soft, #3b322a); display: flex; align-items: center; gap: 6px; }
.kwc-head__lamp { width: 8px; height: 8px; border-radius: 50%; background: var(--celery, #7d8b3a); box-shadow: 0 0 0 2px rgba(125,139,58,.25); flex: none; }
.kwc-head__tools { display: flex; gap: 6px; align-items: center; }
.kwc-tool { font-family: var(--heraldic, Georgia, serif); font-weight: 700; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; background: transparent; color: var(--ink, #1b1612); border: 1px solid var(--ink, #1b1612); padding: 6px 8px; cursor: pointer; }
.kwc-tool:hover { background: var(--ink, #1b1612); color: var(--paper-light, #fbf4e2); }
.kwc-tool--close { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; }
.kwc-tool--close svg { width: 16px; height: 16px; }
.kwc-tool:focus-visible, .kwc-mode:focus-visible, .kwc-chip:focus-visible, .kwc-link:focus-visible, .kwc-send:focus-visible, .kwc-log:focus-visible { outline: 3px solid var(--stamp-blue, #2f4f8f); outline-offset: 2px; }

.kwc-modes { display: flex; gap: 0; margin: 10px 16px 0; border: 1.5px solid var(--ink, #1b1612); }
.kwc-mode { flex: 1; font-family: var(--heraldic, Georgia, serif); font-weight: 700; font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; padding: 7px 8px; background: transparent; color: var(--ink, #1b1612); border: 0; cursor: pointer; }
.kwc-mode + .kwc-mode { border-left: 1.5px solid var(--ink, #1b1612); }
.kwc-mode[aria-pressed="true"] { background: var(--oxblood, #7a1f1f); color: var(--paper-light, #fbf4e2); }

.kwc-log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
.kwc-msg { margin: 0 0 14px; max-width: 92%; }
.kwc-msg__who { margin: 0 0 3px; font-family: var(--heraldic, Georgia, serif); font-weight: 700; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--oxblood, #7a1f1f); display: flex; align-items: center; gap: 6px; }
.kwc-msg__crest svg { width: 14px; height: 16px; display: block; }
.kwc-msg__text { margin: 0 0 6px; font-size: 15.5px; line-height: 1.5; }
.kwc-msg--king .kwc-msg__text { background: #fffdf6; border: 1px solid rgba(27,22,18,.35); border-left: 3px solid var(--gold, #d4a017); padding: 9px 12px; box-shadow: 2px 2px 0 rgba(27,22,18,.12); }
.kwc-msg--king .kwc-msg__text + .kwc-msg__text { margin-top: -2px; }
.kwc-msg--user { margin-left: auto; text-align: right; }
.kwc-msg--user .kwc-msg__who { justify-content: flex-end; color: var(--ink-soft, #3b322a); }
.kwc-msg--user .kwc-msg__text { display: inline-block; text-align: left; font-family: var(--type, monospace); font-size: 14.5px; background: rgba(47,79,143,.08); border: 1px dashed rgba(47,79,143,.55); padding: 8px 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kwc-msg--decree { max-width: 100%; }
.kwc-note { text-align: center; font-family: var(--heraldic, Georgia, serif); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft, #3b322a); margin: 4px 8px 14px; border-top: 1px solid rgba(27,22,18,.25); border-bottom: 1px solid rgba(27,22,18,.25); padding: 6px 4px; line-height: 1.5; }
.kwc-source { margin: 0 0 4px; font-size: .78rem; opacity: .8; }
.kwc-source__link { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.kwc-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.kwc-link { display: inline-block; font-family: var(--heraldic, Georgia, serif); font-weight: 700; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink, #1b1612); background: linear-gradient(180deg, #f6d872, #d4a017 60%, #b88a14); border: 1px solid var(--ink, #1b1612); padding: 5px 10px; text-decoration: none; box-shadow: 2px 2px 0 rgba(27,22,18,.85); cursor: pointer; }
.kwc-link:hover { filter: brightness(1.06); }
.kwc-link--btn { margin-top: 4px; }
.kwc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.kwc-chip { font-family: var(--mono, monospace); font-size: 12.5px; text-align: left; background: transparent; border: 1px dashed var(--ink-soft, #3b322a); color: var(--ink, #1b1612); padding: 5px 9px; cursor: pointer; }
.kwc-chip:hover { background: rgba(212,160,23,.18); border-style: solid; }
.kwc-msg--user + .kwc-chips, .kwc-note .kwc-chips { justify-content: center; }
.kwc-note .kwc-chips { text-transform: none; letter-spacing: 0; margin-top: 10px; }
.kwc-typing { font-family: var(--display, Georgia, serif); font-style: italic; color: var(--ink-soft, #3b322a); margin: 0 0 12px; font-size: 14.5px; }
.kwc-typing__dots i { font-style: normal; display: inline-block; animation: kwc-dot 1.2s infinite; }
.kwc-typing__dots i:nth-child(2) { animation-delay: .2s; }
.kwc-typing__dots i:nth-child(3) { animation-delay: .4s; }
@keyframes kwc-dot { 0%, 60%, 100% { opacity: .2; } 30% { opacity: 1; } }

.kwc-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px 6px; border-top: 3px double var(--ink, #1b1612); }
.kwc-input { flex: 1; min-width: 0; resize: none; font-family: var(--type, monospace); font-size: 16px; line-height: 1.4; color: var(--ink, #1b1612); background: #fffdf6; border: 1.5px solid var(--ink, #1b1612); padding: 9px 10px; max-height: 120px; }
.kwc-input:focus { outline: 3px solid rgba(212,160,23,.7); outline-offset: 0; }
.kwc-send { font-family: var(--heraldic, Georgia, serif); font-weight: 700; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; background: var(--oxblood, #7a1f1f); color: var(--paper-light, #fbf4e2); border: 1.5px solid var(--ink, #1b1612); box-shadow: 3px 3px 0 var(--ink, #1b1612); padding: 10px 12px; cursor: pointer; white-space: nowrap; max-width: 46%; }
.kwc-send:disabled { opacity: .55; cursor: progress; }
.kwc-send:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink, #1b1612); }
.kwc-panel--petition .kwc-send { white-space: normal; line-height: 1.2; }
.kwc-hint { margin: 0; padding: 0 14px 10px; font-family: var(--mono, monospace); font-size: 11px; color: var(--ink-soft, #3b322a); }

/* ---------- Decrees within the audience ---------- */
.kwc-decree { position: relative; margin: 6px 0 8px; padding: 18px 18px 16px; background: #fffaf0; background-image: var(--grain); border: 1px solid var(--ink, #1b1612); outline: 3px double var(--ink, #1b1612); outline-offset: -8px; box-shadow: 3px 4px 0 rgba(27,22,18,.18); font-size: 13.5px; line-height: 1.45; overflow: hidden; }
.kwc-decree p { margin: 0 0 7px; }
.kwc-decree__h { font-family: var(--heraldic, Georgia, serif); font-weight: 800; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--oxblood, #7a1f1f); text-align: center; margin-top: 4px !important; }
.kwc-decree__no { font-family: var(--display, Georgia, serif); font-weight: 900; font-size: 20px; text-align: center; margin: 0 0 2px; line-height: 1.1; }
.kwc-decree__title { font-family: var(--heraldic, Georgia, serif); font-weight: 700; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.kwc-decree__date { font-size: 12px; text-align: center; color: var(--ink-soft, #3b322a); font-style: italic; }
.kwc-decree__quote { margin: 8px 0 10px; border-left: 3px solid var(--oxblood, #7a1f1f); padding-left: 10px; font-style: italic; color: var(--ink-soft, #3b322a); overflow-wrap: anywhere; }
.kwc-decree__whereas p { font-size: 13px; }
.kwc-decree__now { font-family: var(--heraldic, Georgia, serif); font-size: 11.5px !important; font-weight: 700; letter-spacing: .04em; }
.kwc-decree__arts { margin: 0 0 8px; padding: 0; list-style: none; }
.kwc-decree__arts li { margin: 0 0 6px; padding-left: 1.4em; text-indent: -1.4em; }
.kwc-decree__arts b { font-family: var(--heraldic, Georgia, serif); color: var(--oxblood, #7a1f1f); font-size: 12px; }
.kwc-decree__pen, .kwc-decree__signoff { font-size: 13px; }
.kwc-decree__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 6px; }
.kwc-decree__sig { font-family: var(--display, Georgia, serif); font-style: italic; font-size: 22px; margin: 0 !important; }
.kwc-decree__counter { font-size: 11px; color: var(--ink-soft, #3b322a); margin: 0 !important; max-width: 14em; }
.kwc-decree__seal { flex: none; width: 76px; height: 76px; }
.kwc-seal { width: 100%; height: 100%; display: block; }
.kwc-decree__stamp { position: absolute; bottom: 34px; right: 96px; font-family: var(--heraldic, Georgia, serif); font-weight: 800; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--stamp-blue, #2f4f8f); border: 2.5px solid currentColor; padding: 3px 7px; transform: rotate(9deg); opacity: .8; mix-blend-mode: multiply; }
.kwc-decree.is-new .kwc-decree__seal { opacity: 0; transform: scale(1.7) rotate(-25deg); transition: opacity .3s ease .35s, transform .45s cubic-bezier(.3,1.6,.5,1) .35s; }
.kwc-decree.is-new .kwc-decree__stamp { opacity: 0; transition: opacity .25s ease .7s; }
.kwc-decree.is-new.is-sealed .kwc-decree__seal { opacity: 1; transform: rotate(-8deg); }
.kwc-decree.is-new.is-sealed .kwc-decree__stamp { opacity: .8; }
.kwc-decree.is-sealed:not(.is-new) .kwc-decree__seal { transform: rotate(-8deg); }

/* ---------- The Audience Chamber (Petition section) ---------- */
.audience-chamber { max-width: 1100px; margin: 56px auto 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 34px; align-items: start; }
.audience-chamber__intro h3 { font-family: var(--display, Georgia, serif); font-weight: 900; font-size: 30px; line-height: 1.1; margin: 4px 0 12px; }
.audience-chamber__intro .section__num { margin: 0; }
.audience-chamber__intro p { font-size: 16.5px; }
.audience-chamber__rules { list-style: none; padding: 0; margin: 14px 0 0; font-family: var(--mono, monospace); font-size: 13px; color: var(--ink-soft, #3b322a); }
.audience-chamber__rules li { padding: 6px 0 6px 22px; border-top: 1px dashed rgba(27,22,18,.3); position: relative; }
.audience-chamber__rules li::before { content: "\2726"; position: absolute; left: 2px; color: var(--gold-deep, #9c7410); }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .kwc-bell { right: 12px; padding: 5px; }
  .kwc-bell__label { display: none; }
  .kwc-panel--float { inset: 0; width: auto; height: auto; height: 100dvh; right: 0; bottom: 0; border: 0; outline: 0; box-shadow: none; transform-origin: bottom center; }
  .kwc-is-open .kwc-bell { display: none; }
  .kwc-head { padding: 12px 10px 8px 12px; }
  .kwc-head__title { font-size: 19px; }
  .kwc-modes { margin: 8px 12px 0; }
  .kwc-log { padding: 12px 12px 8px; }
  .kwc-msg { max-width: 100%; }
  .kwc-form { padding: 8px 10px 4px; }
  .kwc-hint { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  .kwc-panel--inline { height: 80vh; height: 80dvh; min-height: 520px; max-height: 720px; }
  .kwc-decree__stamp { right: 88px; bottom: 30px; }
  .audience-chamber { grid-template-columns: 1fr; gap: 18px; margin-top: 40px; }
  .audience-chamber__intro h3 { font-size: 25px; }
  .kwc-decree { padding: 16px 13px 14px; }
}
@media (max-width: 980px) and (min-width: 721px) { .audience-chamber { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .kwc-bell, .kwc-panel--float { transition: none; }
  .kwc-panel--float { opacity: 1; transform: none; }
  .kwc-bell.is-ringing .kwc-bell__body, .kwc-bell.is-ringing .kwc-bell__clapper, .kwc-typing__dots i { animation: none; }
  .kwc-typing__dots i { opacity: .6; }
  .kwc-log { scroll-behavior: auto; }
  .kwc-decree.is-new .kwc-decree__seal, .kwc-decree.is-new .kwc-decree__stamp { transition: none; }
}
@media print { .kwc-bell, .kwc-panel--float, .audience-chamber { display: none !important; } }
