@font-face {
  font-family: "Chau Philomene One";
  src: url("/static/fonts/chau-philomene-one.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #f4eee4;
  --ink: #27170f;
  --card: #fffdf8;
  --primary: #713a1f;
  --primary-dark: #542b19;
  --border: #d9c6ad;
  --muted: #7b685c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 10% -5%, rgba(196, 126, 65, 0.17), transparent 30rem),
    var(--page);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

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

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid rgba(92, 50, 27, 0.16);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(18px);
}

.app-header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(1180px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  gap: 12px;
}

.app-header h1 {
  margin: 2px 0 0;
  font-size: 1.18rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.brand-kicker,
.eyebrow {
  margin: 0;
  color: #8d5837;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: linear-gradient(145deg, #824724, #4e2817);
  box-shadow: 0 8px 24px rgba(73, 36, 18, 0.2);
  color: #fff6e8;
  font-size: 1.25rem;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #e5c998;
  border-radius: 999px;
  background: #fff5dc;
  color: #805a17;
  font-size: 0.76rem;
  white-space: nowrap;
}

.connection-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d6992f;
  box-shadow: 0 0 0 4px rgba(214, 153, 47, 0.14);
}

.connection-pill.is-ready {
  border-color: #a8ccb0;
  background: #ecf8ee;
  color: #28603b;
}

.connection-pill.is-ready span {
  background: #2f8b4d;
  box-shadow: 0 0 0 4px rgba(47, 139, 77, 0.14);
}

.studio-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.88fr);
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
  gap: 28px;
  align-items: start;
}

.editor-panel,
.preview-panel {
  border: 1px solid rgba(91, 49, 25, 0.14);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 20px 60px rgba(73, 38, 20, 0.09);
}

.editor-panel {
  padding: clamp(20px, 3vw, 30px);
}

.preview-panel {
  position: sticky;
  top: 100px;
  padding: 22px;
}

.panel-heading,
.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2,
.preview-heading h2 {
  margin: 4px 0 0;
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.text-button {
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #795b4b;
  cursor: pointer;
}

.text-button:hover,
.text-button:focus-visible {
  background: #f5eadc;
}

.date-field {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 24px 0 18px;
  padding: 14px 16px;
  border: 1px solid #ddcbb4;
  border-radius: 15px;
  background: #fbf5ec;
  gap: 14px;
}

.date-field label {
  color: #5d4436;
  font-size: 0.9rem;
}

.date-field input {
  min-width: 150px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #cdb79d;
  border-radius: 10px;
  outline: none;
  background: #fffdf8;
  color: #352116;
  font-size: 1rem;
}

.date-field input:focus-visible,
.field-card textarea:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(152, 88, 47, 0.2);
  outline-offset: 2px;
}

.menu-fields {
  display: grid;
  gap: 13px;
}

.field-card {
  padding: 16px;
  border: 1px solid #e1d1bd;
  border-radius: 17px;
  background: #fffefa;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field-card:focus-within {
  border-color: #c2946c;
  box-shadow: 0 10px 30px rgba(108, 61, 32, 0.07);
}

.field-card__topline,
.field-card__switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.field-card__topline {
  margin-bottom: 8px;
}

.field-card__topline--compact {
  margin: 4px 0 5px;
}

.field-card__topline > span {
  color: #927b6d;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.field-card label {
  color: #422a1d;
  font-size: 0.95rem;
  font-weight: 750;
}

.field-card textarea {
  display: block;
  width: 100%;
  min-height: 76px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid #d8c5ae;
  border-radius: 12px;
  outline: none;
  background: #fffcf6;
  color: #2f1d13;
  font-size: 1rem;
  line-height: 1.42;
}

.field-card textarea::placeholder {
  color: #a38f82;
}

.field-card__switch p {
  margin: 5px 0 0;
  color: #8b7365;
  font-size: 0.8rem;
  line-height: 1.35;
}

.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 46px;
  height: 27px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d7c6b2;
  transition: background 160ms ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(48, 25, 13, 0.25);
  content: "";
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: #7a4124;
}

.switch input:checked + span::after {
  transform: translateX(19px);
}

