:root {
  --burgundy: #751d3c;
  --burgundy-dark: #551126;
  --burgundy-soft: #f5e9ed;
  --ink: #2d2824;
  --muted: #766d65;
  --line: #e3dcd4;
  --canvas: #f2eee8;
  --card: #fffdfa;
  --green: #438e5e;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino,
    Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(117, 29, 60, 0.25);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.primary-button {
  border: 1px solid var(--burgundy);
  color: #fff;
  background: var(--burgundy);
  box-shadow: 0 10px 24px rgba(80, 17, 38, 0.16);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: var(--burgundy-dark);
  box-shadow: 0 13px 28px rgba(80, 17, 38, 0.2);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--burgundy);
  background: #fff;
}

.secondary-button:hover {
  border-color: rgba(117, 29, 60, 0.35);
  background: #fff9f7;
}

.full-button {
  width: 100%;
}

/* Login */

.login-page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 48px 24px 76px;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.9), transparent 33%),
    radial-gradient(circle at 88% 4%, rgba(117, 29, 60, 0.09), transparent 29%),
    #eee7de;
}

.login-atmosphere {
  position: absolute;
  inset: 0;
  opacity: 0.3;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 510px);
  padding: 30px 42px 32px;
  border: 1px solid rgba(117, 29, 60, 0.1);
  border-radius: 25px;
  background: rgba(255, 253, 249, 0.96);
  box-shadow:
    0 32px 80px rgba(68, 52, 39, 0.13),
    0 3px 10px rgba(68, 52, 39, 0.05);
  backdrop-filter: blur(20px);
}

