:root {
  --bg1: #f2e9e4;
  --bg2: #e6d5c3;
  --card: #fff6e9;
  --text: #3b2f2f;
  --accent: #d9822b;
  --accent2: #b45309;
}
:root[data-theme="dark"] {
  --bg1: #2a241d;
  --bg2: #3a2e22;
  --card: #2f2820;
  --text: #f2e9db;
  --accent: #e6a550;
  --accent2: #c27b35;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: radial-gradient(900px 500px at 10% 10%, var(--bg2), var(--bg1)); color: var(--text); }
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }
.container.main-center { min-height: calc(100vh - 140px); display: flex; flex-direction: column; }
.site-header, .site-footer { background: rgba(255, 248, 236, 0.65); backdrop-filter: blur(6px); }
:root[data-theme="dark"] .site-header, :root[data-theme="dark"] .site-footer { background: rgba(0,0,0,0.35); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 56px; height: 56px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2)); }
.site-title { margin: 0; font-size: 26px; }
.controls { display: flex; gap: 24px; align-items: center; justify-content: center; margin: 32px auto; max-width: 900px; }
.controls { margin-top: auto; margin-bottom: auto; }
.control { display: flex; flex-direction: column; }
.control label { text-align: center; }
select { padding: 10px; border-radius: 12px; border: 1px solid #e5d0b8; background: linear-gradient(145deg, #fffaf0, #f8e9ce); color: var(--text); box-shadow: 8px 8px 16px rgba(0,0,0,0.08); }
:root[data-theme="dark"] select { border: 1px solid #8c6b4a; background: linear-gradient(145deg, #2f2820, #251f19); color: var(--text); box-shadow: 6px 6px 12px rgba(0,0,0,0.35); }
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217,130,43,0.25); }
:root[data-theme="dark"] select:focus { box-shadow: 0 0 0 3px rgba(230,165,80,0.25); }
select option { color: var(--text); background: var(--card); }
:root[data-theme="dark"] select option { color: var(--text); background: #2a241d; }
.control input { padding: 10px; border-radius: 12px; border: 1px solid #e5d0b8; background: linear-gradient(145deg, #fffaf0, #f8e9ce); color: var(--text); box-shadow: 8px 8px 16px rgba(0,0,0,0.08); }
:root[data-theme="dark"] .control input { border: 1px solid #8c6b4a; background: linear-gradient(145deg, #2f2820, #251f19); color: var(--text); box-shadow: 6px 6px 12px rgba(0,0,0,0.35); }
.control input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217,130,43,0.25); }
:root[data-theme="dark"] .control input:focus { box-shadow: 0 0 0 3px rgba(230,165,80,0.25); }
 .control select, .control input { width: 260px; }
.control label { color: var(--text); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 20px; }
.card { background: var(--card); border-radius: 16px; padding: 18px; box-shadow: 0 8px 20px rgba(0,0,0,0.12); transition: transform 120ms ease, box-shadow 120ms ease; }
.analysis-card { max-height: 60vh; overflow: auto; }
#analysis table { table-layout: fixed; width: 100%; }
#analysis th, #analysis td { word-break: break-word; }
#analysis pre { white-space: pre-wrap; word-break: break-word; }
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,0.16); }
.depth-2 { transform: translateZ(6px); }
.depth-3 { transform: translateZ(12px); }
.hidden { display: none; }
.item { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; cursor: pointer; }
.item img { width: 36px; height: 36px; }
.item div { font-weight: 600; font-size: 16px; }
.versions-line { font-weight: 500; font-size: 12px; opacity: 0.85; color: var(--text); }
.version-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.version-badge { display: inline-block; background: var(--accent2); color: #fff; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.version-badge.more { background: transparent; border: 1px solid var(--accent2); color: var(--accent2); }
 .modal-card .version-badges { margin: 8px 0 12px 0; }
.badge { display: inline-block; background: var(--accent); color: #fff; padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.suggest-hl7 { display: inline-block; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 12px; font-size: 14px; font-weight: 700; margin: 8px 0; }
.details pre { white-space: pre-wrap; background: #fff3e1; padding: 12px; border-radius: 12px; color: #3b2f2f; }
:root[data-theme="dark"] .details pre { background: #2f2820; color: var(--text); }
button.theme-toggle { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--accent2); background: linear-gradient(145deg, var(--accent), var(--accent2)); color: #fff; font-weight: 700; cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,0.15), 0 12px 24px rgba(0,0,0,0.15); transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease; }
button.theme-toggle:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 7px 0 rgba(0,0,0,0.15), 0 16px 28px rgba(0,0,0,0.18); }
button.theme-toggle:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(0,0,0,0.15), 0 8px 18px rgba(0,0,0,0.12); }
 .contact-link { color: var(--accent2); font-weight: 700; text-decoration: underline; text-shadow: none; }
 :root[data-theme="dark"] .contact-link { color: #fff; text-decoration: underline; text-shadow: none; }
 .details.card { background: transparent; box-shadow: none; padding: 0; }
 .details { position: fixed; inset: 0; align-items: center; justify-content: center; background: rgba(0,0,0,0.25); backdrop-filter: blur(4px); z-index: 1000; }
 .details:not(.hidden) { display: flex; }
 :root[data-theme="dark"] .details { background: rgba(0,0,0,0.45); }
 .modal-card { width: 92%; max-width: 720px; background: var(--card); border-radius: 16px; box-shadow: 0 12px 32px rgba(0,0,0,0.2); padding: 20px; position: relative; }
 .modal-title { margin: 0 0 8px 0; font-size: 20px; color: var(--text); }
 .modal-desc { margin: 0 0 12px 0; color: var(--text); }
.modal-close { position: absolute; top: 10px; right: 10px; background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 6px 10px; cursor: pointer; }

@media (max-width: 900px) {
  .container { padding: 12px; }
  .site-header .container { flex-wrap: wrap; gap: 8px; }
  .brand-icon { width: 44px; height: 44px; }
  .site-title { font-size: 22px; }
  .controls { flex-direction: column; gap: 12px; margin: 20px auto; }
  .control select, .control input { width: 100%; max-width: 520px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .card { padding: 14px; }
  .analysis-card { max-height: 50vh; }
  .modal-card { width: 96%; max-width: 640px; }
  #msg { min-height: 300px !important; }
}

@media (max-width: 480px) {
  .brand-icon { width: 36px; height: 36px; }
  .site-title { font-size: 20px; }
  .grid { grid-template-columns: 1fr; }
  .version-badges { gap: 4px; }
  button.theme-toggle { padding: 9px 12px; font-size: 14px; }
  .card { padding: 12px; }
  #msg { min-height: 220px !important; }
}
.text-3d { text-shadow: 0 1px 0 rgba(255,255,255,0.5), 0 2px 0 rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.18); }
:root[data-theme="dark"] .text-3d { text-shadow: 0 1px 0 rgba(0,0,0,0.6), 0 2px 0 rgba(255,255,255,0.06), 0 4px 12px rgba(0,0,0,0.45); }
 #msg { width: 100%; min-height: 420px; padding: 14px; border-radius: 12px; border: 1px solid #e5d0b8; background: linear-gradient(145deg, #fffaf0, #f8e9ce); font-size: 14px; color: var(--text); }
 :root[data-theme="dark"] #msg { border: 1px solid #8c6b4a; background: linear-gradient(145deg, #2f2820, #251f19); color: var(--text); }
 #fhirfile { padding: 8px; border-radius: 12px; border: 1px solid #e5d0b8; background: linear-gradient(145deg, #fffaf0, #f8e9ce); color: var(--text); }
 :root[data-theme="dark"] #fhirfile { border: 1px solid #8c6b4a; background: linear-gradient(145deg, #2f2820, #251f19); color: var(--text); }