.switch input:focus-visible + span {
  outline: 3px solid rgba(152, 88, 47, 0.2);
  outline-offset: 2px;
}

.autosave-note,
.export-hint,
.facebook-help {
  margin: 15px 2px 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.autosave-note span {
  color: #2f7a48;
  font-weight: 900;
}

.preview-heading {
  margin-bottom: 17px;
}

.preview-heading > span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #f0e3d2;
  color: #74503a;
  font-size: 0.74rem;
  font-weight: 750;
}

.poster-frame {
  position: relative;
  overflow: hidden;
  width: min(100%, 470px);
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  border: 1px solid #a97550;
  border-radius: 11px;
  background: #c47b37;
  box-shadow: 0 17px 35px rgba(62, 29, 12, 0.22);
}

.poster-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.poster-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-content: center;
  background: rgba(248, 231, 205, 0.94);
  color: #6c4228;
  font-size: 0.88rem;
  font-weight: 700;
}

.validation-note,
.feedback {
  margin-top: 15px;
  padding: 11px 12px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.4;
}

.validation-note,
.feedback--info {
  background: #fff5df;
  color: #785a1e;
}

.feedback--success {
  background: #edf8ef;
  color: #2d6c41;
}

.feedback--error {
  background: #fff0ed;
  color: #933c32;
}

.action-stack {
  display: grid;
  margin-top: 17px;
  gap: 10px;
}

.action-stack button,
.dialog-actions button {
  min-height: 50px;
  padding: 11px 16px;
  border-radius: 13px;
  font-size: 0.95rem;
  font-weight: 760;
  cursor: pointer;
}

.action-stack button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.primary-action {
  border: 0;
  background: linear-gradient(145deg, #7f4425, #5e2f1b);
  box-shadow: 0 10px 24px rgba(94, 47, 27, 0.2);
  color: #fffaf2;
}

.facebook-action {
  border: 1px solid #b8c6dd;
  background: #f7f9fe;
  color: #27518e;
}

.facebook-help {
  margin-top: 2px;
  color: #916e2a;
}

.export-hint {
  margin: 13px auto 0;
  text-align: center;
}

.publish-dialog {
  width: min(480px, calc(100% - 28px));
  padding: 24px;
  border: 1px solid #d9c6ad;
  border-radius: 20px;
  background: #fffdf8;
  box-shadow: 0 24px 80px rgba(41, 19, 7, 0.34);
  color: var(--ink);
}

.publish-dialog::backdrop {
  background: rgba(32, 16, 8, 0.52);
  backdrop-filter: blur(4px);
}

.publish-dialog h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.publish-dialog p {
  margin: 0;
  color: #6f5b50;
  line-height: 1.5;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 24px;
  gap: 10px;
}

.dialog-cancel {
  border: 1px solid #d9c6ad;
  background: #fff;
  color: #5a4032;
}

.dialog-confirm {
  border: 0;
  background: #315d9c;
  color: #fff;
}

footer {
  padding: 0 20px 28px;
  color: #8a7467;
  font-size: 0.75rem;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .studio-shell {
    grid-template-columns: 1fr;
    width: min(680px, calc(100% - 24px));
    padding-top: 18px;
    gap: 18px;
  }

  .preview-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .app-header__inner {
    width: calc(100% - 24px);
    min-height: 68px;
  }

  .brand-mark {
    width: 41px;
    height: 41px;
  }

  .app-header h1 {
    font-size: 1.03rem;
  }

  .brand-kicker {
    font-size: 0.66rem;
  }

  .connection-pill {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    overflow: hidden;
  }

  .connection-pill strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .editor-panel,
  .preview-panel {
    border-radius: 19px;
  }

  .editor-panel {
    padding: 19px 16px;
  }

  .preview-panel {
    padding: 18px 14px;
  }

  .date-field {
    align-items: stretch;
    flex-direction: column;
  }

  .date-field input {
    width: 100%;
  }

  .field-card {
    padding: 14px;
  }

  .poster-frame {
    width: 100%;
  }

  .action-stack button {
    font-size: 0.88rem;
  }
}

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