:root {
  --color-ink: #141413;
  --color-paper: #faf9f5;
  --color-mid: #b0aea5;
  --color-fog: #e8e6dc;
  --color-accent: #d97757;
  --color-blue: #6a9bcc;
  --color-green: #788c5d;
  --shadow-soft: 0 18px 40px rgba(20, 20, 19, 0.08);
  --shadow-strong: 0 28px 80px rgba(20, 20, 19, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --grid-columns: repeat(auto-fit, minmax(320px, 1fr));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(217, 119, 87, 0.11), transparent 30%),
    radial-gradient(circle at right 15% top 10%, rgba(106, 155, 204, 0.12), transparent 20%),
    linear-gradient(180deg, #f7f4ed 0%, #f3efe5 48%, #efeadf 100%);
  color: var(--color-ink);
  font-family: Lora, Georgia, serif;
}

body.app-fullscreen-mode {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 20, 19, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 20, 19, 0.022) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 80%);
}

.page-shell {
  width: min(1880px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 20px;
  padding: 28px;
  background: rgba(250, 249, 245, 0.82);
  border: 1px solid rgba(20, 20, 19, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.eyebrow,
h1,
h2,
.button,
.status-chip strong,
.segment,
.filename {
  font-family: Poppins, Arial, sans-serif;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
}

h1,
h2 {
  margin: 0;
  line-height: 0.96;
  font-weight: 600;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.7rem);
  max-width: 9ch;
}

h2 {
  font-size: clamp(1.4rem, 2vw, 2.2rem);
}

.summary {
  margin: 16px 0 0;
  max-width: 52ch;
  color: rgba(20, 20, 19, 0.76);
  font-size: 1rem;
  line-height: 1.65;
}

.status-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.status-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(232, 230, 220, 0.72);
  border: 1px solid rgba(20, 20, 19, 0.08);
}

.status-chip span,
.meta,
.dropzone-note,
.focus-footer {
  color: rgba(20, 20, 19, 0.65);
}

.workspace {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.control-strip,
.dropzone,
.image-card,
.focus-dialog {
  background: rgba(250, 249, 245, 0.85);
  border: 1px solid rgba(20, 20, 19, 0.08);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.control-strip {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 16px;
  border-radius: var(--radius-lg);
}

.controls-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.button,
.segment,
.icon-button {
  border: 1px solid rgba(20, 20, 19, 0.1);
  background: rgba(250, 249, 245, 0.92);
  color: var(--color-ink);
  cursor: pointer;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.button,
.segment {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 999px;
  font-size: 0.92rem;
}

.button:hover,
.segment:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button:disabled,
.segment:disabled,
.icon-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.button.accent,
.segment.is-active {
  background: var(--color-ink);
  color: var(--color-paper);
  border-color: var(--color-ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.button.ghost {
  color: var(--color-accent);
  border-color: rgba(217, 119, 87, 0.22);
  background: rgba(217, 119, 87, 0.08);
}

.segmented {
  padding: 4px;
  border-radius: 999px;
  background: rgba(232, 230, 220, 0.78);
}

.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 0 8px;
  color: rgba(20, 20, 19, 0.76);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-accent);
}

.dropzone {
  position: relative;
  padding: 18px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dropzone::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1.5px dashed rgba(20, 20, 19, 0.14);
  border-radius: var(--radius-md);
  transition: border-color 180ms ease, background-color 180ms ease;
}

.dropzone.is-dragging::before {
  border-color: var(--color-accent);
  background: rgba(217, 119, 87, 0.05);
}

.dropzone-inner {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 112px;
  text-align: center;
}

.dropzone-title {
  margin: 0;
  font-family: Poppins, Arial, sans-serif;
  font-size: 1.05rem;
}

.dropzone-note {
  margin: 8px 0 0;
}

.board-wrap {
  min-height: 420px;
}

[hidden] {
  display: none !important;
}

.board-empty {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 32px;
  text-align: center;
  border-radius: var(--radius-lg);
  background: rgba(250, 249, 245, 0.42);
  border: 1px dashed rgba(20, 20, 19, 0.12);
}

.board-empty p {
  margin: 0;
  max-width: 46ch;
}

.board-empty p + p {
  margin-top: 10px;
  color: rgba(20, 20, 19, 0.65);
}

.compare-board {
  display: grid;
  gap: 16px;
  grid-template-columns: var(--grid-columns);
}

.compare-board.mode-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(420px, 30vw);
  grid-template-columns: none;
  overflow-x: auto;
  padding-bottom: 6px;
  align-items: start;
}

.compare-board.mode-strip .image-card {
  height: 100%;
}

.compare-board.columns-auto {
  --grid-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.compare-board.columns-2 {
  --grid-columns: repeat(2, minmax(0, 1fr));
}

.compare-board.columns-3 {
  --grid-columns: repeat(3, minmax(0, 1fr));
}

.compare-board.columns-4 {
  --grid-columns: repeat(4, minmax(0, 1fr));
}

.image-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  transform: translateY(8px);
  opacity: 0;
  animation: card-in 320ms ease forwards;
}

.card-topline {
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-blue), var(--color-green));
  opacity: 0.82;
}

.card-header {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
  padding: 14px 14px 10px;
}

.filename-wrap {
  min-width: 0;
}

.filename {
  margin: 0;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  margin: 6px 0 0;
  font-size: 0.86rem;
}

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

.icon-button {
  height: 32px;
  min-width: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: Poppins, Arial, sans-serif;
  font-size: 0.78rem;
}

.canvas-shell {
  position: relative;
  aspect-ratio: 4 / 3;
  margin: 0 12px 12px;
  overflow: hidden;
  border-radius: calc(var(--radius-lg) - 8px);
  background:
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%),
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}