.login-brand {
  display: grid;
  gap: 17px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.login-brand img {
  width: min(100%, 340px);
  height: auto;
  display: block;
  object-fit: contain;
  object-position: left center;
}

.login-brand > span {
  color: var(--burgundy);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-heading {
  padding: 30px 0 24px;
}

.login-heading p {
  margin: 0 0 10px;
  color: var(--burgundy);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.login-heading h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(35px, 7vw, 46px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.login-heading > span {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

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

.login-form label,
.field {
  display: grid;
  gap: 8px;
}

.login-form label > span,
.field > span {
  color: #514942;
  font-size: 12px;
  font-weight: 750;
}

.login-form input,
.field input {
  width: 100%;
  height: 50px;
  border: 1px solid #ded6cd;
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  padding: 0 15px;
  font-size: 14px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.login-form input:focus,
.field input:focus {
  border-color: rgba(117, 29, 60, 0.55);
  outline: none;
  box-shadow: 0 0 0 4px rgba(117, 29, 60, 0.08);
}

.form-error {
  margin: -2px 0 0;
  border: 1px solid #f2cdd8;
  border-radius: 9px;
  color: #9d2445;
  background: #fff0f3;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
}

.display-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.display-link:hover {
  color: var(--burgundy);
}

.login-footer {
  position: absolute;
  z-index: 1;
  bottom: 22px;
  margin: 0;
  color: #897e74;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.03em;
}

/* Panel shell */

.panel-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  background: #f3efe9;
}

.panel-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 18px 18px;
  border-right: 1px solid #ded7cf;
  background: #fffdf9;
}

.sidebar-brand {
  display: grid;
  gap: 14px;
  padding: 2px 8px 23px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand img {
  width: 100%;
  max-width: 225px;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: left center;
}

.sidebar-brand > div {
  display: grid;
  gap: 4px;
}

.sidebar-brand strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.sidebar-brand span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel-navigation {
  display: grid;
  gap: 6px;
  margin-top: 25px;
}

.panel-navigation button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #61584f;
  background: transparent;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.panel-navigation button > span {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #ded6cd;
  border-radius: 8px;
  color: #95887c;
  font-size: 9px;
  font-weight: 800;
}

.panel-navigation button:hover {
  color: var(--burgundy);
  background: #faf6f3;
}

.panel-navigation button.active {
  border-color: #ead8df;
  color: var(--burgundy);
  background: var(--burgundy-soft);
}

.panel-navigation button.active > span {
  border-color: var(--burgundy);
  color: #fff;
  background: var(--burgundy);
}

.sidebar-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: auto;
  border: 1px solid #e7e0d6;
  border-radius: 12px;
  background: #faf8f4;
  padding: 13px;
}

.status-dot,
.live-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #48a069;
  box-shadow: 0 0 0 4px rgba(72, 160, 105, 0.1);
}

.sidebar-note > div {
  display: grid;
  gap: 4px;
}

.sidebar-note strong {
  font-size: 11px;
}

.sidebar-note small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.sidebar-logout {
  margin-top: 10px;
}

.sidebar-logout button {
  width: 100%;
  border: 0;
  color: #8b8076;
  background: transparent;
  padding: 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.sidebar-logout button:hover {
  color: var(--burgundy);
}

.panel-main {
  min-width: 0;
  padding: 0 32px 58px;
}

.panel-header {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid #ddd6ce;
}

.panel-header p {
  margin: 0 0 5px;
  color: var(--burgundy);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.panel-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.saved-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #71675e;
  font-size: 11px;
  font-weight: 650;
}

.saved-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c59b45;
}

.saved-status.saved i {
  background: #48a069;
}

.saved-status.error i {
  background: #b52f51;
}

.panel-workspace {
  display: grid;
  grid-template-columns: minmax(500px, 1fr) minmax(390px, 0.84fr);
  gap: 32px;
  max-width: 1510px;
  margin: 0 auto;
  padding-top: 34px;
}

.editor-column,
.preview-column {
  min-width: 0;
}

.panel-tab {
  display: none;
}

.panel-tab.active {
  display: block;
  animation: tabIn 220ms ease both;
}

@keyframes tabIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-intro {
  min-height: 74px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.section-intro > span {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #d9cfd0;
  border-radius: 10px;
  color: var(--burgundy);
  background: #fffaf8;
  font-size: 10px;
  font-weight: 800;
}

.section-intro h2 {
  margin: -3px 0 5px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 550;
}

.section-intro p {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.control-card {
  margin-bottom: 18px;
  border: 1px solid #dfd8cf;
  border-radius: 17px;
  background: var(--card);
  padding: 24px;
  box-shadow: 0 6px 22px rgba(64, 48, 34, 0.035);
}

.card-heading {
  margin-bottom: 20px;
  padding-bottom: 17px;
  border-bottom: 1px solid #ece6de;
}

.inline-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.card-heading h3 {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}

.card-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field-full {
  grid-column: 1 / -1;
}

.field > small {
  color: #8a7f75;
  font-size: 10px;
}

.toggle-list {
  display: grid;
}

.toggle-row {
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid #eee8e1;
  cursor: pointer;
}

.toggle-row:last-child {
  border-bottom: 0;
}

.toggle-copy {
  display: grid;
  gap: 5px;
}

.toggle-copy strong {
  font-size: 12px;
}

.toggle-copy small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 43px;
  height: 24px;
  border-radius: 999px;
  background: #d8d1c9;
  transition: background 180ms ease;
}

.toggle-track > span {
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(44, 34, 27, 0.18);
  transition: transform 180ms ease;
}

.toggle-row input:checked + .toggle-track {
  background: var(--burgundy);
}

.toggle-row input:checked + .toggle-track > span {
  transform: translateX(19px);
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-card {
  position: relative;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid #ddd5cc;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  padding: 19px 17px 17px 48px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.choice-card:hover {
  transform: translateY(-1px);
  border-color: rgba(117, 29, 60, 0.38);
}

.choice-card.selected {
  border-color: rgba(117, 29, 60, 0.58);
  background: #fff8fa;
  box-shadow: inset 0 0 0 1px rgba(117, 29, 60, 0.08);
}

.choice-card:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.choice-card:disabled:hover {
  transform: none;
  border-color: #ddd5cc;
}

.choice-radio {
  position: absolute;
  left: 17px;
  top: 19px;
  width: 18px;
  height: 18px;
  border: 1px solid #bcb2a9;
  border-radius: 50%;
  background: #fff;
}

.choice-card.selected .choice-radio {
  border: 5px solid var(--burgundy);
}

.choice-card strong {
  margin-bottom: 7px;
  font-size: 12px;
}

.choice-card span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.mode-note {
  margin: 14px 0 0;
  border: 1px solid #e7ddd2;
  border-radius: 10px;
  color: #6f6258;
  background: #faf7f2;
  padding: 11px 13px;
  font-size: 10px;
  line-height: 1.5;
}

.range-control {
  margin-top: 22px;
  border-radius: 12px;
  background: #f8f5f0;
  padding: 17px 18px 14px;
}

.range-control > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 13px;
  font-size: 11px;
}

.range-control > div:first-child span {
  color: var(--muted);
}

.range-control > div:first-child strong {
  color: var(--burgundy);
}

.range-control input {
  width: 100%;
  accent-color: var(--burgundy);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  color: #9c9188;
  font-size: 9px;
}

.text-button {
  border: 0;
  background: transparent;
  padding: 5px;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.text-button.danger {
  color: #a12c4c;
}

.upload-zone {
  min-height: 165px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed #cfc4b9;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(117, 29, 60, 0.035), transparent 55%),
    #fbfaf7;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.upload-zone:hover,
.upload-zone.dragging {
  border-color: var(--burgundy);
  background: #fff7fa;
}

.upload-zone.dragging {
  transform: scale(1.008);
}

.upload-symbol {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid #e4ccd5;
  border-radius: 11px;
  color: var(--burgundy);
  background: #fff;
  font-family: var(--serif);
  font-size: 26px;
}

.upload-zone strong {
  font-size: 12px;
}

.upload-zone > span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.upload-zone small {
  margin-top: 10px;
  color: #a0978e;
  font-size: 9px;
}

.upload-error {
  margin-top: 12px;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  border-radius: 10px;
  color: #685b51;
  background: #f7f2ec;
  padding: 11px 13px;
  font-size: 10px;
}

.upload-progress > span {
  width: 15px;
  height: 15px;
  border: 2px solid #d7c8bd;
  border-top-color: var(--burgundy);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.image-list {
  display: grid;
  gap: 8px;
  margin-top: 17px;
}

.image-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  border: 1px solid #e4ddd5;
  border-radius: 11px;
  background: #fff;
  padding: 7px;
}

.image-row.active {
  border-color: rgba(117, 29, 60, 0.48);
  background: #fff9fb;
}

.image-row > img {
  width: 72px;
  height: 52px;
  border-radius: 7px;
  object-fit: cover;
  background: #eee9e3;
}

.image-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.image-meta strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-meta span {
  color: var(--muted);
  font-size: 9px;
}

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

.square-action,
.small-action {
  min-height: 31px;
  border: 1px solid #dfd7ce;
  border-radius: 8px;
  background: #fff;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.square-action {
  width: 31px;
  padding: 0;
}

.small-action {
  padding: 0 10px;
}

.square-action:hover,
.small-action:hover {
  border-color: rgba(117, 29, 60, 0.42);
  color: var(--burgundy);
  background: #fff9fb;
}

.square-action:disabled {
  opacity: 0.35;
  cursor: default;
}

.remove-action {
  color: #a12c4c;
}

.select-action {
  color: var(--burgundy);
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #ded6cd;
  border-radius: 11px;
  background: #f4f0eb;
  padding: 4px;
}

.segmented-control button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #756b62;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.segmented-control button.active {
  color: var(--burgundy);
  background: #fff;
  box-shadow: 0 3px 10px rgba(60, 45, 34, 0.08);
}

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

.motif-card {
  overflow: hidden;
  border: 1px solid #ddd6ce;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  padding: 0;
  text-align: left;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.motif-card:hover {
  transform: translateY(-2px);
  border-color: rgba(117, 29, 60, 0.36);
  box-shadow: 0 9px 20px rgba(60, 46, 35, 0.08);
}

.motif-card.selected {
  border-color: var(--burgundy);
  box-shadow: 0 0 0 2px rgba(117, 29, 60, 0.1);
}

.motif-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--preview-text);
  background: var(--preview-bg);
  padding-top: 12%;
}

.motif-preview > span {
  position: absolute;
  top: 8px;
  left: 9px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.63);
  padding: 3px 5px;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.motif-preview > strong {
  font-family: var(--serif);
  font-size: clamp(10px, 1.15vw, 16px);
  font-weight: 500;
}

.motif-preview > i {
  width: 29%;
  height: 44%;
  margin-top: 7px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(150deg, #f8f6f1, #bfb2a6);
  box-shadow: 0 3px 8px rgba(40, 30, 22, 0.16);
}

.motif-preview > b {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14%;
  display: grid;
  place-items: center;
  color: var(--preview-text);
  background: rgba(255, 255, 255, 0.48);
  font-size: 5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.theme-warm {
  --preview-bg: #f4efe6;
  --preview-text: #51473d;
}

.theme-classic {
  --preview-bg: #f8f5ef;
  --preview-text: #6e1936;
}

.theme-bordeaux {
  --preview-bg: #681931;
  --preview-text: #fff7ef;
}

.theme-sage {
  --preview-bg: #edf0e8;
  --preview-text: #3f463f;
}

.theme-twilight {
  --preview-bg: #17191a;
  --preview-text: #f1ece2;
}

.theme-clear {
  --preview-bg: #fbfaf8;
  --preview-text: #34302d;
}

.theme-bordeaux > span,
.theme-twilight > span {
  background: rgba(0, 0, 0, 0.26);
}

.motif-card > div:last-child {
  min-height: 67px;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 11px 12px;
}

.motif-card > div:last-child strong {
  font-size: 11px;
}

.motif-card > div:last-child small {
  color: var(--muted);
  font-size: 8px;
}

/* Preview */

.preview-card {
  position: sticky;
  top: 26px;
  border: 1px solid #dcd4cb;
  border-radius: 18px;
  background: #fffdf9;
  padding: 16px;
  box-shadow: 0 18px 45px rgba(64, 48, 34, 0.07);
}

.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 3px 14px;
}

.preview-heading > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.preview-heading strong {
  font-size: 11px;
}

.preview-heading small {
  color: var(--muted);
  font-size: 9px;
}

.preview-screen {
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 7px solid #222;
  border-radius: 7px;
  background: #171717;
  box-shadow:
    0 17px 35px rgba(25, 20, 17, 0.22),
    inset 0 0 0 1px #3d3d3d;
}

.preview-screen iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #f4efe6;
}

.preview-summary {
  display: grid;
  grid-template-columns: 1fr 0.72fr 1fr;
  gap: 10px;
  margin: 18px 2px 14px;
}

.preview-summary > span {
  min-width: 0;
  display: grid;
  gap: 3px;
  border-right: 1px solid #e8e1d9;
}

.preview-summary > span:last-child {
  border-right: 0;
}

.preview-summary small {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.preview-summary strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-note {
  margin-top: 16px;
  border: 1px solid #e1d9cf;
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.72);
  padding: 16px 18px;
}

.browser-note strong {
  color: var(--burgundy);
  font-size: 10px;
}

.browser-note p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 360px;
  border: 1px solid #ded5ca;
  border-radius: 12px;
  color: #564c44;
  background: rgba(255, 253, 249, 0.98);
  padding: 12px 15px;
  box-shadow: 0 14px 34px rgba(47, 36, 28, 0.14);
  font-size: 11px;
  line-height: 1.5;
  animation: toastIn 220ms ease both;
}

.toast.error {
  border-color: #efc3cf;
  color: #8e2342;
  background: #fff5f7;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* TV display and adaptive logos */

.tv-page {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #111;
  cursor: none;
}

.tv-page:has(.fullscreen-button.visible) {
  cursor: default;
}

.tv-page.is-embedded-preview {
  min-height: 100%;
  cursor: default;
}

.display-canvas {
  --display-bg: #f4efe6;
  --display-text: #51473d;
  --display-muted: #6e6257;
  --display-accent: #9a8066;
  --display-frame: #fffaf3;
  --display-banner: rgba(222, 208, 190, 0.97);
  --display-banner-text: #51473d;
  --display-shadow: rgba(81, 71, 61, 0.2);
  --display-overlay:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.48), transparent 34%),
    radial-gradient(circle at 5% 5%, rgba(201, 181, 154, 0.2), transparent 34%),
    radial-gradient(circle at 95% 88%, rgba(201, 181, 154, 0.18), transparent 31%);
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  container-type: inline-size;
  display: grid;
  grid-template-rows: 20% minmax(0, 1fr) 12%;
  color: var(--display-text);
  background: var(--display-bg);
}

.display-canvas.without-heading {
  grid-template-rows: 0 minmax(0, 1fr) 12%;
}

.display-canvas.without-footer {
  grid-template-rows: 20% minmax(0, 1fr) 0;
}

.display-canvas.without-heading.without-footer {
  grid-template-rows: 0 minmax(0, 1fr) 0;
}

.display-atmosphere {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--display-overlay);
}

.display-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.26;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}

