.safety-panel { padding: clamp(20px, 4vw, 36px); }
.safety-panel p,.safety-dialog p,.legal-page p,.legal-page li { font: 1rem/1.65 system-ui,sans-serif; }
.safety-dialog { box-sizing: border-box; width: min(640px,calc(100% - 24px)); max-height: 88dvh; overflow-y: auto; border: 1px solid #99917e; padding: clamp(20px,4vw,36px); color: #20201c; background: #f2efdf; }
.safety-dialog::backdrop { background: #080808bd; }
.safety-dialog h2,.legal-page h1 { font-size: clamp(1.8rem,5vw,2.5rem); }
.safety-dialog label,.safety-panel label,.legal-page label { display: block; margin: 16px 0; font: 1rem/1.5 system-ui,sans-serif; }
.safety-dialog input:not([type=checkbox]),.safety-dialog select,.safety-dialog textarea,.safety-panel select,.legal-page input { display:block;box-sizing:border-box;width:100%;padding:12px;margin-top:6px;font:16px/1.5 system-ui,sans-serif;color:#20201c;background:#fffdf5;border:1px solid #8d8879; }
.safety-dialog input[type=checkbox] { width:20px;height:20px;vertical-align:middle; }
.safety-dialog button,.safety-panel button,.profile-safety button,.legal-page button { min-height:44px;padding:10px 16px;margin:5px 8px 5px 0;font:600 16px/1.4 system-ui,sans-serif;cursor:pointer; }
.safety-dialog button:not(.primary),.safety-panel button:not(.primary),.profile-safety button,.legal-page button {background:#f9f6e9;border:1px solid #6f6a5c;color:#20201c;}
.safety-dialog .quiet-danger {border-color:#aa3029!important;color:#982720!important;}
.safety-dialog a,.safety-panel a,.safety-footer a,.legal-page a { text-decoration:underline; text-underline-offset:3px; }
.safety-footer { display:flex;flex-wrap:wrap;justify-content:center;gap:20px;padding:30px 20px calc(100px + env(safe-area-inset-bottom));font:16px/1.5 system-ui,sans-serif; }
#safetyQueue {display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:20px;margin:20px 0;}
.safety-photo img {width:100%;max-height:260px;object-fit:contain;background:#242424;}
.safety-report {overflow-wrap:anywhere;}.safety-report blockquote {border-left:3px solid #ee5446;padding-left:12px;white-space:pre-wrap;}
#safetyAudit {max-height:280px;overflow:auto;}#exportResult a {display:block;margin:12px 0;}
.legal-page {max-width:760px;margin:40px auto;padding:28px;background:#f2efdf;color:#20201c;box-sizing:border-box;font-family:system-ui,sans-serif;}
.legal-body {margin:0;background:#181818;}.legal-page h2 {margin-top:32px;}.legal-page nav {display:flex;gap:18px;flex-wrap:wrap;}
.match-explanation [hidden] {display:none!important;}
@media(max-width:600px){.legal-page{margin:0;padding:24px;}.safety-report{display:block;}.safety-footer{gap:16px;}.safety-dialog{max-height:90dvh;}}
.legal-page table {width:100%;border-collapse:collapse;margin:12px 0;font:0.95rem/1.5 system-ui,sans-serif;}
.legal-page th,.legal-page td {padding:8px;border-bottom:1px solid #c9c2ad;text-align:left;vertical-align:top;}
.not-found {text-align:left;}
.not-found .not-found-mark {display:block;color:#ef4b3f;font:400 clamp(4rem,18vw,7rem)/1 "Yu Mincho","MS Mincho",serif;}
.not-found .not-found-home {display:inline-block;margin-top:12px;padding:12px 18px;color:#f2efdf;background:#20201c;text-decoration:none;font-weight:600;}
@media(max-width:600px){.legal-page table,.legal-page tbody,.legal-page tr,.legal-page td{display:block;}.legal-page thead{display:none;}.legal-page td{border-bottom:0;padding:4px 0;}.legal-page tr{padding:8px 0;border-bottom:1px solid #c9c2ad;}}

/* Legal pages, reading edition. Everything below is scoped to .legal-body / .legal-page,
   so the in-app safety dialog and panel above keep their look. */
.legal-body {min-height:100vh;background:#171719;}
.legal-page {position:relative;max-width:800px;margin:48px auto 64px;padding:clamp(24px,6vw,64px);border-top:6px solid #ef4b3f;box-shadow:9px 9px 0 #080808;}
.legal-page [hidden] {display:none!important;}
.legal-page p,.legal-page li {font:1.0625rem/1.7 system-ui,sans-serif;max-width:68ch;}
.legal-page li + li {margin-top:6px;}
.legal-page h1 {margin:.15em 0 .3em;font:400 clamp(2.1rem,6vw,3.1rem)/1.08 Georgia,"Times New Roman",serif;letter-spacing:-.01em;}
.legal-page h2 {margin:52px 0 12px;padding-top:22px;border-top:1px solid #c9c2ad;font:400 clamp(1.45rem,4vw,1.8rem)/1.2 Georgia,"Times New Roman",serif;scroll-margin-top:24px;}
.legal-page h2::before {content:"";display:block;width:36px;height:3px;margin-bottom:14px;background:#ef4b3f;}
.legal-page h3 {margin:28px 0 6px;font:700 1.0625rem/1.4 system-ui,sans-serif;scroll-margin-top:24px;}
.legal-page a {color:#20201c;text-decoration-color:#b3302a;}
.legal-page a:hover {color:#982720;}
.legal-page a.not-found-home:hover {color:#f2efdf;background:#3a3a33;}
.legal-page :is(a,button,input,select,textarea):focus-visible {outline:3px solid #ef4b3f;outline-offset:2px;}
.legal-page strong {font-weight:700;}
.legal-page code,.legal-ticket,.legal-receipt {font-family:ui-monospace,"Cascadia Mono",Consolas,monospace;}

.legal-page nav.legal-nav {align-items:center;gap:0 20px;margin:calc(-1 * clamp(8px,2vw,24px)) 0 32px;padding-bottom:10px;border-bottom:1px solid #c9c2ad;}
.legal-nav a {display:inline-flex;align-items:center;min-height:44px;font:600 .95rem/1.2 system-ui,sans-serif;}
.legal-nav a[aria-current=page] {text-decoration-thickness:3px;text-decoration-color:#ef4b3f;}
.legal-nav .legal-brand {gap:10px;margin-right:auto;font:400 1.2rem/1 Georgia,"Times New Roman",serif;text-decoration:none;}
.legal-brand span {display:grid;place-items:center;width:32px;height:32px;color:#f2efdf;background:#ef4b3f;font:400 1.05rem/1 "Yu Mincho","MS Mincho",serif;}

.legal-head {position:relative;padding-right:clamp(56px,16vw,140px);}
.legal-page .legal-kicker {margin:0;color:#b3302a;font:800 .75rem/1.4 system-ui,sans-serif;letter-spacing:.2em;text-transform:uppercase;}
.legal-page .legal-meta {margin:0;color:#5b574d;font:.95rem/1.5 system-ui,sans-serif;}
.legal-mark {position:absolute;top:-4px;right:0;color:#ef4b3f;font:400 clamp(3.2rem,13vw,6.5rem)/1 "Yu Mincho","MS Mincho",serif;opacity:.9;}
.legal-page .legal-lede {margin-top:18px;font-size:1.15rem;}
.legal-page th {font:700 .78rem/1.4 system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase;color:#5b574d;border-bottom:2px solid #20201c;}

.legal-summary {margin:32px 0;padding:20px clamp(18px,4vw,28px);background:#e6dfc8;border-left:5px solid #ef4b3f;}
.legal-summary > :first-child {margin-top:0;}
.legal-summary ul {margin:10px 0 0;padding-left:1.2em;}
.legal-summary li::marker {color:#b3302a;}
.legal-note {margin:20px 0;padding:14px 18px;border:1px solid #8d8879;background:#f9f6e9;}
.legal-note > :first-child {margin-top:0;}.legal-note > :last-child {margin-bottom:0;}

.legal-page nav.legal-toc {display:block;margin:32px 0 8px;}
.legal-toc ol {margin:10px 0 0;padding:0;list-style:none;counter-reset:legal-toc;columns:2 240px;column-gap:32px;}
.legal-page .legal-toc li {counter-increment:legal-toc;break-inside:avoid;margin:0;}
.legal-toc a {display:flex;gap:12px;align-items:baseline;padding:10px 0;min-height:44px;box-sizing:border-box;border-bottom:1px solid #d9d2bc;text-decoration:none;font:1rem/1.4 system-ui,sans-serif;}
.legal-toc a::before {content:counter(legal-toc,decimal-leading-zero);color:#b3302a;font:700 .78rem/1.4 system-ui,sans-serif;letter-spacing:.08em;}
.legal-toc a:hover {text-decoration:underline;}

.legal-columns {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:20px;margin:16px 0;}
.legal-columns > section {padding:18px 20px;border:1px solid #c9c2ad;background:#f9f6e9;}
.legal-columns h3 {margin-top:0;}
.legal-columns ul {margin:0;padding-left:1.2em;}
.legal-steps {padding-left:1.4em;}
.legal-steps li::marker {color:#b3302a;font-weight:700;}

.legal-page form {margin:20px 0;}
.legal-page label {font-weight:600;}
.legal-page .legal-field {margin:20px 0;}
.legal-page .legal-field > label {margin:0;}
.legal-page .legal-optional {color:#5b574d;font-weight:400;}
.legal-page select,.legal-page textarea {display:block;box-sizing:border-box;width:100%;padding:12px;margin-top:6px;font:16px/1.5 system-ui,sans-serif;color:#20201c;background:#fffdf5;border:1px solid #8d8879;border-radius:0;}
.legal-page select {min-height:48px;}
.legal-page textarea {min-height:180px;resize:vertical;}
.legal-page input,.legal-page select,.legal-page textarea {font-weight:400;}
.legal-page [aria-invalid=true] {border-color:#aa3029;box-shadow:inset 4px 0 0 #aa3029;}
.legal-page .legal-hint {margin:6px 0 0;color:#5b574d;font-size:.92rem;font-weight:400;}
.legal-page .legal-field-error {margin:6px 0 0;color:#982720;font-size:.92rem;font-weight:600;}
.legal-page .legal-counter {margin:4px 0 0;text-align:right;max-width:none;color:#5b574d;font-size:.85rem;}
.legal-page label.legal-check {display:flex;align-items:flex-start;gap:12px;font-weight:400;}
.legal-page .legal-check input {flex:none;width:22px;height:22px;margin:3px 0 0;padding:0;accent-color:#b3302a;}
.legal-page button.legal-primary {color:#f2efdf;background:#20201c;border:1px solid #20201c;}
.legal-page button.legal-primary:hover {background:#3a3a33;}
.legal-page button.legal-danger {color:#fff;background:#982720;border:1px solid #982720;}
.legal-page button.legal-danger:hover {background:#7d1f19;}
.legal-page button:disabled {opacity:.6;cursor:progress;}
.legal-signed-in {margin:12px 0;padding:10px 14px;border-left:3px solid #20201c;background:#f9f6e9;}

.legal-status {margin:18px 0;padding:16px 18px;border:1px solid #8d8879;background:#f9f6e9;}
.legal-status:empty {display:none;}
.legal-status > :first-child {margin-top:0;}.legal-status > :last-child {margin-bottom:0;}
.legal-status.is-error {border-color:#aa3029;background:#f8e4dd;color:#6f1a15;}
.legal-status.is-success {border-color:#2f6a3c;background:#e2eedb;color:#183d22;}
.legal-ticket {display:inline-block;margin:4px 0;padding:6px 12px;font-size:1.5rem;font-weight:700;letter-spacing:.08em;background:#fffdf5;border:1px dashed #2f6a3c;}
.legal-receipt {overflow-wrap:anywhere;font-size:.85rem;}
.legal-fallback {margin-top:24px;padding-top:16px;border-top:1px dashed #b5ae99;}

@media(max-width:600px){
  .legal-page {margin:0;box-shadow:none;}
  .legal-page nav.legal-nav {gap:0 14px;}
  .legal-nav .legal-brand {flex-basis:100%;}
  .legal-page td[data-label]::before {content:attr(data-label);display:block;margin-bottom:2px;color:#5b574d;font:700 .72rem/1.4 system-ui,sans-serif;letter-spacing:.14em;text-transform:uppercase;}
}
@media(prefers-reduced-motion:no-preference){html:has(> .legal-body){scroll-behavior:smooth;}}
@media print{
  .legal-body {background:#fff;}
  .legal-page {max-width:none;margin:0;padding:0;border:0;box-shadow:none;}
  .legal-nav,.legal-toc,.legal-page form {display:none!important;}
}