.stage-view {
  display: grid;
  gap: 14px;
}

.fullscreen-view {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: 0;
  background:
    radial-gradient(circle at top left, rgba(217, 119, 87, 0.12), transparent 24%),
    radial-gradient(circle at right 20% top 12%, rgba(106, 155, 204, 0.14), transparent 20%),
    linear-gradient(180deg, #f6f2e8 0%, #efe9dd 100%);
}

.slider-view {
  display: grid;
  gap: 14px;
}

.slider-toolbar,
.slider-stage,
.slider-legend {
  background: rgba(250, 249, 245, 0.85);
  border: 1px solid rgba(20, 20, 19, 0.08);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
}

.slider-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
}

.slider-caption {
  margin: 0;
  color: rgba(20, 20, 19, 0.72);
}

.slider-stage {
  position: relative;
  height: min(72vh, 1020px);
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%),
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

.slider-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  transform: translateX(-50%);
  pointer-events: auto;
  cursor: ew-resize;
}

.slider-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(250, 249, 245, 0.92);
  box-shadow: 0 0 0 1px rgba(20, 20, 19, 0.16);
}

.slider-handle::after {
  content: "↔";
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--color-ink);
  color: var(--color-paper);
  font-family: Poppins, Arial, sans-serif;
  font-size: 0.82rem;
  box-shadow: 0 10px 28px rgba(20, 20, 19, 0.18);
}

.slider-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
}

.slider-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(20, 20, 19, 0.08);
  font-family: Poppins, Arial, sans-serif;
  font-size: 0.84rem;
  cursor: pointer;
  transition: opacity 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.slider-chip:hover {
  transform: translateY(-1px);
}

.slider-chip.is-hidden {
  opacity: 0.42;
  background: rgba(20, 20, 19, 0.04);
  border-color: rgba(20, 20, 19, 0.06);
}

.slider-chip-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.stage-toolbar,
.stage-thumbs,
.stage-canvas-shell {
  background: rgba(250, 249, 245, 0.85);
  border: 1px solid rgba(20, 20, 19, 0.08);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
}

.stage-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
}

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

.fullscreen-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stage-caption {
  margin: 0;
  color: rgba(20, 20, 19, 0.72);
}