.display-canvas.theme-warm {
  --display-bg: #f4efe6;
  --display-text: #51473d;
  --display-muted: #6e6257;
  --display-accent: #9a8066;
  --display-frame: #fffaf3;
  --display-banner: rgba(222, 208, 190, 0.97);
  --display-banner-text: #51473d;
  --display-shadow: rgba(81, 71, 61, 0.2);
  --display-overlay:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.48), transparent 34%),
    radial-gradient(circle at 5% 5%, rgba(201, 181, 154, 0.2), transparent 34%),
    radial-gradient(circle at 95% 88%, rgba(201, 181, 154, 0.18), transparent 31%);
}

.display-canvas.theme-classic {
  --display-bg: #f8f5ef;
  --display-text: #4c2833;
  --display-muted: #756268;
  --display-accent: #7a2440;
  --display-frame: #fff;
  --display-banner: rgba(255, 252, 248, 0.97);
  --display-banner-text: #6e1936;
  --display-shadow: rgba(83, 40, 51, 0.17);
  --display-overlay:
    linear-gradient(90deg, rgba(117, 29, 60, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.65), transparent 48%);
}

.display-canvas.theme-bordeaux {
  --display-bg: #681931;
  --display-text: #fff7ef;
  --display-muted: #ead4db;
  --display-accent: #d5acb9;
  --display-frame: #f9eee8;
  --display-banner: rgba(250, 243, 236, 0.97);
  --display-banner-text: #681931;
  --display-shadow: rgba(30, 5, 14, 0.45);
  --display-overlay:
    radial-gradient(circle at 50% 46%, rgba(255, 241, 225, 0.12), transparent 35%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.05), transparent 45%),
    linear-gradient(0deg, #551126, transparent 50%);
}

