:root {
  --ink: #172033;
  --muted: #657083;
  --line: #d9e0ea;
  --paper: #ffffff;
  --bg: #f4f6f8;
  --blue: #2454a6;
  --blue-dark: #173a78;
  --gold: #b98620;
  --red: #b42318;
  --red-bg: #fff1f0;
  --amber: #9a6700;
  --amber-bg: #fff7df;
  --green: #167044;
  --green-bg: #e9f8ef;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans JP", "Segoe UI", sans-serif;
}

.app-header {
  background: #172033;
  color: white;
  padding: 24px 20px 30px;
}
.app-header > div {
  max-width: 1080px;
  margin: 0 auto;
}
.back-link {
  color: rgba(255,255,255,.76);
  text-decoration: none;
  font-size: 13px;
}
h1 {
  margin: 14px 0 8px;
  font-size: 26px;
  letter-spacing: 0;
}
h1 span {
  display: inline-block;
  font-size: 12px;
  color: #172033;
  background: #d8a93a;
  border-radius: 999px;
  padding: 2px 9px;
  vertical-align: middle;
}
.app-header p {
  max-width: 760px;
  margin: 0;
  color: rgba(255,255,255,.78);
  line-height: 1.7;
  font-size: 14px;
}

.app-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.checker-shell {
  display: grid;
  gap: 18px;
}
.input-panel,
.result-section,
.status-panel,
.lock-screen {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.input-panel { padding: 20px; }
.panel-title,
.section-head,
.actions,
.result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.eyebrow {
  display: block;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}
h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}
.file-note {
  color: var(--muted);
  font-size: 12px;
}
.privacy-guard {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #f0d08c;
  border-radius: 8px;
  background: #fff8e7;
  color: #5f4b1b;
  font-size: 13px;
  line-height: 1.7;
}
.privacy-guard strong {
  display: block;
  color: #7a4d00;
  margin-bottom: 2px;
}

.drop-zone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 18px 0;
  padding: 26px;
  border: 1.5px dashed #9eb1cc;
  border-radius: 8px;
  background: #f8fbff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--blue);
  background: #eef5ff;
}
.drop-zone input { display: none; }
.drop-title {
  font-weight: 700;
  color: var(--blue-dark);
}
.drop-help,
.text-input span {
  color: var(--muted);
  font-size: 13px;
}
.text-input {
  display: grid;
  gap: 7px;
}
.primary-drug-input {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #c7d7ee;
  border-radius: 8px;
  background: #f8fbff;
}
.text-input small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  resize: vertical;
  min-height: 140px;
}
.primary-drug-input textarea {
  min-height: 96px;
}
textarea:focus {
  outline: 2px solid rgba(36,84,166,.18);
  border-color: var(--blue);
}
.actions { margin-top: 16px; justify-content: flex-end; }
button,
.lock-screen a {
  border: 0;
  border-radius: 7px;
  padding: 11px 18px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}
button.primary {
  background: var(--blue);
  color: white;
}
button.primary:disabled { opacity: .55; cursor: wait; }
button.secondary {
  background: #eef1f5;
  color: #253044;
}

.status-panel {
  padding: 14px 16px;
  color: var(--muted);
  font-size: 14px;
}
.status-panel.error {
  color: var(--red);
  background: var(--red-bg);
  border-color: #ffd0cc;
}
.lock-screen {
  text-align: center;
  padding: 56px 24px;
}
.lock-screen p {
  color: var(--muted);
  line-height: 1.7;
}
.lock-screen a {
  display: inline-block;
  color: white;
  background: var(--blue);
}

.result-panel { display: grid; gap: 16px; }
.conclusion-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-left: 6px solid var(--green);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.conclusion-card.high {
  border-left-color: var(--red);
  background: var(--red-bg);
}
.conclusion-card.medium {
  border-left-color: var(--amber);
  background: var(--amber-bg);
}
.conclusion-card h2 {
  font-size: 19px;
}
.conclusion-card p {
  margin: 8px 0 0;
  color: #253044;
  font-size: 14px;
  line-height: 1.7;
}
.summary-card {
  flex: 1 1 150px;
  min-width: 140px;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.summary-card strong {
  display: block;
  font-size: 24px;
}
.summary-card span {
  color: var(--muted);
  font-size: 12px;
}
.result-section {
  padding: 18px;
}
.result-section.warning {
  background: #fffdf6;
  border-color: #ecdcb5;
}
.result-section.warning ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: #62533b;
  line-height: 1.7;
  font-size: 13px;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  font-size: 13px;
}
.chip small { color: var(--muted); }
.muted .chip { color: #596579; }

.interaction-list,
.match-list,
.regimen-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.interaction-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}
.interaction-card.high { border-color: #ffbbb4; background: var(--red-bg); }
.interaction-card.medium { border-color: #f4d58a; background: var(--amber-bg); }
.interaction-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 700;
}
.risk-tag {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #eef1f5;
}
.risk-tag.high { color: var(--red); background: #ffe2df; }
.risk-tag.medium { color: var(--amber); background: #ffe9a6; }
.risk-tag.low { color: var(--green); background: var(--green-bg); }
.interaction-meta,
.match-row,
.regimen-row {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.interaction-meta {
  margin-top: 8px;
}
.auc-line {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
}
.interaction-card.high .auc-line { color: var(--red); }
.interaction-card.medium .auc-line { color: #7a4d00; }
.recommendation {
  margin-top: 10px;
  color: #253044;
  font-size: 13px;
  line-height: 1.7;
}
.match-row,
.regimen-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}
.empty {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}
.unmatched-chip {
  align-items: flex-start;
  border-radius: 8px;
  max-width: 100%;
}
.unmatched-chip small {
  display: block;
  max-width: 520px;
  white-space: normal;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .app-header { padding: 20px 16px 26px; }
  h1 { font-size: 22px; }
  .input-panel,
  .result-section { padding: 16px; }
  .conclusion-card {
    flex-direction: column;
  }
  .result-grid { grid-template-columns: 1fr; }
  .actions button { width: 100%; }
}
