:root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: #18332e; background: #f3f6f4; }
* { box-sizing: border-box; }
body { margin: 0; }
.container { width: min(100%, 760px); margin: 0 auto; padding: 28px 16px 24px; }
header { padding: 4px 4px 22px; }
.brand { display: flex; align-items: center; gap: 9px; color: #146456; font-size: 13px; font-weight: 600; }
.brand-icon { display: grid; place-items: center; width: 26px; height: 28px; border-radius: 8px; background: #146456; color: white; font-size: 17px; }
h1 { margin: 18px 0 12px; font-size: clamp(28px, 5vw, 36px); line-height: 1.35; letter-spacing: -.7px; }
.intro { margin: 0; color: #65766f; font-size: 15px; line-height: 1.7; }
.card { background: white; border: 1px solid #dfe8e2; border-radius: 18px; padding: 22px 18px; margin-bottom: 16px; box-shadow: 0 4px 18px #193a2e04; }
h2 { font-size: 18px; margin: 0; line-height: 1.5; }
.section-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.required-label { color: #6b7d73; background: #eff4f0; border-radius: 5px; font-size: 11px; padding: 3px 6px; }
.hint { display: block; font-size: 14px; color: #64756d; line-height: 1.6; margin-bottom: 12px; }
textarea { display: block; width: 100%; min-height: 96px; border: 1px solid #ccd9d0; border-radius: 10px; padding: 14px; font: inherit; font-size: 16px; line-height: 1.7; resize: vertical; color: #18332e; background: #fcfdfc; }
#hazard-description { min-height: calc(1.7em * 4 + 28px); height: calc(1.7em * 4 + 28px); max-height: 280px; overflow-y: hidden; resize: none; }
.fact-label { margin: 0 0 6px; color: #146456; font-size: 13px; font-weight: 600; line-height: 1.5; }
.fact-text { margin: 0; padding: 12px; background: #f4f8f6; border-radius: 8px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
#supplement-display { margin-top: 14px; }
#clarification { margin: 4px 0 16px; }
#clarification textarea { min-height: 96px; margin-bottom: 0; }
.clarification-question { margin: 0 0 12px; padding: 12px; background: #f4f8f6; border-radius: 8px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.clarification-options { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.clarification-options:empty { display: none; }
.clarification-options button { width: auto; flex: 1 1 180px; max-width: 100%; height: auto; min-height: 44px; padding: 10px 12px; border: 1px solid #cdded3; background: #f5faf7; color: #285948; font-size: 15px; font-weight: 500; line-height: 1.45; gap: 8px; white-space: normal; overflow: visible; }
.clarification-options button:hover { background: #e7f3ec; border-color: #9ec7b4; }
.clarification-options button:focus-visible { outline: 3px solid #77b4a4; outline-offset: 2px; }
.clarification-options button[aria-pressed="true"] { border-color: #0e5348; background: #146456; color: #fff; }
.clarification-options button[aria-pressed="true"]::before { content: "✓"; font-weight: 700; }
.clarification-options button[aria-pressed="true"]:hover { background: #105347; }
textarea::placeholder { color: #8b9891; }
textarea:focus { outline: 3px solid #14645624; border-color: #146456; }
.example { margin: 9px 0 20px; font-size: 12px; color: #7a887f; line-height: 1.6; }
button { display: flex; justify-content: center; align-items: center; gap: 12px; width: 100%; min-height: 52px; border: 0; border-radius: 10px; background: #146456; color: white; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
button:hover { background: #105347; }
button:focus-visible { outline: 3px solid #77b4a4; outline-offset: 3px; }
.stage-note { margin: 12px 0 0; text-align: center; color: #7a887f; font-size: 12px; line-height: 1.6; }
.status { padding: 12px; background: #edf5f0; color: #285948; border-radius: 8px; font-size: 14px; line-height: 1.7; margin: 14px 0 0; overflow-wrap: anywhere; }
.empty-state { text-align: center; padding: 30px 0 18px; }
.document-icon { display: inline-grid; place-items: center; width: 42px; height: 48px; border: 1px solid #dce7df; border-radius: 9px; color: #7f9c8a; background: #f6f9f7; font-size: 30px; }
.empty-state p { color: #6c7d73; font-size: 15px; margin: 14px 0 7px; }
.empty-state > span:last-child { color: #8a978f; font-size: 12px; line-height: 1.7; }
footer { text-align: center; color: #91a096; font-size: 12px; padding-top: 10px; }
@media (min-width: 640px) { .container { padding: 52px 24px 32px; } header { padding-bottom: 28px; } .mobile-break { display: none; } .card { padding: 26px 28px; } }
[hidden] { display: none !important; }
button:disabled { opacity: .7; cursor: wait; }
.status.error { background: #fff0ed; color: #a63a28; }
.result-text { margin-top: 18px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.9; }
.result-panels { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.result-basis, .result-clause-card, .result-undetermined { background: #f4f8f6; border-radius: 12px; padding: 12px 14px; min-width: 0; }
.result-panels h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; line-height: 1.4; color: #146456; }
.result-field + .result-field { margin-top: 12px; }
.result-label { margin: 0 0 4px; font-size: 12px; font-weight: 600; line-height: 1.4; color: #6b7d73; }
.result-value, .result-note { margin: 0; font-size: 15px; line-height: 1.7; color: #18332e; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-match { min-width: 0; }
.result-standard { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.5; color: #18332e; overflow-wrap: anywhere; }
.result-clause-number { margin: 6px 0 0; font-size: 22px; font-weight: 700; line-height: 1.35; color: #146456; overflow-wrap: anywhere; }
.result-original { margin: 0; font-size: 16px; line-height: 1.85; color: #18332e; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-decision { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.5; color: #18332e; }
.result-note { margin-top: 8px; color: #3d5248; }
.result-clause-card .standard-links { margin-top: 14px; }
.query-diagnostics { margin-top: 16px; border: 1px solid #d7e3db; border-radius: 10px; background: #f7faf8; padding: 12px 14px; }
.query-diagnostics-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.query-diagnostics-header h3 { margin: 0; color: #2f5d4d; font-size: 16px; font-weight: 650; }
.query-diagnostics-meta { margin: 8px 0 12px; color: #5a7267; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.copy-diagnostics { border: 1px solid #7fa893; background: #fff; color: #2f5d4d; border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.copy-diagnostics:hover { background: #eef6f1; }
.stage-log { margin-top: 8px; border: 1px solid #d7e3db; border-radius: 8px; background: #fff; padding: 8px 10px; }
.stage-log summary { cursor: pointer; color: #2f5d4d; font-size: 14px; font-weight: 600; }
.stage-log pre { margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; color: #355246; max-height: 420px; overflow: auto; }

/* Compact input layout on phones only; desktop and result styles stay unchanged. */
@media (max-width: 639px) {
  .container { padding-top: 16px; }
  header { padding-top: 0; padding-bottom: 12px; }
  h1 { margin: 10px 0 6px; font-size: 26px; }
  .intro { font-size: 14px; line-height: 1.5; }
  .card[aria-labelledby="input-title"] { padding-top: 14px; padding-bottom: 14px; }
  #query-form .section-heading { margin-bottom: 6px; }
  #query-form .hint { margin-bottom: 8px; }
  #hazard-description { min-height: calc(1.7em * 4 + 16px); height: calc(1.7em * 4 + 16px); padding: 8px 12px; }
  #query-form .example { margin: 6px 0 12px; }
}

.feedback { margin-top: 24px; padding-top: 20px; border-top: 1px solid #dfe8e2; }
.feedback h3 { font-size: 16px; line-height: 1.6; margin: 0 0 12px; }
.feedback-options { display: flex; flex-wrap: wrap; gap: 10px; }
.feedback-options button { flex: 1 1 120px; min-height: 48px; width: auto; border: 1px solid #cdded3; background: #f5faf7; color: #285948; font-size: 15px; }
.feedback-options button[aria-pressed="true"] { border-color: #146456; background: #e4f1e9; }
#feedback-form { margin-top: 14px; }
#feedback-form label { display: block; font-size: 14px; line-height: 1.6; margin-bottom: 8px; color: #64756d; }
#feedback-reason { min-height: 100px; height: 100px; padding: 8px 12px; margin-bottom: 12px; }

/* Phone result styling follows the existing input card and text field. */
@media (max-width: 639px) {
  .result-card { padding: 14px 18px; }
  .result-card > h2 { font-size: 18px; line-height: 1.5; }
  .result-card > .result-text {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid #ccd9d0;
    border-radius: 10px;
    background: #fcfdfc;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.75;
    color: #18332e;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .result-card > .empty-state { padding: 18px 0 10px; }
  .result-panels { gap: 14px; }
  .result-standard { font-size: 17px; }
  .result-clause-number { font-size: 20px; }
  .result-original { font-size: 15px; }
  .result-card > .empty-state p { font-size: 14px; margin-top: 10px; }
}

/* Shared waiting feedback for phone and desktop; stays in normal document flow. */
#query-status { white-space: pre-line; font-variant-numeric: tabular-nums; }

.standard-links { margin-top: 14px; }
.standard-fulltext-link { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 16px; border: 1px solid #cdded3; border-radius: 10px; background: #f5faf7; color: #146456; font-size: 15px; font-weight: 600; text-decoration: none; }
.standard-fulltext-link:hover { background: #e4f1e9; }
.standard-fulltext-link:focus-visible { outline: 3px solid #77b4a4; outline-offset: 3px; }
.standard-fulltext-caption { display: block; margin-top: 6px; font-size: 12px; line-height: 1.6; color: #64756d; }