.display-canvas.theme-sage {
  --display-bg: #edf0e8;
  --display-text: #3f463f;
  --display-muted: #657066;
  --display-accent: #84917e;
  --display-frame: #fafbf5;
  --display-banner: rgba(229, 234, 222, 0.97);
  --display-banner-text: #3f463f;
  --display-shadow: rgba(62, 73, 62, 0.18);
  --display-overlay:
    radial-gradient(circle at 0 90%, rgba(125, 145, 121, 0.16), transparent 35%),
    radial-gradient(circle at 100% 5%, rgba(169, 181, 153, 0.2), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent);
}

.display-canvas.theme-twilight {
  --display-bg: #17191a;
  --display-text: #f1ece2;
  --display-muted: #cabfae;
  --display-accent: #b89a62;
  --display-frame: #d7c59f;
  --display-banner: rgba(27, 29, 29, 0.97);
  --display-banner-text: #eee5d5;
  --display-shadow: rgba(0, 0, 0, 0.55);
  --display-overlay:
    radial-gradient(circle at 50% 42%, rgba(211, 188, 138, 0.1), transparent 38%),
    radial-gradient(circle at 50% 50%, transparent 30%, rgba(0, 0, 0, 0.38) 100%);
}

.display-canvas.theme-clear {
  --display-bg: #fbfaf8;
  --display-text: #34302d;
  --display-muted: #77716c;
  --display-accent: #c8beb3;
  --display-frame: #fff;
  --display-banner: rgba(247, 244, 240, 0.98);
  --display-banner-text: #514b46;
  --display-shadow: rgba(50, 44, 38, 0.15);
  --display-overlay: linear-gradient(
    145deg,
    rgba(231, 225, 217, 0.34),
    transparent 28%,
    transparent 72%,
    rgba(229, 223, 216, 0.28)
  );
}

