:root {
  color-scheme: dark;
  --bg: #101014;
  --bg-soft: #17151c;
  --panel: rgba(25, 22, 30, 0.78);
  --panel-strong: rgba(31, 28, 38, 0.9);
  --text: #f2edf1;
  --muted: #b8adb6;
  --faint: #857987;
  --line: rgba(238, 224, 235, 0.16);
  --line-strong: rgba(238, 224, 235, 0.28);
  --rose: #d9b9c5;
  --rose-dark: #9d7483;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 24px;
  --radius-small: 16px;
  font-family: "Cormorant Garamond", "Songti SC", "Noto Serif SC", Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 78% 8%, rgba(217, 185, 197, 0.14), transparent 34rem),
    radial-gradient(circle at 12% 18%, rgba(190, 202, 224, 0.11), transparent 28rem),
    linear-gradient(145deg, #0f0f13 0%, #17131a 58%, #111116 100%);
  letter-spacing: 0.01em;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), transparent 76%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.lab-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.intro-panel,
.access-panel,
.upload-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.intro-panel {
  padding: clamp(28px, 5vw, 58px);
}

.topline,
.action-row,
.panel-heading {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.site-label,
.eyebrow {
  margin: 0;
  color: var(--rose);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(3.4rem, 10vw, 7.8rem);
  font-weight: 600;
  line-height: 0.88;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  font-weight: 520;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 12px;
  color: var(--rose);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.subtitle {
  max-width: 720px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  line-height: 1.5;
}

.intro-copy,
.boundary-note p,
.access-panel p,
.upload-panel p,
.reading,
.disclaimer {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.intro-copy,
.boundary-note {
  max-width: 760px;
}

.boundary-note {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.boundary-note p:last-child,
.access-panel p:last-child,
.upload-panel p:last-child {
  margin-bottom: 0;
}

.access-panel,
.upload-panel,
.result-panel {
  margin-top: 22px;
  padding: clamp(22px, 4vw, 34px);
}

.access-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 20px;
}

input[type="password"] {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  outline: none;
}

input[type="password"]:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(217, 185, 197, 0.08);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 22px;
  align-items: start;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-button {
  color: #151116;
  border-color: rgba(217, 185, 197, 0.8);
  background: linear-gradient(135deg, #ead7df, #cfa9b8);
}

.primary-button:not(:disabled):hover,
.ghost-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.34);
}

.ghost-button {
  color: var(--muted);
}

.language-toggle {
  min-width: 76px;
}

.upload-zone {
  display: grid;
  gap: 8px;
  min-height: 168px;
  margin-top: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-small);
  padding: 24px;
  place-content: center;
  text-align: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-zone:hover {
  border-color: rgba(217, 185, 197, 0.55);
  background: rgba(255, 255, 255, 0.055);
}

.upload-zone span {
  font-size: 1.35rem;
}

.upload-zone small {
  max-width: 320px;
  color: var(--faint);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
  line-height: 1.6;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.preview-frame {
  margin: 20px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--bg-soft);
}

.preview-frame img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.action-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 22px;
}

.status-text,
.error-text {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
}

.status-text {
  color: var(--rose);
}

.error-text {
  color: #e6a6a6;
}

.result-head {
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
  margin: 10px 0 18px;
}

.result-head h2 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.9;
}

.result-head p {
  margin: 0;
  color: var(--rose);
  font-size: clamp(1.1rem, 3vw, 1.55rem);
}

.summary {
  color: var(--text);
  font-size: 1.18rem;
  line-height: 1.65;
}

.signals-block {
  margin: 24px 0;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.signals-block ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.signals-block li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
}

.disclaimer {
  margin-top: 22px;
  color: var(--faint);
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 780px) {
  .lab-shell {
    width: min(100% - 24px, 680px);
    padding: 24px 0 48px;
  }

  .topline,
  .access-form {
    grid-template-columns: 1fr;
  }

  .topline {
    align-items: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .access-form {
    display: grid;
  }

  .signals-block ul {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}

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