:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(42, 55, 79, 0.12);
  --line-strong: rgba(42, 55, 79, 0.18);
  --text: #1e2233;
  --muted: #70798f;
  --brand: #4c4cf2;
  --brand-soft: #e9e8ff;
  --accent: #ff8b5e;
  --shadow: 0 18px 60px rgba(27, 34, 66, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-ui: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(76, 76, 242, 0.08), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 139, 94, 0.12), transparent 28%),
    linear-gradient(180deg, #faf9f6 0%, var(--bg) 100%);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(76, 76, 242, 0.16), rgba(255, 139, 94, 0.12));
  color: var(--brand);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand h1,
.preview-header h2,
.panel-header h2 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
}

.mode-switch {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  background: rgba(39, 45, 65, 0.06);
  border-radius: 18px;
}

.logout-button {
  margin-left: auto;
}

.mode-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 18px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: 180ms ease;
}

.mode-tab.is-active {
  background: var(--panel-strong);
  color: var(--brand);
  box-shadow: 0 2px 12px rgba(46, 53, 95, 0.1);
}

.tab-icon {
  font-size: 1rem;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(350px, 520px) minmax(420px, 1fr);
  gap: 28px;
}

.panel {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control-panel {
  padding: 28px;
}

.preview-panel {
  padding: 28px;
  min-height: 760px;
}

.panel-header,
.preview-header,
.localized-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-header {
  margin-bottom: 28px;
}

.panel-header p,
.localized-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.panel-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: rgba(76, 76, 242, 0.08);
  border-radius: 14px;
  color: var(--brand);
  font-size: 1.2rem;
}

.panel-section,
.preview-section {
  display: none;
}

.panel-section.is-visible,
.preview-section.is-visible {
  display: block;
}

.field-group {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.field-group.compact {
  margin-bottom: 16px;
}

.field-group label {
  font-size: 0.98rem;
  font-weight: 700;
}

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

.supporting-text {
  color: var(--muted);
  font-size: 0.88rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="range"]:focus {
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: rgba(76, 76, 242, 0.45);
  box-shadow: 0 0 0 4px rgba(76, 76, 242, 0.12);
}

input[type="text"]:-webkit-autofill,
input[type="text"]:-webkit-autofill:hover,
input[type="text"]:-webkit-autofill:focus,
input[type="password"]:-webkit-autofill,
input[type="password"]:-webkit-autofill:hover,
input[type="password"]:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow:
    0 0 0 1000px rgba(255, 255, 255, 0.96) inset,
    0 0 0 4px rgba(76, 76, 242, 0.08);
  transition: background-color 9999s ease-out;
}

select {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  appearance: none;
}

select:focus {
  border-color: rgba(76, 76, 242, 0.45);
  box-shadow: 0 0 0 4px rgba(76, 76, 242, 0.12);
}

.provider-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.provider-option {
  border: 1px solid rgba(37, 47, 74, 0.1);
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  padding: 15px 16px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.provider-option.is-active {
  color: var(--brand);
  border-color: rgba(76, 76, 242, 0.24);
  box-shadow: 0 12px 30px rgba(42, 48, 81, 0.08);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 240, 255, 0.94));
}

.upload-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 186px;
  border: 1.8px dashed rgba(76, 89, 115, 0.28);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(244, 245, 255, 0.8)),
    rgba(255, 255, 255, 0.6);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragging {
  border-color: rgba(76, 76, 242, 0.45);
  transform: translateY(-1px);
  background:
    linear-gradient(135deg, rgba(247, 247, 255, 0.98), rgba(234, 239, 255, 0.92)),
    rgba(255, 255, 255, 0.8);
}

.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-empty-state {
  text-align: center;
  color: var(--muted);
}

.upload-empty-state p {
  margin: 0 0 8px;
}

.upload-empty-state strong {
  color: var(--brand);
}

.upload-empty-state span {
  font-size: 0.92rem;
}

.upload-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: rgba(76, 76, 242, 0.08);
  color: var(--brand);
  font-size: 2rem;
}