.memorial-heading {
  position: relative;
  z-index: 2;
  grid-row: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.3cqw 5cqw 0.5cqw;
  text-align: center;
}

.memorial-heading h1 {
  max-width: 90%;
  overflow: hidden;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(20px, 6.15cqw, 94px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.life-dates {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.7cqw 2.2cqw;
  margin-top: 1.1cqw;
  color: var(--display-muted);
  font-size: clamp(7px, 1.75cqw, 28px);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.portrait-stage {
  position: relative;
  z-index: 1;
  grid-row: 2;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4cqw 6cqw 1.4cqw;
}

.display-photo {
  display: block;
  width: auto;
  height: 100%;
  max-width: 84%;
  min-height: 0;
  border: max(1px, 0.18cqw) solid var(--display-frame);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0.8cqw 2.1cqw var(--display-shadow);
  animation: displayFade 1.2s ease both;
}

.fit-cover .display-photo {
  width: 90%;
  height: 100%;
  object-fit: cover;
}

.transition-fade-zoom .display-photo {
  animation: displayFadeZoom 10s ease-out both;
}

.standard-display {
  width: min(72cqw, 1120px);
  min-height: 58%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2cqw;
  color: var(--display-muted);
  padding: 1.8cqw 2.6cqw;
}

.standard-display > span {
  font-family: var(--serif);
  font-size: clamp(9px, 1.55cqw, 24px);
  letter-spacing: 0.03em;
}

.adaptive-logo {
  display: grid;
  place-items: center;
}

.adaptive-logo img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.standard-logo {
  width: min(68cqw, 1050px);
}

.logo-for-dark {
  display: none !important;
}

.theme-bordeaux .logo-for-light,
.theme-twilight .logo-for-light {
  display: none !important;
}

.theme-bordeaux .logo-for-dark,
.theme-twilight .logo-for-dark {
  display: block !important;
  border-radius: 0.35cqw;
  background: #fff;
  padding: 0.25cqw 0.45cqw;
  box-shadow: 0 0.65cqw 2cqw rgba(0, 0, 0, 0.24);
}

.display-brandbar {
  position: relative;
  z-index: 3;
  grid-row: 3;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3cqw;
  border-top: max(1px, 0.08cqw) solid var(--display-accent);
  color: var(--display-banner-text);
  background: var(--display-banner);
  padding: 0.55cqw 3cqw;
}

.display-brandbar > span {
  flex: 0 0 auto;
  font-size: clamp(7px, 1.5cqw, 23px);
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brandbar-logo {
  width: min(31cqw, 500px);
  max-height: 88%;
}

.display-brandbar .logo-for-dark {
  box-shadow: none;
}

.floating-display-logo {
  position: absolute;
  z-index: 4;
  right: 2.2cqw;
  bottom: 2.1cqw;
  width: min(31cqw, 500px);
}

.floating-display-logo .logo-for-dark {
  border-radius: 0.35cqw;
  background: #fff;
  padding: 0.28cqw 0.48cqw;
}

/* Full-bleed photo option */

.display-canvas.layout-fullscreen {
  display: block;
}

.layout-fullscreen .display-atmosphere {
  z-index: -1;
}

.layout-fullscreen .portrait-stage {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
}

.layout-fullscreen .display-photo {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  box-shadow: none;
}

.layout-fullscreen.fit-cover .display-photo {
  width: 100%;
  object-fit: cover;
}

.layout-fullscreen.fit-contain .display-photo {
  width: 100%;
  object-fit: contain;
  background: var(--display-bg);
}

.layout-fullscreen .standard-display {
  width: min(76cqw, 1180px);
}

.layout-fullscreen .memorial-heading {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 22%;
  padding: 2.1cqw 5cqw 3.5cqw;
}

.layout-fullscreen.has-photo .memorial-heading {
  color: #fff;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.72),
    rgba(0, 0, 0, 0.3) 58%,
    transparent
  );
  text-shadow: 0 0.18cqw 0.65cqw rgba(0, 0, 0, 0.62);
}

.layout-fullscreen.has-photo .life-dates {
  color: rgba(255, 255, 255, 0.9);
}

.layout-fullscreen .display-brandbar {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 11.5%;
}

.layout-fullscreen.has-photo .display-brandbar {
  border-top-color: rgba(255, 255, 255, 0.32);
  color: #fff;
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.78),
    rgba(0, 0, 0, 0.48)
  );
  backdrop-filter: blur(8px);
}

.layout-fullscreen.has-photo .display-brandbar .logo-for-light {
  display: none !important;
}

.layout-fullscreen.has-photo .display-brandbar .logo-for-dark {
  display: block !important;
  border-radius: 0.28cqw;
  background: #fff;
  padding: 0.18cqw 0.3cqw;
}

.layout-fullscreen.has-photo .floating-display-logo .logo-for-light {
  display: none !important;
}

.layout-fullscreen.has-photo .floating-display-logo .logo-for-dark {
  display: block !important;
  border-radius: 0.35cqw;
  background: #fff;
  padding: 0.25cqw 0.45cqw;
  box-shadow: 0 0.5cqw 1.7cqw rgba(0, 0, 0, 0.32);
}

@keyframes displayFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes displayFadeZoom {
  from {
    opacity: 0;
    transform: scale(1);
  }
  14% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: scale(1.018);
  }
}

