:root {
  --ink: #102c35;
  --ink-2: #274650;
  --paper: #f7f5ee;
  --card: #fffdf7;
  --line: #cfd6d2;
  --accent: #f06449;
  --gold: #ffb45e;
  --mint: #a9d6c4;
  --muted: #66787d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, rgba(169, 214, 196, .28), transparent 27rem),
    linear-gradient(rgba(16, 44, 53, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 44, 53, .035) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 26px 26px, 26px 26px, auto;
  font-family: "Hind Siliguri", system-ui, sans-serif;
  min-height: 100vh;
}

button, textarea, input { font: inherit; }

.topbar {
  min-height: 72px;
  padding: 14px clamp(20px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(16, 44, 53, .18);
  background: rgba(247, 245, 238, .82);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; color: var(--gold); background: var(--ink); border-radius: 10px 10px 10px 2px; font-family: "Noto Serif Bengali", serif; }
.status { font-size: .88rem; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.status i { width: 8px; height: 8px; background: #2b9b70; border-radius: 50%; box-shadow: 0 0 0 4px rgba(43,155,112,.12); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.intro { max-width: 800px; padding: clamp(58px, 9vw, 110px) 0 48px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: .82rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
h1 { font-family: "Noto Serif Bengali", serif; font-size: clamp(2.65rem, 7vw, 5.5rem); line-height: .98; letter-spacing: -.04em; margin: 0; font-weight: 700; }
h1 em { color: var(--accent); font-style: normal; position: relative; }
h1 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: 1px; height: 5px; background: var(--gold); opacity: .75; transform: rotate(-1deg); z-index: -1; }
.lede { max-width: 650px; color: var(--ink-2); line-height: 1.7; font-size: 1.1rem; margin: 26px 0 0; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); border: 1px solid var(--ink); background: var(--card); box-shadow: 12px 14px 0 var(--ink); }
.input-panel, .result-panel { padding: clamp(22px, 4vw, 42px); min-height: 530px; }
.result-panel { border-left: 1px solid var(--ink); background: #eef4ef; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 26px; }
.panel-heading > div { display: flex; align-items: center; gap: 12px; }
.step { color: var(--accent); font-weight: 700; font-size: .78rem; border: 1px solid var(--accent); border-radius: 999px; padding: 3px 8px 1px; }
h2 { font-family: "Noto Serif Bengali", serif; margin: 0; font-size: 1.35rem; }
.text-button { border: 0; background: none; color: var(--ink-2); border-bottom: 1px solid currentColor; cursor: pointer; padding: 4px 0 1px; }
.text-button:hover { color: var(--accent); }

textarea { width: 100%; height: 330px; resize: vertical; border: 1px solid var(--line); background: #fffefa; color: var(--ink); padding: 20px; outline: none; line-height: 1.72; font-size: 1.05rem; border-radius: 3px; }
textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(169,214,196,.45); }
textarea::placeholder { color: #89989b; }
.input-tabs { display: inline-grid; grid-template-columns: 1fr 1fr; margin-bottom: 16px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: #eef2ed; }
.input-tab { min-height: 38px; padding: 7px 17px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.input-tab.is-active { color: white; background: var(--ink); }
.drop-zone { min-height: 330px; display: grid; place-content: center; justify-items: center; gap: 7px; padding: 28px; border: 1.5px dashed #9caaa6; border-radius: 3px; background: #fffefa; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--accent); background: rgba(240,100,73,.045); }
.drop-zone input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.drop-zone strong { font-size: 1.15rem; }
.drop-zone > span:not(.upload-icon) { color: var(--ink-2); }
.drop-zone small { color: var(--muted); margin-top: 7px; }
.upload-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 7px; border: 1px solid var(--ink); border-radius: 50%; background: var(--gold); font-size: 1.65rem; font-weight: 700; }
.file-info { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 13px; padding: 13px 15px; border: 1px solid var(--line); background: #fffefa; }
.file-info > div { min-width: 0; display: grid; }
.file-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info span { color: var(--muted); font-size: .84rem; }
.file-info.is-error span { color: #aa321f; }
.remove-file { flex: 0 0 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; font-size: 1.4rem; line-height: 1; }
.privacy-note { margin: 12px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.input-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 20px; color: var(--muted); font-size: .9rem; }
.primary-button, .secondary-button { border: 1px solid var(--ink); cursor: pointer; font-weight: 700; min-height: 48px; padding: 11px 20px; transition: transform .15s, box-shadow .15s; }
.primary-button { background: var(--ink); color: white; box-shadow: 5px 5px 0 var(--gold); }
.primary-button:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--gold); }
.primary-button:disabled { cursor: wait; opacity: .65; transform: none; box-shadow: 5px 5px 0 var(--gold); }
.primary-button span { color: var(--gold); margin-left: 7px; }
.secondary-button { width: 100%; color: var(--ink); background: transparent; }
.secondary-button:hover { background: var(--ink); color: white; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.error { min-height: 22px; color: #aa321f; margin: 10px 0 0; font-size: .9rem; }

.empty-state { height: 390px; display: grid; align-content: center; justify-items: center; color: var(--muted); text-align: center; }
.empty-state p { max-width: 240px; line-height: 1.6; }
.fingerprint { height: 118px; width: 118px; display: flex; align-items: end; justify-content: center; gap: 7px; margin-bottom: 20px; transform: rotate(-3deg); }
.fingerprint span { display: block; width: 11px; border: 2px solid var(--ink); border-bottom: 0; border-radius: 20px 20px 0 0; opacity: .85; }
.fingerprint span:nth-child(1), .fingerprint span:nth-child(5) { height: 45px; }
.fingerprint span:nth-child(2), .fingerprint span:nth-child(4) { height: 78px; }
.fingerprint span:nth-child(3) { height: 108px; background: var(--gold); }
.score-row { display: grid; grid-template-columns: 142px 1fr; gap: 24px; align-items: center; }
.document-meta { margin: -7px 0 22px; padding: 10px 13px; border-left: 3px solid var(--gold); background: rgba(255,255,255,.55); color: var(--ink-2); font-size: .84rem; line-height: 1.45; overflow-wrap: anywhere; }
.score-ring { --score: 50; position: relative; width: 142px; aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; text-align: center; background: conic-gradient(var(--accent) calc(var(--score) * 1%), #d7e0dc 0); }
.score-ring::after { content: ""; position: absolute; inset: 12px; background: #eef4ef; border-radius: 50%; }
.score-ring strong, .score-ring span { position: relative; z-index: 1; }
.score-ring strong { font-size: 2.15rem; line-height: 1; font-family: "Noto Serif Bengali", serif; }
.score-ring span { font-size: .76rem; color: var(--muted); margin-top: 7px; }
.verdict-label { color: var(--muted); font-size: .76rem; font-weight: 700; letter-spacing: .08em; margin: 0 0 5px; }
h3 { font-family: "Noto Serif Bengali", serif; font-size: 1.65rem; margin: 0 0 9px; }
#summary { color: var(--ink-2); line-height: 1.55; margin: 0; }
.signals { margin-top: 28px; border-top: 1px solid rgba(16,44,53,.2); padding-top: 22px; }
.signals h4 { margin: 0 0 12px; font-size: .95rem; }
.signals ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.signals li { display: flex; gap: 9px; color: var(--ink-2); line-height: 1.45; font-size: .92rem; }
.signals li::before { content: "◆"; color: var(--accent); font-size: .65rem; margin-top: 5px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: rgba(16,44,53,.16); border: 1px solid rgba(16,44,53,.16); margin-top: 22px; }
.metric { background: #eef4ef; padding: 12px; }
.metric strong { display: block; font-size: 1.05rem; }
.metric span { font-size: .72rem; color: var(--muted); }
.passage-analysis { margin-top: 24px; padding-top: 22px; border-top: 1px solid rgba(16,44,53,.2); }
.passage-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 13px; }
.passage-heading h4 { margin: 0; font-size: .98rem; }
.passage-heading p { margin: 3px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.highlight-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.highlight-legend span { display: inline-flex; align-items: center; gap: 5px; }
.highlight-legend i { width: 10px; height: 10px; border-radius: 2px; }
.highlight-legend .medium { background: rgba(255,180,94,.72); }
.highlight-legend .high { background: rgba(240,100,73,.7); }
.highlighted-text { max-height: 310px; overflow: auto; padding: 16px; border: 1px solid rgba(16,44,53,.2); background: #fffefa; color: var(--ink-2); font-size: .95rem; line-height: 1.85; white-space: pre-wrap; }
.passage-mark { padding: 2px 1px; border: 0; border-radius: 2px; color: inherit; text-align: left; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.passage-mark.medium { background: rgba(255,180,94,.46); box-shadow: inset 0 -1px 0 #c57e29; }
.passage-mark.high { background: rgba(240,100,73,.34); box-shadow: inset 0 -1px 0 #b8402b; }
.passage-mark:hover, .passage-mark:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.passage-mark.is-selected { outline: 2px solid var(--ink); outline-offset: 1px; }
.passage-detail { min-height: 45px; margin-top: 9px; padding: 10px 12px; border-left: 3px solid var(--accent); background: rgba(255,255,255,.55); color: var(--ink-2); font-size: .84rem; line-height: 1.45; }
.passage-detail strong { color: var(--ink); }

.notice { margin: 48px 0 70px; display: flex; gap: 17px; padding: 20px 22px; border-left: 4px solid var(--gold); background: rgba(255,180,94,.12); color: var(--ink-2); }
.notice > span { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; font-weight: 700; }
.notice p { margin: 0; line-height: 1.65; }
footer { min-height: 80px; padding: 24px clamp(20px, 5vw, 76px); display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid rgba(16,44,53,.18); color: var(--muted); font-size: .88rem; }
.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; }

@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; box-shadow: 7px 9px 0 var(--ink); }
  .result-panel { border-left: 0; border-top: 1px solid var(--ink); }
  .input-panel, .result-panel { min-height: auto; }
}

@media (max-width: 560px) {
  main { width: min(100% - 28px, 1180px); }
  .topbar { padding-inline: 14px; }
  .status { font-size: 0; }
  .status i { margin-right: 4px; }
  .intro { padding-top: 52px; }
  h1 { font-size: 2.65rem; }
  .input-panel, .result-panel { padding: 20px; }
  textarea { height: 290px; }
  .drop-zone { min-height: 290px; }
  .input-footer { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .score-row { grid-template-columns: 1fr; justify-items: start; }
  .score-ring { width: 126px; }
  .metrics { grid-template-columns: 1fr; }
  .passage-heading { flex-direction: column; }
  .highlight-legend { justify-content: flex-start; }
  .result-actions { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media print {
  body { background: white; }
  .topbar, .intro, .input-panel, .notice, footer, .result-actions { display: none !important; }
  main { width: 100%; margin: 0; }
  .workspace { display: block; border: 0; box-shadow: none; }
  .result-panel { border: 0; background: white; padding: 20px; }
  .result-content { display: block !important; }
  .score-ring::after, .metric { background: white; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
