:root {
  --red: #c9231e;
  --red-dark: #a91b18;
  --teal: #078d99;
  --cream: #fff9f0;
  --pink: #fde4df;
  --ink: #4d2d27;
  --muted: #7a625d;
  --card: #fffdf9;
  --border: rgba(201, 35, 30, 0.42);
  --shadow: 0 7px 22px rgba(80, 34, 29, 0.12);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--red); }
body { margin: 0; min-width: 300px; min-height: 100dvh; background: var(--cream); }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--red);
  color: white;
  padding-top: env(safe-area-inset-top);
  box-shadow: 0 2px 10px rgba(74, 22, 20, 0.18);
}
.header-inner, .section-inner { width: min(100% - 28px, 1000px); margin-inline: auto; }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { min-width: 0; display: flex; align-items: center; gap: 10px; color: white; text-decoration: none; }
.brand-logo { width: 50px; height: 50px; flex: 0 0 auto; overflow: hidden; border-radius: 50%; background: white; border: 2px solid rgba(255,255,255,.55); }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-copy { min-width: 0; display: grid; }
.brand-copy strong { font: 900 italic clamp(1.15rem, 4.8vw, 1.85rem)/1 Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-copy small { margin-top: 5px; font-size: clamp(.47rem, 1.85vw, .68rem); line-height: 1.1; font-weight: 800; text-transform: uppercase; letter-spacing: .11em; opacity: .9; white-space: nowrap; }
.outline-button { flex: 0 0 auto; border: 1px solid rgba(255,255,255,.75); border-radius: 999px; background: transparent; color: white; padding: 9px 12px; font-size: .7rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.outline-button:hover, .outline-button:focus-visible { background: white; color: var(--red); }

.quick-links { background: color-mix(in srgb, var(--pink) 74%, white); border-bottom: 2px solid var(--red); }
.section-inner { padding-block: 25px; }
.rule-title { display: flex; align-items: center; gap: 14px; color: var(--red); }
.rule-title span { height: 1px; flex: 1; background: var(--border); }
.rule-title h1, .rule-title h2 { margin: 0; font: 800 italic 1.45rem/1.15 Georgia, serif; white-space: nowrap; }
.document-grid { display: grid; gap: 14px; margin-top: 20px; }
.document-card { display: flex; min-width: 0; min-height: 116px; overflow: hidden; border: 2px solid; border-radius: 13px; background: var(--card); color: var(--ink); text-decoration: none; box-shadow: 0 2px 6px rgba(78, 37, 31, .08); transition: transform .18s ease, box-shadow .18s ease; }
.document-card:hover, .document-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); }
.red-card { border-color: var(--red); }
.teal-card { border-color: var(--teal); }
.card-image { width: 116px; flex: 0 0 116px; display: grid; place-items: center; border-right: 2px dashed var(--border); }
.card-image img { width: 112px; height: 112px; object-fit: contain; }
.red-tint { background: rgba(201, 35, 30, .08); }
.teal-tint { background: rgba(7, 141, 153, .09); }
.pink-tint { background: rgba(253, 228, 223, .82); }
.card-label { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; padding: 13px; }
.card-label > b { flex: 0 0 auto; border-radius: 999px; background: var(--red); color: white; padding: 4px 7px; font-size: .61rem; letter-spacing: .08em; }
.teal-card .card-label > b { background: var(--teal); }
.card-label > span { min-width: 0; display: grid; gap: 5px; }
.card-label strong { font: 800 italic 1.08rem/1.05 Georgia, serif; color: var(--red); }
.teal-card .card-label strong { color: var(--teal); }
.card-label small { color: var(--muted); font-size: .61rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.card-label i { margin-left: auto; align-self: flex-start; color: var(--red); font-style: normal; font-size: 1.2rem; }
.teal-card .card-label i { color: var(--teal); }

.chat-section { min-height: 390px; }
.chat-inner { padding-bottom: calc(165px + env(safe-area-inset-bottom)); }
.status-row { min-height: 35px; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #9a8e8b; }
.connection-dot.online { background: #2a9d4b; }
.connection-dot.offline { background: #e28522; }
.text-button { margin-left: 7px; border: 0; background: none; color: var(--red); padding: 5px; font-size: .72rem; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; }
.messages { display: grid; gap: 20px; margin-top: 8px; }
.message { display: flex; align-items: flex-start; gap: 10px; }
.message:last-child { scroll-margin-bottom: calc(145px + env(safe-area-inset-bottom)); }
.message > div { min-width: 0; max-width: min(82%, 700px); }
.message small { display: block; margin-top: 5px; color: var(--muted); font-size: .58rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.avatar { width: 41px; height: 41px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--red); background: var(--cream); object-fit: cover; }
.bubble { white-space: pre-wrap; overflow-wrap: anywhere; border: 2px solid var(--border); border-radius: 13px; background: var(--card); padding: 12px 14px; line-height: 1.55; box-shadow: 0 2px 5px rgba(78, 37, 31, .07); }
.user-message { justify-content: flex-end; }
.user-message .bubble { border-color: var(--red); background: var(--red); color: white; }
.answer-mode { margin-top: 8px; color: var(--muted); font-size: .63rem; font-weight: 800; }
.typing { display: flex; gap: 5px; width: fit-content; padding-block: 17px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: bounce .9s infinite alternate; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { to { transform: translateY(-6px); opacity: .55; } }

.suggestions { margin-top: 30px; }
.suggestions h3 { margin: 0 0 14px; color: var(--red); font: 800 italic 1.35rem/1 Georgia, serif; }
.suggestion-grid { display: grid; gap: 10px; }
.suggestion-grid button { min-height: 48px; border: 2px solid var(--teal); border-radius: 8px; background: transparent; color: var(--teal); padding: 10px 13px; text-align: left; font-size: .82rem; font-weight: 800; }
.suggestion-grid button:hover, .suggestion-grid button:focus-visible { background: var(--teal); color: white; }

.composer-shell { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; padding: 12px 14px calc(9px + env(safe-area-inset-bottom)); background: rgba(255,249,240,.97); border-top: 1px solid var(--border); backdrop-filter: blur(12px); }
.composer { width: min(100%, 970px); margin: auto; display: flex; align-items: flex-end; gap: 8px; border: 2px solid var(--red); border-radius: 17px; background: white; padding: 7px; box-shadow: var(--shadow); }
.composer textarea { min-height: 42px; max-height: 120px; flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 10px 8px 7px; line-height: 1.35; }
.composer textarea::placeholder { color: #9b8580; }
.icon-button, .send-button { width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 50%; display: grid; place-items: center; }
.icon-button { background: transparent; color: var(--muted); }
.send-button { background: var(--red); color: white; font-size: 1.35rem; font-weight: 900; }
.send-button:disabled { cursor: wait; opacity: .55; }
.composer-shell > p { width: min(100%, 970px); margin: 7px auto 0; color: var(--muted); text-align: center; font-size: .6rem; line-height: 1.25; }

.install-dialog { width: min(92%, 410px); border: 2px solid var(--red); border-radius: 18px; background: var(--cream); color: var(--ink); padding: 25px; text-align: center; box-shadow: 0 18px 60px rgba(67,25,22,.3); }
.install-dialog::backdrop { background: rgba(59,29,26,.55); backdrop-filter: blur(3px); }
.install-dialog img { width: 82px; height: 82px; margin: auto; border-radius: 18px; }
.install-dialog h2 { color: var(--red); font: 900 italic 1.65rem Georgia, serif; }
.install-dialog p, .install-dialog ol { text-align: left; line-height: 1.5; }
.dialog-close { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--red); font-size: 1.8rem; }
.primary-button { border: 0; border-radius: 999px; background: var(--red); color: white; padding: 11px 20px; font-weight: 900; }

:focus-visible { outline: 3px solid #1768ac; outline-offset: 3px; }

@media (min-width: 650px) {
  .header-inner { min-height: 90px; }
  .brand-logo { width: 64px; height: 64px; }
  .outline-button { padding-inline: 18px; font-size: .78rem; }
  .section-inner { padding-block: 31px; }
  .document-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .document-card { display: flex; flex-direction: column; }
  .card-image { width: auto; height: 154px; flex-basis: 154px; border-right: 0; border-bottom: 2px dashed var(--border); }
  .card-image img { width: 150px; height: 150px; }
  .suggestion-grid { grid-template-columns: repeat(2, 1fr); }
  .chat-inner { padding-bottom: calc(155px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .header-inner, .section-inner { width: min(100% - 20px, 1000px); }
  .brand-logo { width: 44px; height: 44px; }
  .outline-button { padding: 8px 9px; font-size: .61rem; }
  .outline-button span { display: none; }
  .card-image { width: 96px; flex-basis: 96px; }
  .card-image img { width: 94px; height: 94px; }
  .card-label { padding: 10px; gap: 7px; }
  .card-label strong { font-size: .98rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