.upload-preview {
  position: absolute;
  inset: 0;
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-badge {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(23, 29, 46, 0.78);
  color: white;
  font-size: 0.86rem;
  backdrop-filter: blur(12px);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 20px 0 24px;
}

.insight-card,
.note-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(245, 246, 252, 0.8);
  border: 1px solid rgba(37, 47, 74, 0.06);
}

.insight-label,
.note-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.primary-button {
  width: 100%;
  border: 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6157ff, #7b68ee);
  color: white;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(86, 84, 220, 0.26);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(86, 84, 220, 0.32);
  filter: saturate(1.05);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 460px);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-xl);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auth-brand h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.05;
}

.auth-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  margin-top: 28px;
}

.auth-error {
  margin: 0 0 16px;
}

.secondary-tone {
  background: linear-gradient(135deg, #232b45, #33405f);
  box-shadow: 0 16px 36px rgba(36, 44, 69, 0.24);
}

.preview-status {
  align-self: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(76, 76, 242, 0.09);
  color: var(--brand);
  font-weight: 700;
  white-space: nowrap;
}

.toast-stack {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 80;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(37, 47, 74, 0.1);
  box-shadow: 0 18px 45px rgba(17, 22, 43, 0.16);
  color: var(--text);
  font-weight: 800;
  line-height: 1.35;
  animation: toast-in 180ms ease both;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast--success {
  border-color: rgba(38, 146, 89, 0.2);
  background: linear-gradient(135deg, rgba(245, 255, 249, 0.98), rgba(255, 255, 255, 0.96));
  color: #17633c;
}

.toast--error {
  border-color: rgba(212, 62, 62, 0.22);
  background: linear-gradient(135deg, rgba(255, 246, 246, 0.98), rgba(255, 255, 255, 0.96));
  color: #aa2d24;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
}

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

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

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

.preview-error {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(212, 62, 62, 0.08);
  color: #c0392b;
  font-size: 0.86rem;
  font-weight: 600;
  max-width: 420px;
}

.ghost-button {
  border: 1px solid rgba(76, 76, 242, 0.16);
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(42, 48, 81, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.ghost-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(42, 48, 81, 0.12);
  border-color: rgba(76, 76, 242, 0.28);
}

.notification-button {
  font-size: 0.88rem;
}

.notification-button:disabled {
  cursor: default;
  color: #17633c;
  border-color: rgba(38, 146, 89, 0.2);
  background: rgba(245, 255, 249, 0.96);
  transform: none;
  box-shadow: none;
}

.preview-canvas {
  display: grid;
  gap: 18px;
  min-height: 640px;
  align-content: center;
}

.hero-cover {
  position: relative;
  width: min(100%, 470px);
  aspect-ratio: 0.7;
  margin: 16px auto 0;
  padding: 26px;
  border-radius: 30px;
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, #223051 0%, #141929 100%);
  box-shadow:
    0 30px 60px rgba(27, 34, 66, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.hero-cover::before,
.mini-cover__art::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.22), transparent 24%),
    radial-gradient(circle at 84% 20%, rgba(255, 139, 94, 0.28), transparent 26%),
    linear-gradient(135deg, rgba(76, 76, 242, 0.45), transparent 55%);
  mix-blend-mode: screen;
}

.hero-cover__image {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 10, 18, 0.16), rgba(8, 10, 18, 0.58)),
    linear-gradient(135deg, #445175 0%, #1c2337 100%);
  background-size: cover;
  background-position: center;
  opacity: 0.22;
  transition: opacity 200ms ease;
}

.hero-cover__noise {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
  opacity: 0.5;
}

.hero-cover__content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.cover-kicker {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-cover h3 {
  margin: 0 0 10px;
  color: white;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.96;
  max-width: 11ch;
  text-wrap: balance;
}

.hero-cover p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.02rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.preview-notes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.note-card strong {
  font-size: 1.02rem;
}

.language-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 14px;
  margin-bottom: 22px;
}

.language-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(249, 250, 255, 0.9);
  border: 1px solid rgba(37, 47, 74, 0.08);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.language-card:not(.is-collapsed) {
  border-color: rgba(76, 76, 242, 0.14);
  box-shadow: 0 18px 34px rgba(42, 48, 81, 0.06);
}

.language-card__body {
  display: grid;
  gap: 14px;
  padding-top: 12px;
}

.language-card.is-collapsed .language-card__body {
  display: none;
}

.language-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--muted);
  margin: 12px 0 0;
}

