:root {
  color-scheme: light;
  --ink: #161616;
  --muted: #625f5b;
  --panel: rgba(255, 250, 244, 0.88);
  --panel-border: rgba(114, 93, 71, 0.14);
  --accent: #bc4f2a;
  --accent-ink: #fffaf5;
  --surface: #f3ece2;
  --surface-strong: #e4d3be;
  --shadow: 0 24px 60px rgba(74, 50, 26, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(188, 79, 42, 0.2), transparent 32%),
    linear-gradient(180deg, #fbf6f0 0%, #efe4d6 100%);
  color: var(--ink);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 20px 56px;
  display: grid;
  gap: 24px;
}

.hero {
  display: grid;
  gap: 16px;
}

.hero--bar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8f4d30;
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(2.3rem, 4.5vw, 4.2rem);
  line-height: 0.95;
  max-width: 12ch;
}

.subhead {
  font-size: 1.02rem;
  color: var(--muted);
  max-width: 640px;
  line-height: 1.5;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.uploader {
  display: grid;
  gap: 20px;
}

.dropzone {
  border: 1px dashed rgba(188, 79, 42, 0.35);
  border-radius: 18px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  text-align: center;
}

.dropzone input {
  display: none;
}

.dropzone__title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
}

.dropzone__hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.control {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

.control input,
.control select {
  border-radius: 12px;
  border: 1px solid rgba(114, 93, 71, 0.2);
  padding: 10px 12px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.75);
}

.control input:focus,
.control select:focus {
  outline: 2px solid rgba(188, 79, 42, 0.2);
  border-color: rgba(188, 79, 42, 0.55);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  border-radius: 999px;
  border: 1px solid rgba(114, 93, 71, 0.2);
  font-size: 0.95rem;
  padding: 10px 16px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
}

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-color: transparent;
}

.ghost {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(114, 93, 71, 0.2);
  color: var(--ink);
}

.preview {
  min-height: 160px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}

.preview__stack {
  position: relative;
  width: 100%;
  height: 100%;
}

.preview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 10px;
  width: 100%;
}

.preview__tile {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #f5f5f5;
}

.preview__tile--primary {
  grid-column: span 2;
  aspect-ratio: 16 / 9;
}

.preview__stack img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview__grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#mask-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.65;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--muted);
}

.toggle input {
  width: 18px;
  height: 18px;
}

.results {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(17, 18, 24, 0.1);
}

.results__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(114, 93, 71, 0.15);
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.64);
}

.results__note {
  font-size: 0.95rem;
  color: var(--muted);
}

.results__meta {
  font-size: 0.9rem;
  color: var(--muted);
}
.table {
  display: grid;
  gap: 12px;
}

.row {
  display: grid;
  grid-template-columns: 1.3fr 0.45fr 0.8fr 1fr 0.8fr 0.65fr;
  gap: 12px;
  background: rgba(255, 255, 255, 0.68);
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(114, 93, 71, 0.1);
  align-items: center;
}

.row span {
  font-size: 0.95rem;
}

.row strong {
  font-weight: 600;
}

.table__head {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 0 4px;
}

.tips ul {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  color: var(--muted);
}

footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding-bottom: 32px;
}

.login-shell {
  display: grid;
  place-items: center;
}

.login-layout {
  width: min(1100px, 100%);
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
  align-items: center;
  gap: 36px;
}

.login-copy {
  display: grid;
  gap: 18px;
}

.login-panel {
  justify-self: end;
  width: 100%;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form__header {
  display: grid;
  gap: 8px;
}

.login-form__header p {
  color: var(--muted);
  line-height: 1.5;
}

.login-form__submit {
  margin-top: 8px;
}

.form-message {
  min-height: 1.4em;
  font-size: 0.95rem;
  color: var(--muted);
}

.form-message[data-state="error"] {
  color: #a22828;
}

.session-chip {
  border: 1px solid rgba(114, 93, 71, 0.16);
  background: rgba(255, 255, 255, 0.66);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  main {
    padding-top: 40px;
  }

  .hero--bar,
  .login-layout {
    grid-template-columns: 1fr;
  }

  .hero__actions,
  .login-panel {
    justify-self: start;
  }

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

  .table__head {
    display: none;
  }
}
