:root {
  --ink: #f1f6f4;
  --muted: #8ea7a1;
  --paper: #09100e;
  --white: #0e1715;
  --green: #10b981;
  --lime: #b5f21d; /* Electric neon lime accent */
  --line: #1b2d29;
  --dark: #050807;
  --glass: rgba(14, 23, 21, 0.72);
  --shadow: 0 25px 80px rgba(0, 0, 0, 0.65);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --selection-bg: rgba(181, 242, 29, 0.35);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, select, textarea { font: inherit; }
button { cursor: pointer; }

/* Global Focus Outline for Accessibility */
button:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

/* Header styling: Translucent & blur effects */
header {
  position: sticky; top: 0; z-index: 10;
  min-height: 64px; padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 16, 14, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 16px; }
.brand small { display: none; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

/* Interactive Monogram Mark */
.mark {
  position: relative; display: block; flex: 0 0 auto; width: 38px; height: 38px;
  overflow: hidden; background: var(--dark); border-radius: 11px;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.3); isolation: isolate;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}
.brand:hover .mark {
  transform: rotate(6deg) scale(1.05);
  box-shadow: 0 0 16px rgba(181, 242, 29, 0.25);
}
.mark::before { content: ""; position: absolute; z-index: 0; width: 30px; height: 8px; left: 5px; top: 15px; background: linear-gradient(90deg, var(--lime), var(--green)); border-radius: 99px; transform: rotate(-43deg); opacity: .45; }
.mark-f, .mark-s { position: absolute; z-index: 1; top: 5px; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, sans-serif; font-size: 24px; font-weight: 850; line-height: 28px; letter-spacing: -.12em; }
.mark-f { left: 7px; color: var(--lime); }
.mark-s { left: 17px; color: #fff; mix-blend-mode: screen; }

.header-actions { display: flex; align-items: center; gap: 6px; }
.header-actions select, .ghost {
  min-height: 38px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05); border-radius: 11px;
  padding: 7px 9px; color: var(--ink);
  font-family: inherit; font-size: 12px; font-weight: 500;
  transition: border-color 0.2s, background 0.2s;
}
.header-actions select:hover, .ghost:hover {
  border-color: rgba(181, 242, 29, 0.5);
  background: rgba(255, 255, 255, 0.08);
}
.header-actions select option { background: var(--paper); color: var(--ink); }
.ghost { width: 42px; overflow: hidden; white-space: nowrap; font-size: 0; }
.ghost::before { content: "SME"; font-size: 10px; font-weight: 800; }
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 2px; padding: 0 5px; background: var(--lime); border-radius: 99px; font-size: 10px; color: var(--dark); font-weight: 700; }
.count[hidden] { display: none; }

main { width: 100%; max-width: 1320px; margin: auto; padding: 30px 14px calc(64px + var(--safe-bottom)); }
.intro { margin-bottom: 18px; }

