@font-face {
  font-family: "Everyday Sans";
  src: url("assets/EverydaySans-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --paper-scale: 18px;
  --paper-w: calc(24 * var(--paper-scale));
  --paper-h: calc(36 * var(--paper-scale));
  --blue: #0067b1;
  --blue-2: #0b74d1;
  --yellow: #ffc220;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d8e0ea;
  --bg: #eef3f8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Everyday Sans", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; border-radius: 12px; padding: 11px 14px; background: #e8eef5; color: var(--ink); font-weight: 700; }
button:hover { filter: brightness(.97); }
button:disabled, button.disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.35); }
.primary { background: linear-gradient(135deg, var(--blue), #0b5ed7); color: white; }
.secondary { background: linear-gradient(135deg, #6f42c1, #7c3aed); color: white; }
.danger { background: #dc2626; color: white; }

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  padding: 18px 24px;
  background: linear-gradient(135deg, #062b4f, var(--blue));
  color: white;
  box-shadow: 0 8px 28px rgba(0, 103, 177, .25);
}
.home-link { color: white; text-decoration: none; font-weight: 700; }
.eyebrow { color: var(--yellow); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.topbar h1 { margin: 2px 0 4px; font-size: clamp(26px, 3vw, 40px); line-height: 1; }
.topbar p { margin: 0; color: rgba(255,255,255,.88); }
.save-top { min-width: 180px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1500px;
  margin: 0 auto;
}
.controls { display: flex; flex-direction: column; gap: 16px; }
.panel, .preview-card, .sheet-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .08);
}
.panel { padding: 18px; }
.panel h2, .preview-card h2, .sheet-card h2 { margin: 0 0 12px; font-size: 20px; }
.print-note { border-color: rgba(255,194,32,.55); background: linear-gradient(180deg, #fffdf4, #fff); }
.print-note p { margin: 8px 0; line-height: 1.35; }
label { display: block; margin: 13px 0; font-size: 14px; font-weight: 800; color: #1f2937; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  margin-top: 7px;
  background: #fff;
}
input[type="color"] { height: 46px; padding: 5px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.35; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.large-action { width: 100%; padding: 14px 16px; font-size: 16px; }
.secondary-action { width: 100%; margin-top: 10px; }
.size-grid { display: grid; gap: 10px; }
.size-option { border: 2px solid var(--line); background: #f8fafc; text-align: left; padding: 14px; }
.size-option.active { border-color: var(--blue-2); background: #eaf4ff; box-shadow: 0 0 0 4px rgba(11, 116, 209, .1); }
.size-option strong { font-size: 16px; }
.size-option span { display: block; color: var(--muted); margin-top: 5px; font-size: 12px; line-height: 1.25; }

.preview-area { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.preview-card { padding: 20px; }
.card-heading, .sheet-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.card-heading p, .sheet-header p { margin: 0; color: var(--muted); }
.sheet-status { background: #eaf4ff; color: var(--blue); padding: 8px 12px; border-radius: 999px; font-weight: 900; white-space: nowrap; }
.preview-banner { position: relative; margin-top: 16px; transform-origin: top left; max-width: 100%; }
.sheet-card { padding: 20px; overflow: hidden; }
.sheet-stage { margin-top: 18px; overflow: auto; padding: 12px; background: #f8fafc; border-radius: 16px; border: 1px solid var(--line); }
.poster-sheet {
  position: relative;
  width: var(--paper-w);
  height: var(--paper-h);
  background: white;
  border: 1px solid #9aa4b2;
  box-shadow: 0 10px 30px rgba(0,0,0,.14);
  overflow: hidden;
  margin: 0 auto;
}
.poster-sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, rgba(0,0,0,.055) 1px, transparent 1px), linear-gradient(to bottom, rgba(0,0,0,.055) 1px, transparent 1px);
  background-size: var(--paper-scale) var(--paper-scale);
}

.banner { position: relative; overflow: hidden; background: linear-gradient(135deg, #222, #666); border: 1px dashed rgba(0,0,0,.35); }
.banner-content { position: absolute; top: 0; left: 0; overflow: hidden; transform-origin: top left; background: linear-gradient(135deg, #222, #666); }
.banner-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; display: none; }
.banner-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.25); }
.banner-text { position: absolute; inset: 0; color: white; text-align: center; text-shadow: 0 2px 9px rgba(0,0,0,.45); pointer-events: none; }
.banner-line { position: absolute; width: 90%; line-height: .92; max-width: 90%; overflow-wrap: anywhere; user-select: none; touch-action: none; pointer-events: auto; }
.banner-headline { font-size: 42px; letter-spacing: .035em; text-transform: uppercase; font-weight: 900; }
.banner-subhead { font-size: 18px; letter-spacing: .02em; font-weight: 800; }
.preview-banner .draggable-text { cursor: grab; border-radius: 8px; padding: 2px 6px; }
.preview-banner .draggable-text:hover, .preview-banner .draggable-text.dragging { outline: 2px dashed rgba(255,255,255,.75); background: rgba(0,103,177,.18); cursor: grabbing; }
.move-hint { margin-top: -6px; }
.sheet-banner { position: absolute; }
.banner-actions { position: absolute; z-index: 5; top: 6px; right: 6px; display: flex; gap: 6px; }
.banner-actions button { width: auto; padding: 5px 8px; border-radius: 7px; font-size: 11px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; padding: 18px; z-index: 50; }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(560px, 100%); background: white; border-radius: 22px; padding: 22px; box-shadow: 0 25px 80px rgba(0,0,0,.28); }
.modal-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.modal h2 { margin: 0 0 8px; }
.modal p { margin: 0; color: var(--muted); }
.icon-button { width: 38px; height: 38px; border-radius: 999px; font-size: 24px; line-height: 1; padding: 0; }
.template-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.prompt-chip { width: auto; padding: 8px 11px; border-radius: 999px; font-size: 13px; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; padding: 16px; }
  .topbar { grid-template-columns: 1fr; }
  .save-top { width: 100%; }
  .sheet-header { align-items: flex-start; flex-direction: column; }
}

/* Mobile-friendly sheet preview zoom: keep the full 24x36 sheet visible instead of forcing side-scroll. */
@media (max-width: 720px) {
  :root { --paper-scale: 11px; }
  .workspace { padding: 10px; gap: 14px; }
  .preview-area { gap: 14px; }
  .preview-card, .sheet-card, .panel { border-radius: 16px; }
  .sheet-card { padding: 14px; }
  .sheet-header { gap: 10px; }
  .sheet-header h2 { font-size: 22px; }
  .sheet-header p { font-size: 14px; line-height: 1.35; }
  .sheet-stage {
    padding: 10px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: rgba(255,255,255,.96);
  }
  .poster-sheet {
    width: calc(24 * var(--paper-scale));
    height: calc(36 * var(--paper-scale));
    flex: 0 0 auto;
    margin: 0 auto;
  }
  .poster-sheet::after {
    background-size: var(--paper-scale) var(--paper-scale);
  }
  #exportBtnMobile { width: 100%; }
}

@media (max-width: 390px) {
  :root { --paper-scale: 10px; }
}

@page { size: 24in 36in; margin: 0; }
@media print {
  :root { --paper-scale: 1in; }
  html, body { width: 24in; height: 36in; margin: 0; background: white; }
  .no-print { display: none !important; }
  .workspace, .preview-area, .sheet-card, .sheet-stage { display: block; padding: 0; margin: 0; overflow: visible; box-shadow: none; border: 0; }
  .poster-sheet { width: 24in; height: 36in; border: 0; box-shadow: none; }
  .poster-sheet::after { display: none; }
  .sheet-banner { border: .01in dashed rgba(0,0,0,.45); }
}