.language-card:not(.is-collapsed) .language-toggle {
  margin-bottom: 12px;
}

.language-toggle input {
  accent-color: var(--brand);
}

.language-card.is-disabled {
  opacity: 0.55;
}

.language-card.is-disabled input[type="text"] {
  pointer-events: none;
}

.translation-overrides {
  display: grid;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid rgba(37, 47, 74, 0.08);
}

.translation-overrides__header {
  display: grid;
  gap: 10px;
}

.translation-overrides__header strong {
  display: block;
  font-size: 0.98rem;
}

.translation-overrides__header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.translation-overrides__add,
.translation-override-row__remove {
  border: 1px solid rgba(76, 76, 242, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
}

.translation-overrides__add {
  justify-self: start;
  padding: 9px 12px;
}

.translation-overrides__list {
  display: grid;
  gap: 10px;
}

.translation-overrides__empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.translation-override-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(37, 47, 74, 0.08);
}

.translation-override-row__fields {
  display: grid;
  gap: 10px;
}

.translation-override-field {
  display: grid;
  gap: 6px;
}

.translation-override-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.translation-override-row__remove {
  justify-self: start;
  padding: 7px 10px;
  font-size: 0.8rem;
}

.language-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.language-card:not(.is-collapsed) .language-card__header {
  margin-bottom: 0;
}

.language-card__header strong,
.language-card__header span {
  display: block;
}

.language-state {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.language-expand {
  border: 1px solid rgba(76, 76, 242, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 241, 255, 0.88));
  color: var(--brand);
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
  min-width: 74px;
  height: 36px;
  padding: 0 11px;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(42, 48, 81, 0.06);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.language-expand:hover {
  transform: translateY(-1px);
  border-color: rgba(76, 76, 242, 0.28);
  box-shadow: 0 12px 24px rgba(42, 48, 81, 0.1);
}

.language-card.is-disabled .language-expand {
  border-color: rgba(37, 47, 74, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  box-shadow: none;
}

.language-card:not(.is-collapsed) .language-expand {
  background:
    linear-gradient(135deg, rgba(76, 76, 242, 0.12), rgba(255, 255, 255, 0.96));
}

.language-expand-label {
  line-height: 1;
}

.language-chevron {
  font-size: 1rem;
  line-height: 1;
  transition: transform 160ms ease;
}

.language-card:not(.is-collapsed) .language-chevron {
  transform: rotate(180deg);
}

.localized-header {
  margin-bottom: 20px;
}

.localized-header h3 {
  margin: 0;
  font-size: 1.4rem;
}

.localized-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.history-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(37, 47, 74, 0.08);
}

.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.history-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.history-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.history-status {
  align-self: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(76, 76, 242, 0.08);
  color: var(--brand);
  font-weight: 700;
  font-size: 0.85rem;
}

.history-view-all {
  border: 1px solid rgba(76, 76, 242, 0.16);
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.history-card {
  border: 1px solid rgba(37, 47, 74, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  overflow: hidden;
  display: grid;
}

.history-thumb {
  height: 160px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}

.history-thumb:hover {
  filter: brightness(0.92);
  transform: scale(1.01);
}

.history-meta {
  padding: 12px 14px 14px;
}

.history-meta strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.history-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.history-action {
  margin-top: 10px;
  border: 0;
  background: rgba(76, 76, 242, 0.1);
  color: var(--brand);
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.history-empty {
  margin: 0;
  color: var(--muted);
}

.image-preview-modal[hidden] {
  display: none;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-preview-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 18, 33, 0.62);
  backdrop-filter: blur(12px);
}

.image-preview-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(17, 22, 43, 0.32);
}

.image-preview-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.image-preview-modal__header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.image-preview-modal__close {
  border: 0;
  background: rgba(37, 47, 74, 0.08);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
}

.image-preview-modal img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  border-radius: 18px;
  background: #f7f7f4;
}

.history-modal[hidden] {
  display: none;
}

.history-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
}

.history-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 18, 33, 0.46);
  backdrop-filter: blur(10px);
}

.history-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(17, 22, 43, 0.24);
  padding: 24px;
}