.fullscreen-button {
  position: fixed;
  z-index: 20;
  top: 18px;
  right: 18px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 10px;
  color: #fff;
  background: rgba(25, 23, 22, 0.72);
  padding: 0 15px;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 200ms ease;
}

.fullscreen-button.visible {
  opacity: 1;
  pointer-events: auto;
}

.connection-status {
  position: fixed;
  z-index: 20;
  left: 18px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(25, 23, 22, 0.68);
  padding: 7px 10px;
  opacity: 0;
  font-size: 9px;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.connection-status.visible {
  opacity: 1;
}

.connection-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #63c982;
}

.connection-status.offline i {
  background: #e17b57;
}

/* Responsive panel */

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

  .preview-column {
    order: -1;
  }

  .preview-card {
    position: relative;
    top: auto;
    max-width: 780px;
  }
}

@media (max-width: 860px) {
  .panel-shell {
    display: block;
  }

  .panel-sidebar {
    position: relative;
    z-index: 10;
    width: 100%;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid #ded7cf;
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 3px 12px;
  }

  .sidebar-brand img {
    width: min(52%, 230px);
  }

  .sidebar-brand > div {
    text-align: right;
  }

  .panel-navigation {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 12px;
  }

  .panel-navigation button {
    min-height: 48px;
    justify-content: center;
    padding: 0 8px;
    text-align: center;
  }

  .panel-navigation button > span {
    display: none;
  }

  .sidebar-note,
  .sidebar-logout {
    display: none;
  }

  .panel-main {
    padding: 0 18px 44px;
  }

  .panel-header {
    min-height: 96px;
  }

  .saved-status {
    display: none;
  }

  .panel-workspace {
    padding-top: 24px;
  }
}

@media (max-width: 640px) {
  .login-page {
    place-items: start center;
    padding: 18px 13px 72px;
  }

  .login-card {
    padding: 22px 20px 25px;
    border-radius: 19px;
  }

  .login-brand img {
    width: min(100%, 300px);
  }

  .panel-header {
    display: grid;
    padding: 17px 0;
  }

  .panel-header h1 {
    font-size: 28px;
  }

  .panel-header-actions,
  .panel-header-actions .primary-button {
    width: 100%;
  }

  .panel-navigation button {
    font-size: 10px;
  }

  .section-intro {
    margin-bottom: 15px;
  }

  .section-intro h2 {
    font-size: 23px;
  }

  .control-card {
    border-radius: 14px;
    padding: 18px;
  }

  .form-grid,
  .choice-grid,
  .motif-grid {
    grid-template-columns: 1fr;
  }

  .field-full {
    grid-column: auto;
  }

  .choice-card {
    min-height: 100px;
  }

  .image-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .image-row > img {
    width: 58px;
    height: 46px;
  }

  .image-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .preview-card {
    padding: 10px;
  }

  .preview-summary {
    margin-inline: 4px;
  }

  .segmented-control {
    grid-template-columns: 1fr;
  }

  .toast-region {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
