@font-face {
  font-family: "DPS Didactic";
  src: url("../fonts/Didactic-Regular.woff2") format("woff2"), url("../fonts/Didactic-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --dps-ink: #132b45;
  --dps-muted: #62686f;
  --dps-brand: #132b45;
  --dps-brand-dark: #0b1e32;
  --dps-accent: #e09a3a;
  --dps-ivory: #faf6f1;
  --dps-surface: #ffffff;
  --dps-soft: #faf6f1;
  --dps-line: #ddd7d0;
  --dps-danger: #b42318;
  --dps-quality-good: #0b9b77;
  --dps-quality-warning: #d98b00;
  --dps-quality-poor: #dc2626;
}

.dps-entry { margin: 16px 0; }
.dps-open-studio { width: 100%; min-height: 48px; border-color: var(--dps-brand) !important; background: var(--dps-brand) !important; color: #fff !important; font-family: Montserrat, Arial, sans-serif; font-weight: 650 !important; }
.dps-open-studio[hidden], .dps-edit-design[hidden] { display: none !important; }
.dps-inline-preview { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--dps-line); border-radius: 12px; background: var(--dps-soft); }
.dps-inline-preview[hidden] { display: none; }
.dps-inline-preview img { width: 82px; height: 82px; border-radius: 8px; object-fit: contain; background: #fff; }
.dps-edit-design, .dps-center-photo, .dps-center-text { border: 0; background: transparent; color: var(--dps-brand); text-decoration: underline; cursor: pointer; }
.dps-photo-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dps-remove-photo { min-height: 38px; padding: 4px 9px; border: 1px solid #efb3ae; border-radius: 8px; background: #fff5f4; color: var(--dps-danger); font-weight: 700; cursor: pointer; }
.dps-remove-photo[hidden] { display: none; }

body.dps-modal-open { overflow: hidden !important; }
.dps-modal { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(10, 18, 17, .72); backdrop-filter: blur(5px); }
.dps-modal[hidden] { display: none; }
.dps-dialog { width: min(1120px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; border-radius: 20px; background: var(--dps-surface); box-shadow: 0 24px 80px rgba(0, 0, 0, .3); color: var(--dps-ink); font-family: Montserrat, Arial, sans-serif; }
.dps-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--dps-line); }
.dps-header h2 { margin: 2px 0 0; color: var(--dps-ink); font-family: "DM Serif Display", Georgia, serif; font-size: clamp(24px, 3vw, 34px); font-weight: 400; }
.dps-eyebrow { color: var(--dps-brand); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.dps-close { width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--dps-line); border-radius: 50%; background: #fff; color: var(--dps-ink); font-size: 30px; line-height: 1; cursor: pointer; }
.dps-body { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); overflow-y: auto; overflow-x: hidden; }
.dps-stage-wrap { display: flex; flex-direction: column; justify-content: center; padding: 26px; background: #f1eee9; }
.dps-area-tabs { width: min(100%, 680px); display: flex; gap: 8px; margin: 0 auto 12px; overflow-x: auto; scrollbar-width: thin; }
.dps-area-tab { min-width: 88px; min-height: 44px; flex: 1 0 auto; padding: 8px 16px; border: 1px solid #b9c8c5; border-radius: 999px; background: #fff; color: var(--dps-ink); font-weight: 750; cursor: pointer; }
.dps-area-tab.is-active, .dps-area-tab[aria-selected="true"] { border-color: var(--dps-brand); background: var(--dps-brand); color: #fff; }
.dps-stage-toolbar { width: min(100%, 680px); display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 auto 10px; }
.dps-guide-note { margin: 0; color: #4d5865; font-size: 12px; line-height: 1.35; }
.dps-guide-note span { color: #16815f; font-weight: 900; }
.dps-toggle-guides { min-height: 38px; flex: 0 0 auto; padding: 6px 12px; border: 1px solid #aeb9c4; border-radius: 999px; background: #fff; color: var(--dps-brand); font: 650 12px/1.2 Montserrat, Arial, sans-serif; cursor: pointer; }
.dps-toggle-guides:hover, .dps-toggle-guides:focus-visible { border-color: var(--dps-brand); outline: 3px solid rgba(19, 43, 69, .16); }
.dps-stage { position: relative; width: min(100%, 680px); margin: auto; overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 8px 32px rgba(20, 55, 50, .12); }
.dps-canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: move; }
.dps-quality-badge { position: absolute; z-index: 3; top: 12px; right: 12px; display: grid; grid-template-columns: auto auto; align-items: center; gap: 0 6px; max-width: calc(100% - 24px); padding: 7px 11px; border-radius: 999px; color: #fff; box-shadow: 0 5px 18px rgba(0, 0, 0, .18); font-size: 12px; line-height: 1.15; pointer-events: none; }
.dps-quality-badge[hidden] { display: none; }
.dps-quality-badge.is-good { background: var(--dps-quality-good); }
.dps-quality-badge.is-warning { background: var(--dps-quality-warning); }
.dps-quality-badge.is-poor { background: var(--dps-quality-poor); }
.dps-quality-icon { grid-row: 1 / span 2; display: grid; place-items: center; width: 19px; height: 19px; border: 2px solid currentColor; border-radius: 50%; font-size: 12px; font-weight: 900; }
.dps-quality-value { font-size: 13px; font-weight: 850; letter-spacing: .02em; text-transform: uppercase; }
.dps-quality-label { max-width: 190px; overflow: hidden; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; opacity: .92; }
.dps-quality { width: min(100%, 680px); margin: 12px auto 0; padding: 9px 12px; border: 1px solid #f2c76d; border-radius: 8px; background: #fff8e8; color: #6c4a00; font-size: 13px; line-height: 1.4; }
.dps-quality.is-poor { border-color: #f3aaa5; background: #fff1f0; color: #8f1d14; }
.dps-controls { padding: 22px; overflow: visible; background: #fff; }
.dps-control-section { padding: 0 0 22px; margin: 0 0 22px; border-bottom: 1px solid var(--dps-line); }
.dps-control-section h3 { margin: 0 0 16px; color: var(--dps-ink); font-size: 17px; }
.dps-control-section label { display: grid; gap: 7px; margin: 0 0 14px; color: var(--dps-ink); font-size: 13px; font-weight: 650; }
.dps-control-section input[type="text"], .dps-control-section select { width: 100%; min-height: 44px; margin: 0; border: 1px solid #c8d3d0; border-radius: 9px; background: #fff; }
.dps-control-section input:focus-visible, .dps-control-section select:focus-visible { border-color: var(--dps-brand); outline: 3px solid rgba(19, 43, 69, .16); }
.dps-text-counter { justify-self: end; color: var(--dps-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dps-text-counter.is-limit { color: var(--dps-danger); font-weight: 800; }
.dps-control-section input[type="color"] { width: 100%; height: 44px; padding: 4px; border: 1px solid #c8d3d0; border-radius: 9px; }
.dps-control-grid { display: grid; grid-template-columns: 1fr 90px; gap: 12px; }
.dps-font-preview { min-height: 26px; padding: 5px 8px; overflow: hidden; border-radius: 6px; background: var(--dps-ivory); color: var(--dps-ink); font-size: 16px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.dps-color-palette { display: grid; grid-template-columns: repeat(7, minmax(26px, 1fr)); gap: 7px; margin: -2px 0 16px; }
.dps-color-palette[hidden] { display: none; }
.dps-color-palette[data-expanded="false"] .dps-color-swatch:not(.is-recommended) { display: none; }
.dps-color-swatch { width: 100%; aspect-ratio: 1; min-height: 30px; padding: 0; border: 1px solid rgba(23, 33, 31, .2); border-radius: 6px; background: var(--dps-swatch); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); cursor: pointer; }
.dps-color-swatch:hover, .dps-color-swatch:focus-visible { outline: 3px solid rgba(27, 99, 92, .28); outline-offset: 1px; transform: translateY(-1px); }
.dps-color-swatch.is-active { outline: 3px solid var(--dps-brand); outline-offset: 1px; }
.dps-toggle-colors { min-height: 38px; margin: -5px 0 12px; padding: 4px 0; border: 0; background: transparent; color: var(--dps-brand); font: 650 13px/1.3 Montserrat, Arial, sans-serif; text-decoration: underline; cursor: pointer; }
.dps-toggle-colors[hidden] { display: none; }
.dps-upload { display: flex !important; align-items: center; justify-content: center; min-height: 48px; padding: 10px; border: 1.5px dashed var(--dps-brand); border-radius: 10px; background: #eef7f5; color: var(--dps-brand) !important; cursor: pointer; }
.dps-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dps-history-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 16px; }
.dps-history-actions button { min-height: 42px; padding: 7px 10px; border: 1px solid #c7d0d8; border-radius: 8px; background: #fff; color: var(--dps-brand); font: 650 12px/1.2 Montserrat, Arial, sans-serif; cursor: pointer; }
.dps-history-actions .dps-reset { grid-column: 1 / -1; border-color: #d9b77f; background: #fff9f0; }
.dps-history-actions button:disabled { opacity: .42; cursor: not-allowed; }
.dps-help { margin: 0; color: var(--dps-muted); font-size: 13px; line-height: 1.5; }
.dps-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--dps-line); background: #fff; }
.dps-status { margin-right: auto; color: var(--dps-brand); font-size: 13px; }
.dps-status.is-error { color: var(--dps-danger); }
.dps-cancel { min-height: 44px; padding: 0 18px; border: 1px solid #b9c2ca; border-radius: 9px; background: #fff; color: var(--dps-brand); font: 650 13px/1.2 Montserrat, Arial, sans-serif; cursor: pointer; }
.dps-validate { min-height: 44px; padding-inline: 22px !important; border-color: var(--dps-accent) !important; background: var(--dps-accent) !important; color: var(--dps-brand) !important; font-family: Montserrat, Arial, sans-serif !important; font-weight: 650 !important; }
.dps-cancel:focus-visible, .dps-validate:focus-visible { outline: 3px solid rgba(19, 43, 69, .22); outline-offset: 2px; }
.dps-validate:disabled { opacity: .65; cursor: wait; }
.dps-cart-preview { object-fit: contain !important; }

@media (max-width: 760px) {
  .dps-modal { align-items: stretch; padding: 0; }
  .dps-dialog { width: 100%; max-height: 100dvh; min-height: 100dvh; border-radius: 0; }
  .dps-header { padding: 13px 15px; }
  .dps-body { display: block; overflow-y: auto; }
  .dps-stage-wrap { position: sticky; top: 0; z-index: 2; padding: 10px; }
  .dps-area-tabs { width: 100%; margin-bottom: 8px; }
  .dps-area-tab { min-height: 44px; }
  .dps-stage-toolbar { width: min(100%, 46dvh, 410px); }
  .dps-guide-note { max-width: 56%; font-size: 10px; }
  .dps-toggle-guides { min-height: 34px; padding: 5px 9px; font-size: 11px; }
  .dps-stage { width: min(100%, 46dvh, 410px); }
  .dps-quality-badge { top: 8px; right: 8px; max-width: calc(100% - 16px); padding: 6px 9px; gap: 0 5px; }
  .dps-quality-icon { width: 17px; height: 17px; font-size: 10px; }
  .dps-quality-value { font-size: 12px; }
  .dps-quality-label { display: none; }
  .dps-quality { margin-top: 8px; padding: 7px 9px; font-size: 11px; }
  .dps-photo-actions { align-items: stretch; }
  .dps-center-photo, .dps-remove-photo { min-height: 44px; }
  .dps-controls { padding: 18px 16px; overflow: visible; }
  .dps-footer { position: sticky; bottom: 0; z-index: 4; padding: 11px 12px calc(11px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 25px rgba(20, 40, 36, .1); }
  .dps-status { position: absolute; left: 12px; right: 12px; bottom: 100%; padding: 7px; background: #fff; text-align: center; }
  .dps-cancel { display: none; }
  .dps-validate { width: 100%; }
}