.history-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.history-modal__header h2 {
  margin: 0;
}

.history-modal__header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.history-modal__close {
  border: 0;
  background: rgba(37, 47, 74, 0.08);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.history-modal__body {
  display: grid;
  gap: 22px;
}

.history-modal.is-browser .history-detail,
.history-modal.is-detail .history-browser {
  display: none;
}

.history-modal.is-detail .history-modal__body {
  display: block;
}

.history-browser {
  display: grid;
  gap: 16px;
}

.history-browser__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

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

.history-page-button {
  border: 1px solid rgba(37, 47, 74, 0.1);
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.history-page-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.history-detail {
  border: 1px solid rgba(37, 47, 74, 0.08);
  border-radius: 24px;
  padding: 16px;
  background: rgba(248, 249, 255, 0.76);
}

.history-detail__hero img {
  display: block;
  width: 100%;
  max-height: min(66vh, 760px);
  object-fit: contain;
  border-radius: 18px;
  background: white;
}

.history-detail__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0 12px;
}

.history-detail__meta h3 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}

.history-detail__meta p {
  margin: 0;
  color: var(--muted);
}

.history-detail__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-detail__actions .history-action {
  margin-top: 0;
  padding: 12px 16px;
  border-radius: 14px;
}

.history-detail__prompt {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.history-detail__localized-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.history-detail__localized-card {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(37, 47, 74, 0.08);
  border-radius: 18px;
  overflow: hidden;
}

.history-detail__localized-card img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.history-detail__localized-actions {
  position: absolute;
  inset: 0 0 auto;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  background: rgba(14, 18, 33, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.history-detail__localized-card:hover .history-detail__localized-actions,
.history-detail__localized-card:focus-within .history-detail__localized-actions {
  opacity: 1;
  pointer-events: auto;
}

.history-detail__localized-actions button {
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand);
  cursor: pointer;
  font-weight: 800;
  padding: 10px 12px;
  box-shadow: 0 12px 28px rgba(13, 17, 31, 0.16);
}

.history-detail__localized-meta {
  padding: 12px;
}

.history-detail__localized-meta strong,
.history-detail__localized-meta span {
  display: block;
}

.history-detail__localized-meta span {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 4px;
}

.mini-cover {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(37, 47, 74, 0.08);
}

.mini-cover__art {
  position: relative;
  min-height: 178px;
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 10, 18, 0.16), rgba(8, 10, 18, 0.58)),
    linear-gradient(135deg, #445175 0%, #1c2337 100%);
}

.mini-cover__actions {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 7px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(14, 18, 33, 0.18), rgba(14, 18, 33, 0.68));
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.mini-cover:hover .mini-cover__actions,
.mini-cover:focus-within .mini-cover__actions {
  opacity: 1;
  pointer-events: auto;
}

.mini-cover__actions button {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #232b45;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
  min-width: 92px;
  padding: 8px 10px;
  box-shadow: 0 10px 24px rgba(13, 17, 31, 0.16);
  transition: transform 160ms ease, background 160ms ease;
}

.mini-cover__actions button:hover {
  transform: translateY(-1px);
  background: #ffffff;
}

.mini-cover__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.mini-cover__language {
  color: var(--brand);
  font-size: 0.84rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mini-cover__title {
  margin: 8px 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.02;
}

.mini-cover__author {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.82rem;
}

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

  .preview-panel {
    min-height: auto;
  }

  .preview-canvas {
    min-height: auto;
  }

  .history-browser__grid,
  .history-detail__localized-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

  .app-header,
  .panel-header,
  .preview-header,
  .localized-header,
  .history-header,
  .history-modal__header,
  .history-detail__meta,
  .history-modal__header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-switch,
  .language-grid,
  .localized-gallery,
  .preview-notes,
  .insight-strip,
  .history-grid,
  .history-browser__grid,
  .history-detail__localized-grid {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    display: grid;
  }

  .preview-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .control-panel,
  .preview-panel {
    padding: 20px;
  }

  .hero-cover {
    width: 100%;
  }

  .mini-cover {
    grid-template-columns: 1fr;
  }

  .mini-cover__art {
    min-height: 220px;
  }
}
