:root {
  color-scheme: dark;
  --bg: #0f1216;
  --panel: #151a21;
  --panel-2: #1b222b;
  --border: #25303b;
  --text: #eef2f6;
  --muted: #9fb0c1;
  --accent: #ffb454;
  --accent-2: #58d6ff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --doc-bg: #10141a;
  /* glass, the macOS 26+ material, tinted with the panel colour */
  --glass: rgba(21, 26, 33, 0.55);
  --blur: blur(24px) saturate(170%);
  --rim: inset 0 0.5px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 0.5px rgba(255, 255, 255, 0.07);
  --hairline: rgba(255, 255, 255, 0.08);
  --fill: rgba(255, 255, 255, 0.08);
  --fill-hover: rgba(255, 255, 255, 0.13);
  --fill-rim: inset 0 0.5px 0 rgba(255, 255, 255, 0.14);
  --accent-ink: #1a1208;
  --accent-glow: rgba(255, 180, 84, 0.28);
  --drop-bg: linear-gradient(145deg, rgba(27, 34, 43, 0.7), rgba(15, 18, 22, 0.6));
  --drop-bg-over: linear-gradient(145deg, rgba(88, 214, 255, 0.18), rgba(21, 26, 33, 0.7));
}

:root:has(body.theme-light) {
  color-scheme: light;
}

.theme-light {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --panel-2: #f0ebe2;
  --border: #d8d1c3;
  --text: #1f2328;
  --muted: #5e6a75;
  --accent: #b04a00;
  --accent-2: #0f6b8f;
  --shadow: 0 20px 45px rgba(20, 15, 10, 0.12);
  --doc-bg: #fffdf9;
  --glass: rgba(255, 253, 249, 0.62);
  --blur: blur(24px) saturate(180%);
  --rim: inset 0 0.5px 0 rgba(255, 255, 255, 0.95), inset 0 0 0 0.5px rgba(0, 0, 0, 0.07);
  --hairline: rgba(0, 0, 0, 0.08);
  --fill: rgba(0, 0, 0, 0.05);
  --fill-hover: rgba(0, 0, 0, 0.08);
  --fill-rim: inset 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  --accent-ink: #ffffff;
  --accent-glow: rgba(176, 74, 0, 0.24);
  --drop-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(240, 235, 226, 0.5));
  --drop-bg-over: linear-gradient(145deg, rgba(15, 107, 143, 0.12), rgba(255, 255, 255, 0.72));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background: radial-gradient(circle at 10% 10%, rgba(88, 214, 255, 0.12), transparent 40%),
    radial-gradient(circle at 90% 20%, rgba(255, 180, 84, 0.12), transparent 35%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* the brand keeps its own typeface; plain UI text uses the system font */
.brand-mark,
.brand-title,
.brand-sub,
.drop-title,
.panel-title {
  font-family: "Space Grotesk", system-ui, sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 40px;
  border-bottom: 0.5px solid var(--hairline);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b0d10;
  font-weight: 700;
  font-size: 20px;
}

.brand-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.file-button {
  position: relative;
  overflow: hidden;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.45), 0 6px 18px var(--accent-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-button:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.45), 0 10px 26px var(--accent-glow);
}

.file-button:active {
  transform: scale(0.97);
}

.ghost {
  border: 0;
  background: var(--fill);
  box-shadow: var(--fill-rim);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.ghost:hover:not(:disabled) {
  background: var(--fill-hover);
}

.ghost:active:not(:disabled) {
  transform: scale(0.97);
}

.ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ghost:focus-visible,
.file-button:has(input:focus-visible) {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.4fr);
  gap: 24px;
  padding: 28px 40px 40px;
  flex: 1;
}

.dropzone {
  border: 1px dashed var(--border);
  background: var(--drop-bg);
  border-radius: 22px;
  padding: 32px;
  min-height: 320px;
  display: grid;
  place-items: center;
  text-align: center;
  transition: border 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.dropzone.dragover {
  border-color: var(--accent-2);
  transform: translateY(-4px);
  background: var(--drop-bg-over);
}

.drop-inner {
  display: grid;
  gap: 10px;
}

.drop-title {
  font-size: 22px;
  font-weight: 600;
}

.drop-sub {
  color: var(--muted);
}

.drop-meta {
  font-size: 13px;
  color: var(--muted);
}

.panel {
  position: relative;
  background: var(--panel);
  border-radius: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* the rim sits on top, so the header and page fills inside don't hide it */
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--rim);
  pointer-events: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 16px 22px;
  border-bottom: 0.5px solid var(--hairline);
  background: var(--panel-2);
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-sub {
  font-size: 13px;
  color: var(--muted);
}

.doc {
  font-family: "Source Serif 4", Georgia, serif;
  padding: 26px 28px 40px;
  line-height: 1.7;
  background: var(--doc-bg);
  color: var(--text);
  overflow: auto;
  min-height: 360px;
  flex: 1;
}

.doc h1,
.doc h2,
.doc h3 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  letter-spacing: 0.4px;
}

.doc img {
  max-width: 100%;
  border-radius: 12px;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
}

.doc td,
.doc th {
  border: 1px solid var(--border);
  padding: 8px 10px;
}

.footer {
  padding: 16px 40px 24px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

/* wide screens: the bar floats over the document as it scrolls */
@media (min-width: 961px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}

@media (max-width: 960px) {
  .topbar {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    padding: 20px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 20px 20px 32px;
  }
}

/* Reduce Transparency: solid surfaces, no blur */
@media (prefers-reduced-transparency: reduce) {
  .topbar {
    background: var(--panel);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