/* Subtle title text gradient */
.intro h1 {
  max-width: none; margin: 2px 0 12px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, sans-serif;
  font-weight: 780; font-size: clamp(39px, 12vw, 64px); line-height: .98; letter-spacing: -.055em;
  background: linear-gradient(135deg, #ffffff 40%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.intro > div { width: 100%; }
.intro > div > p:last-child { max-width: none; margin: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 9px; letter-spacing: .18em; font-weight: 800; }

/* Private by design trust-note */
.trust-note {
  display: grid; grid-template-columns: 34px 1fr; gap: 11px; align-items: center; margin: 18px 0;
  padding: 13px 14px; border: 1px solid rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.06); border-radius: 15px;
}
.trust-icon { display: grid; place-items: center; width: 34px; height: 34px; background: rgba(16, 185, 129, 0.15); color: var(--green); border-radius: 50%; font-weight: 800; }
.trust-note strong { display: block; font-size: 13px; color: #fff; }
.trust-note p { margin: 2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.trust-label { display: none; color: var(--lime); font-size: 9px; font-weight: 800; letter-spacing: .13em; }

/* Scanner Shell: Sleek border transitions and glows */
.scanner-shell {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  background: var(--white); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow);
  transition: grid-template-columns .42s cubic-bezier(.22,1,.36,1), border-color 0.3s, box-shadow 0.3s;
}
.scanner-shell:hover {
  border-color: rgba(181, 242, 29, 0.15);
  box-shadow: 0 0 35px rgba(181, 242, 29, 0.05), var(--shadow);
}
.viewport { position: relative; min-height: min(62svh, 560px); background: radial-gradient(circle at center, #112722, #040908 72%); overflow: hidden; }
.viewport video { position: absolute; width: 100%; height: 100%; object-fit: contain; }

/* Document scroller styling */
.document-scroller {
  position: absolute; inset: 0; z-index: 1; overflow: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable; scrollbar-color: #556c65 var(--paper); scrollbar-width: auto;
  background: var(--paper); -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y;
}
.document-scroller[hidden] { display: none; }
.document-scroller::-webkit-scrollbar { width: 11px; height: 11px; }
.document-scroller::-webkit-scrollbar-track { background: var(--paper); }
.document-scroller::-webkit-scrollbar-thumb { border: 3px solid var(--paper); background: #556c65; border-radius: 99px; }
.document-stage { position: relative; width: 100%; min-height: 100%; background: #fff; }
.uploaded-preview { display: block; width: 100%; height: auto; min-height: 100%; object-fit: contain; object-position: top center; background: #fff; }
.document-stage > .overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; pointer-events: none; }

/* Term markers and active glow overlays */
.term-marker {
  position: absolute; z-index: 4; display: grid; place-items: center; width: 18px; height: 18px;
  border: 1.5px solid rgba(255,255,255,.9); padding: 0; background: rgba(5,8,7,.9); border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,.5); pointer-events: auto; cursor: grab; touch-action: none;
  animation: marker-in .35s var(--marker-delay, 0ms) both cubic-bezier(.22,1,.36,1);
  transition: border-color 0.2s, transform 0.2s;
}
.term-marker:active { cursor: grabbing; }
.term-marker span {
  width: 6px; height: 6px; background: var(--lime); border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(181, 242, 29, 0.25);
  transition: transform 0.2s;
}
.term-marker:hover, .term-marker:focus-visible, .term-marker.active {
  border-color: var(--lime); transform: scale(1.15);
  box-shadow: 0 0 10px rgba(181, 242, 29, 0.4);
}
.term-marker:hover span { transform: scale(1.2); }
@keyframes marker-in { from { opacity: 0; transform: scale(.4); } }

/* Dynamic popover over document elements */
.term-popover {
  position: absolute; z-index: 6; border: 1px solid rgba(255,255,255,.12); padding: 13px;
  background: rgba(14, 23, 21, 0.94); color: white; border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0,0,0,.6); backdrop-filter: saturate(160%) blur(18px);
  pointer-events: auto; animation: popover-in .22s cubic-bezier(.22,1,.36,1);
}
@keyframes popover-in { from { opacity: 0; transform: translateY(7px) scale(.97); } }
.popover-heading { display: grid; grid-template-columns: 9px 1px minmax(0,1fr) auto; align-items: center; gap: 8px; }
.callout-dot { width: 9px; height: 9px; background: var(--lime); border-radius: 50%; box-shadow: 0 0 0 3px rgba(181, 242, 29, 0.2); }
.callout-line { align-self: stretch; width: 1px; min-height: 20px; background: rgba(255,255,255,.15); }
.popover-heading strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.popover-heading small { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.term-popover p { margin: 11px 0; color: #d1deda; font-size: 11px; line-height: 1.5; }

/* Interactive button effects */
.term-popover button {
  width: 100%; min-height: 36px; border: 0; background: var(--lime); color: var(--dark);
  border-radius: 8px; font-size: 10px; font-weight: 750;
  transition: filter 0.15s, transform 0.15s;
}
.term-popover button:hover {
  filter: brightness(1.05); transform: translateY(-0.5px);
}

.selection-hint {
  position: absolute; z-index: 3; left: 50%; bottom: 46px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 7px 12px; background: rgba(14, 23, 21, 0.86);
  color: var(--ink); border: 1px solid var(--line); border-radius: 99px;
  backdrop-filter: blur(12px); font-size: 9px; font-weight: 650; text-align: center;
  white-space: nowrap; box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.selection-hint[hidden] { display: none; }

.document-info {
  position: absolute; z-index: 5; right: 28px; top: 20px; display: grid; place-items: center;
  width: 40px; height: 40px; border: 1px solid rgba(255, 255, 255, 0.15); padding: 0;
  background: rgba(14, 23, 21, 0.85); color: white; border-radius: 50%;
  backdrop-filter: blur(16px); pointer-events: auto; transition: background 0.2s, border-color 0.2s;
}
.document-info:hover {
  background: rgba(22, 38, 34, 0.9);
  border-color: rgba(181, 242, 29, 0.4);
}
.document-info[hidden] { display: none; }
.document-info span { display: grid; place-items: center; width: 25px; height: 25px; background: var(--lime); color: var(--dark); border-radius: 50%; font-family: Georgia, serif; font-weight: 800; }
.document-info b { display: none; font-size: 10px; }

.selection-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.selectable-region { position: absolute; display: block; overflow: hidden; color: transparent; line-height: 1; white-space: pre-wrap; user-select: text; -webkit-user-select: text; pointer-events: auto; cursor: text; touch-action: pan-x pan-y; }
.selectable-region::selection { background: var(--selection-bg); color: rgba(255,255,255,0.9); }

.term-marker.user-triggered { animation: marker-pulse .28s cubic-bezier(.22,1,.36,1); }
@keyframes marker-pulse { from { opacity: 0; transform: scale(.2); } 70% { transform: scale(1.25); } }

/* Corner brackets: pulsing scan visual states */
.corner { position: absolute; width: 34px; height: 34px; border-color: var(--lime); border-style: solid; opacity: .45; }
.tl { top: 28px; left: 20px; border-width: 2px 0 0 2px; }
.tr { top: 28px; right: 20px; border-width: 2px 2px 0 0; }
.bl { bottom: 28px; left: 20px; border-width: 0 0 2px 2px; }
.br { right: 20px; bottom: 28px; border-width: 0 2px 2px 0; }
@keyframes corner-glow {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.95; filter: drop-shadow(0 0 4px var(--lime)); }
}
.viewport.active .corner {
  animation: corner-glow 2.2s infinite ease-in-out;
}

.empty-state {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: white; text-align: center;
  background: linear-gradient(130deg, rgba(14, 28, 25, 0.94), rgba(7, 14, 12, 0.98));
}
.empty-state.hidden { display: none; }
.empty-state span { max-width: 250px; color: var(--muted); font-size: 14px; }
.lens { margin-bottom: 8px; color: var(--lime); font-size: 50px; }

/* Buttons & drawer layout overrides */
.primary, .panel-actions button {
  min-height: 48px; border: 0; border-radius: 12px; padding: 12px 18px;
  background: var(--lime); color: var(--dark); font-weight: 750;
  box-shadow: 0 8px 20px rgba(181, 242, 29, 0.15);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
.primary:hover, .panel-actions button:hover:not(:disabled) {
  filter: brightness(1.05); transform: translateY(-1.5px);
  box-shadow: 0 10px 24px rgba(181, 242, 29, 0.25);
}
.primary:active, .panel-actions button:active:not(:disabled) {
  transform: translateY(0);
}
.empty-state .primary { margin-top: 14px; }

/* Active scanning laser bar */
.scan-line {
  display: none; position: absolute; left: 7%; right: 7%; top: 50%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--lime), transparent);
  box-shadow: 0 0 15px var(--lime); animation: scan 2.5s ease-in-out infinite;
}
.viewport.active .scan-line { display: block; }
@keyframes scan { 0%, 100% { top: 12%; opacity: .15; } 50% { top: 88%; opacity: .95; } }

.status-pill, .quality-pill {
  position: absolute; top: 14px; max-width: 46%; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(9, 16, 14, 0.82);
  color: #fff; backdrop-filter: blur(12px); border-radius: 99px;
  padding: 7px 12px; font-size: 10px; text-overflow: ellipsis; white-space: nowrap;
}
.status-pill { left: 12px; }
.quality-pill { right: 12px; top: 58px; }
.quality-pill[hidden] { display: none; }
.status-pill i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: #647570; border-radius: 50%; }

/* Status pill indicator pulsing animation */
@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(181, 242, 29, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(181, 242, 29, 0); }
  100% { box-shadow: 0 0 0 0 rgba(181, 242, 29, 0); }
}
.status-pill.live i {
  background: var(--lime);
  animation: pulse-live 1.8s infinite ease-in-out;
}

/* Drawer Toggle Control */
.details-toggle {
  position: absolute; z-index: 3; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.16); padding: 7px 12px;
  background: rgba(14, 23, 21, 0.85); color: white; border-radius: 99px;
  backdrop-filter: saturate(160%) blur(16px); box-shadow: 0 8px 30px rgba(0,0,0,.4);
  font-size: 14px; font-weight: 650; transition: border-color 0.2s, background 0.2s;
  white-space: nowrap;
}
.details-toggle:hover {
  background: rgba(22, 38, 34, 0.95);
  border-color: rgba(181, 242, 29, 0.3);
}
.details-toggle i { font-style: normal; transition: transform .3s ease; }
.details-open .details-toggle i { transform: rotate(180deg); }
.toggle-cam-icon {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--lime); transition: filter 0.2s;
}
.details-toggle:hover .toggle-cam-icon {
  filter: drop-shadow(0 0 4px rgba(181, 242, 29, 0.55));
}
.toggle-label {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: #fff;
}
.viewport.active .toggle-cam-icon {
  animation: cam-pulse 2.2s infinite ease-in-out;
}
@keyframes cam-pulse {
  0%, 100% { color: var(--lime); }
  50% { color: #fff; filter: drop-shadow(0 0 5px rgba(181, 242, 29, 0.7)); }
}

.control-panel {
  position: relative; display: flex; flex-direction: column; max-height: 0; overflow: hidden;
  padding: 0 18px; opacity: 0; transform: translateY(18px);
  transition: max-height .45s cubic-bezier(.22,1,.36,1), opacity .25s ease, transform .4s cubic-bezier(.22,1,.36,1), padding .4s ease;
}
.details-open .control-panel { max-height: 740px; padding: 26px 18px calc(20px + var(--safe-bottom)); opacity: 1; transform: translateY(0); }
.details-close {
  position: absolute; top: 15px; right: 14px; z-index: 2; display: grid; place-items: center;
  width: 32px; height: 32px; border: 0; background: rgba(255,255,255,0.06);
  color: var(--muted); border-radius: 50%; font-size: 21px; line-height: 1;
  transition: background 0.2s, color 0.2s;
}
.details-close:hover {
  background: rgba(255,255,255,0.12);
  color: var(--lime);
}
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 0 38px 14px 0; }
.panel-heading h2 { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, sans-serif; font-size: 24px; font-weight: 780; letter-spacing: -.035em; color: #fff; }
.panel-heading > span { flex: 0 0 auto; padding: 6px 9px; background: rgba(255,255,255,0.05); border-radius: 99px; font-size: 11px; color: var(--lime); font-weight: 600; }
.status-message { padding: 14px 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.metrics > div { min-width: 0; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.04); padding: 10px 8px; border-radius: 9px; }
.metrics small, .metrics strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.metrics small { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.metrics strong { margin-top: 5px; font-size: 11px; white-space: nowrap; color: #fff; }

.terms-list { max-height: 230px; overflow: auto; padding: 14px 0; }
.hint-card { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; }
.hint-card span { color: var(--green); font-family: Georgia, serif; font-size: 22px; }

.instruction-card { padding: 13px 14px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; }
.instruction-card strong { font-size: 12px; color: #fff; }
.instruction-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.analysis-progress { display: flex; align-items: center; gap: 10px; padding: 14px; background: rgba(255,255,255,0.03); border-radius: 12px; color: var(--muted); font-size: 11px; }
.analysis-progress i { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.1); border-top-color: var(--lime); border-radius: 50%; animation: progress-spin .8s linear infinite; }
@keyframes progress-spin { to { transform: rotate(360deg); } }
.empty-result { padding: 14px; border: 1px dashed rgba(255,255,255,0.12); color: var(--muted); border-radius: 12px; font-size: 11px; line-height: 1.5; }

.upload-card { display: grid; gap: 10px; margin: 4px 0 14px; padding: 13px; border: 1px solid var(--line); background: rgba(255,255,255,0.02); border-radius: 12px; }
.upload-card strong, .upload-card span { display: block; }
.upload-card strong { font-size: 12px; color: #fff; }
.upload-card span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.upload-card button {
  min-height: 40px; border: 1px solid var(--line); background: rgba(255,255,255,0.04);
  color: var(--ink); border-radius: 9px; font-size: 11px; font-weight: 700;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.upload-card button:hover { border-color: var(--lime); color: var(--lime); background: rgba(255,255,255,0.08); }

.panel-actions { display: grid; gap: 8px; }
.panel-actions button:disabled { opacity: .3; cursor: not-allowed; box-shadow: none; transform: none; }
.panel-actions .secondary {
  background: rgba(255, 255, 255, 0.08); color: white; border: 1px solid var(--line);
  box-shadow: none;
}
.panel-actions .secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

.trust-row { display: grid; grid-template-columns: 1fr 1fr; margin-top: 18px; overflow: hidden; border: 1px solid rgba(255,255,255,0.04); background: transparent; border-radius: 16px; }
.trust-row div { display: flex; flex-direction: column; padding: 15px; border-right: 1px solid rgba(255,255,255,0.05); border-bottom: 1px solid rgba(255,255,255,0.05); }
.trust-row div:nth-child(2n) { border-right: 0; }
.trust-row div:nth-last-child(-n+2) { border-bottom: 0; }
.trust-row b { color: var(--lime); font-size: 9px; letter-spacing: .1em; font-weight: 700; }
.trust-row span { margin-top: 4px; color: var(--muted); font-size: 11px; }

/* Modals & sheets details */
.modal {
  position: fixed; inset: 0; z-index: 20; display: none; place-items: end center;
  padding: 12px 12px calc(12px + var(--safe-bottom)); background: rgba(3, 5, 4, 0.78);
  backdrop-filter: blur(10px);
}
.modal.open { display: grid; }
.definition-card, .admin-card, .insight-card {
  position: relative; width: 100%; max-height: 88svh; overflow: auto;
  background: rgba(17, 28, 25, 0.97); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px 20px 14px 14px; padding: 28px 20px; box-shadow: 0 30px 100px rgba(0,0,0,0.7);
}
.close {
  position: absolute; top: 10px; right: 14px; border: 0; background: transparent;
  color: var(--muted); font-size: 27px; line-height: 1; transition: color 0.15s;
}
.close:hover { color: var(--lime); }
.definition-card h2, .admin-card h2, .insight-card h2 { margin: 0 0 2px; font-family: Georgia, serif; font-size: 24px; color: #fff; }
.full-form { margin: 0; color: var(--lime); font-weight: 700; }
.definition-text { font-family: Georgia, serif; font-size: 20px; line-height: 1.45; color: #f2fbf7; }

.definition-meta {
  display: grid; gap: 5px; padding: 10px; background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 9px; font-size: 11px;
}
.related { padding: 12px 0; color: var(--muted); font-size: 11px; }

.feedback-row { display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--line); padding-top: 16px; }
.feedback-row span { margin-right: auto; font-size: 12px; }
.feedback-row button {
  width: 42px; height: 40px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(255,255,255,0.04); color: var(--ink);
  transition: border-color 0.2s, background 0.2s;
}
.feedback-row button:hover { border-color: var(--lime); background: rgba(255,255,255,0.08); }

textarea {
  width: 100%; min-height: 90px; margin: 7px 0 9px; padding: 10px;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,0.25);
  color: var(--ink);
}
textarea:focus { border-color: var(--lime); outline: none; }
form label { font-size: 12px; font-weight: 700; color: var(--muted); }
#correctionForm { margin-top: 15px; }
.feedback-message { color: var(--lime); font-size: 12px; }

.insight-card blockquote { margin: 16px 0; padding: 12px 14px; background: rgba(255,255,255,0.03); color: var(--muted); border-left: 3px solid var(--lime); border-radius: 4px 10px 10px 4px; font-size: 12px; line-height: 1.45; }
.insight-card section { padding: 13px 0; border-top: 1px solid var(--line); }
.insight-card section small { color: var(--lime); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.insight-card section p { margin: 7px 0 0; color: var(--ink); font-size: 14px; line-height: 1.6; }

.insight-terms { display: flex; flex-wrap: wrap; gap: 6px; margin: 5px 0 16px; }
.insight-terms button {
  border: 1px solid var(--line); padding: 6px 9px; background: rgba(255,255,255,0.03);
  color: var(--lime); border-radius: 99px; font-size: 10px; font-weight: 700;
  transition: background 0.2s, border-color 0.2s;
}
.insight-terms button:hover { background: rgba(181, 242, 29, 0.08); border-color: rgba(181, 242, 29, 0.35); }

.admin-item { margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.02); }
.admin-item h3 { margin: 0; color: #fff; }
.admin-item p { font-size: 13px; }
.admin-actions { display: flex; gap: 8px; margin-top: 12px; }
.admin-actions button { min-height: 40px; border: 0; border-radius: 7px; padding: 8px 12px; font-weight: 700; }
.approve { background: var(--lime); color: var(--dark); }
.reject { background: #4f2222; color: #f5c4c4; border: 1px solid #733131; }
.muted { color: var(--muted); }

.toast {
  position: fixed; left: 14px; right: 14px; bottom: calc(16px + var(--safe-bottom)); z-index: 30;
  transform: translateY(20px); opacity: 0; background: var(--dark); color: white;
  border: 1px solid var(--line); padding: 11px 16px; border-radius: 9px;
  transition: .25s ease-out; text-align: center; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateY(0); }
[dir=rtl] .definition-card { text-align: right; }

@media (min-width: 600px) {
  header { min-height: 72px; padding: 10px 24px; }
  .brand { font-size: 18px; }
  .brand small { display: block; }
  .ghost { width: auto; font-size: 12px; }
  .ghost::before { content: none; }
  main { padding: 36px 24px 72px; }
  .viewport { min-height: 560px; }
  .control-panel { padding: 26px; }
  .panel-actions { grid-template-columns: 1fr 1fr; }
  .modal { place-items: center; padding: 20px; }
  .definition-card { width: min(500px, 100%); border-radius: 18px; padding: 30px; }
  .admin-card { width: min(800px, 100%); border-radius: 18px; padding: 30px; }
  .insight-card { width: min(600px, 100%); border-radius: 18px; padding: 30px; }
  .definition-meta { display: flex; justify-content: space-between; }
  .toast { left: 50%; right: auto; width: max-content; max-width: 90vw; transform: translate(-50%, 20px); }
  .toast.show { transform: translate(-50%, 0); }
}

@media (min-width: 900px) {
  header { position: static; height: 76px; padding-inline: max(24px, calc((100vw - 1320px) / 2)); }
  .intro { display: block; margin-bottom: 26px; }
  .intro h1 { max-width: none; }
  .intro > div > p:last-child { font-size: 16px; }
  .trust-note { grid-template-columns: 38px 1fr auto; padding: 14px 17px; }
  .trust-label { display: block; }
  .scanner-shell { display: grid; grid-template-columns: minmax(0, 1fr) 0; min-height: 590px; border-radius: 24px; }
  .scanner-shell.details-open { grid-template-columns: minmax(0, 1.65fr) minmax(330px, .7fr); }
  .viewport { min-height: 590px; }
  
  .control-panel {
    max-height: none; min-width: 0; height: 590px; padding: 28px; opacity: 1;
    transform: translateX(24px); transition: opacity .22s ease, transform .42s cubic-bezier(.22,1,.36,1);
  }
  .details-closed .control-panel { visibility: hidden; padding-inline: 0; opacity: 0; pointer-events: none; }
  .details-open .control-panel { max-height: none; padding: 28px; opacity: 1; transform: translateX(0); }
  .details-toggle { left: auto; right: 18px; bottom: 18px; transform: none; }
  .details-open .details-toggle { right: 18px; }
  .panel-actions { grid-template-columns: 1fr; }
  .terms-list { flex: 1; max-height: 300px; }
  
  .trust-row { grid-template-columns: repeat(4, 1fr); margin-top: 20px; }
  .trust-row div, .trust-row div:nth-child(2n) { border-right: 1px solid rgba(255,255,255,0.05); border-bottom: 0; padding: 18px 24px; }
  .trust-row div:last-child { border-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.conf-good { color: var(--lime) !important; font-weight: 700; }
.conf-neutral { color: #f59e0b !important; font-weight: 600; }
.conf-bad { color: #ef4444 !important; font-weight: 600; }