.fullscreen-caption {
  margin: 0;
  color: var(--color-paper);
  font-family: Poppins, Arial, sans-serif;
  font-size: 0.92rem;
  line-height: 1.4;
  text-shadow: 0 2px 8px rgba(20, 20, 19, 0.35);
  max-width: min(68ch, calc(100vw - 320px));
}

.stage-canvas-shell {
  position: relative;
  height: min(68vh, 980px);
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%),
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

.fullscreen-canvas-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%),
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

.fullscreen-overlay {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  pointer-events: none;
}

.fullscreen-overlay-top {
  top: 0;
  padding: 18px 20px;
  align-items: start;
  background: linear-gradient(180deg, rgba(20, 20, 19, 0.52) 0%, rgba(20, 20, 19, 0.18) 66%, transparent 100%);
}

.fullscreen-overlay-bottom {
  bottom: 0;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(0deg, rgba(20, 20, 19, 0.5) 0%, rgba(20, 20, 19, 0.16) 58%, transparent 100%);
}

.fullscreen-overlay .button,
.fullscreen-overlay .fullscreen-hint {
  pointer-events: auto;
}

.fullscreen-hint {
  padding: 10px 14px;
  color: rgba(250, 249, 245, 0.88);
  font-family: Poppins, Arial, sans-serif;
  font-size: 0.84rem;
  border: 1px solid rgba(250, 249, 245, 0.16);
  border-radius: 999px;
  background: rgba(20, 20, 19, 0.34);
  backdrop-filter: blur(12px);
}

.fullscreen-view:fullscreen {
  padding: 0;
}

.stage-thumbs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 220px);
  gap: 12px;
  overflow-x: auto;
  padding: 12px;
}

.stage-thumb {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(20, 20, 19, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.48);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.stage-thumb:hover {
  transform: translateY(-1px);
}

.stage-thumb.is-active {
  border-color: rgba(217, 119, 87, 0.42);
  background: rgba(217, 119, 87, 0.08);
}

.stage-thumb-preview {
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(20, 20, 19, 0.06);
}

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

.stage-thumb-name {
  margin: 0;
  font-family: Poppins, Arial, sans-serif;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-canvas,
#focusCanvas,
#stageCanvas,
#fullscreenCanvas,
#sliderCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.hide-names .card-header {
  display: none;
}

.focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.focus-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 19, 0.54);
  backdrop-filter: blur(10px);
}

.focus-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  width: min(1320px, calc(100% - 32px));
  height: min(88vh, 920px);
  margin: 4vh auto 0;
  padding: 18px;
  border-radius: 30px;
  box-shadow: var(--shadow-strong);
}

.focus-header,
.focus-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.focus-stage {
  min-height: 0;
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%),
    linear-gradient(45deg, rgba(20, 20, 19, 0.08) 25%, transparent 25%, transparent 75%, rgba(20, 20, 19, 0.08) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

.focus-footer p {
  margin: 0;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1040px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .compare-board.columns-4,
  .compare-board.columns-3 {
    --grid-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .slider-toolbar {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 18px, 100%);
    padding-top: 12px;
  }

  .topbar,
  .control-strip,
  .dropzone,
  .focus-dialog {
    padding: 16px;
  }

  .compare-board.columns-2,
  .compare-board.columns-3,
  .compare-board.columns-4,
  .compare-board.columns-auto {
    --grid-columns: 1fr;
  }

  .compare-board.mode-strip {
    grid-auto-columns: minmax(280px, 86vw);
  }

  .focus-dialog {
    width: calc(100% - 16px);
    height: calc(100vh - 16px);
    margin-top: 8px;
    border-radius: 24px;
  }

  .focus-header,
  .focus-footer {
    align-items: start;
    flex-direction: column;
  }

  .stage-canvas-shell {
    height: min(56vh, 560px);
  }

  .fullscreen-canvas-shell {
    height: 100%;
  }

  .fullscreen-overlay-top {
    padding: 14px;
    flex-direction: column;
    align-items: stretch;
  }

  .fullscreen-actions {
    justify-content: flex-start;
  }

  .fullscreen-caption {
    max-width: none;
  }

  .slider-stage {
    height: min(58vh, 580px);
  }
}
