:root {
  --ink: #171610;
  --panel: #0d0e0a;
  --panel-2: #17180f;
  --panel-3: #222316;
  --paper: #efecdf;
  --field: #f7f1df;
  --field-2: #e6deca;
  --muted: #bbb19a;
  --soft: rgba(255, 248, 226, 0.72);
  --accent: #df3450;
  --accent-2: #20a88f;
  --accent-3: #f0c637;
  --line: rgba(255, 248, 226, 0.14);
  --editor-w: clamp(352px, 25vw, 430px);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(223, 52, 80, 0.18), transparent 30%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 22px),
    #181914;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  color: #fff8e8;
  background: var(--panel-3);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.app {
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--editor-w) minmax(0, 1fr);
  overflow: hidden;
}

.editor {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 248, 226, 0.07), transparent 210px),
    linear-gradient(90deg, rgba(223, 52, 80, 0.13), transparent 52%),
    var(--panel);
  color: #fff8e8;
  border-right: 1px solid rgba(255, 248, 226, 0.13);
  overflow: hidden;
}

.brand {
  display: block;
}

.editor h1 {
  margin: 0;
  color: #fff8e8;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(32px, 4.3vh, 46px);
  line-height: 0.92;
  font-weight: 900;
  text-transform: uppercase;
}

.editor .lead {
  margin: 7px 0 0;
  max-width: 30ch;
  color: var(--muted);
  font-size: clamp(13px, 1.6vh, 15px);
  line-height: 1.28;
}

.metric strong {
  display: block;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 20px;
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.tab-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255, 248, 226, 0.16);
  border-radius: 8px;
  background: rgba(255, 248, 226, 0.055);
}

.tab-button {
  min-height: 38px;
  padding: 0 5px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.tab-button.is-active {
  color: #fff8e8;
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(223, 52, 80, 0.22);
}

.panel-pages {
  min-height: 0;
  overflow: hidden;
}

.panel-page {
  display: none;
  height: 100%;
  min-height: 0;
}

.panel-page.is-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  color: #fff8e8;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 22px;
  line-height: 1;
  text-transform: uppercase;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.panel-body {
  min-height: 0;
  display: grid;
  gap: 12px;
  align-content: start;
  overflow: hidden;
}

.panel-page[data-panel="design"] .panel-body {
  align-content: stretch;
}

label {
  display: block;
  margin: 0 0 6px;
  color: #f1ead8;
  font-size: 13px;
  font-weight: 700;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid rgba(24, 23, 19, 0.72);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  box-shadow: inset 0 2px 0 rgba(24, 23, 19, 0.08);
  outline: none;
}

input[type="text"] {
  height: 40px;
  padding: 0 11px;
}

textarea {
  resize: none;
  padding: 10px 11px;
  line-height: 1.3;
}

textarea.title-field {
  min-height: 0;
  height: clamp(78px, 13dvh, 120px);
}

textarea.description-field {
  min-height: 0;
  height: clamp(130px, 24dvh, 230px);
}

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

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

.theme-grid {
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: start;
  padding-right: 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 248, 226, 0.34) rgba(255, 248, 226, 0.06);
  scrollbar-width: thin;
}

.theme-grid::-webkit-scrollbar {
  width: 8px;
}

.theme-grid::-webkit-scrollbar-track {
  background: rgba(255, 248, 226, 0.055);
}

.theme-grid::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(255, 248, 226, 0.26);
}

.theme-card {
  min-height: clamp(55px, 8dvh, 74px);
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(255, 248, 226, 0.13);
  background: rgba(255, 248, 226, 0.055);
  text-align: left;
}

.theme-card.is-active {
  border-color: rgba(255, 248, 226, 0.56);
  background: rgba(223, 52, 80, 0.22);
}

.theme-swatch {
  display: block;
  width: 16px;
  height: 100%;
  min-height: 36px;
  border-radius: 5px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.24);
}

.theme-card strong {
  display: block;
  color: #fff8e8;
  font-size: 13px;
  line-height: 1.05;
}

.theme-card > span:not(.theme-swatch) {
  display: block;
  min-width: 0;
}

.theme-card > span:not(.theme-swatch) > span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.drop-zone {
  min-height: clamp(88px, 15dvh, 126px);
  min-width: 0;
  max-width: 100%;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px dashed rgba(255, 248, 226, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(32, 168, 143, 0.13), transparent 52%),
    rgba(255, 248, 226, 0.055);
  color: #fff8e8;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
}

.drop-zone.is-over {
  border-color: var(--accent-2);
  background: rgba(32, 168, 143, 0.16);
}

.drop-zone strong {
  display: block;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 22px;
  line-height: 1;
  text-transform: uppercase;
}

.drop-zone > span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.drop-zone > span > span {
  display: block;
  max-width: 100%;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-card,
.text-tools,
.metrics,
.export-box {
  border: 1px solid rgba(255, 248, 226, 0.13);
  border-radius: 8px;
  background: rgba(255, 248, 226, 0.055);
}

.range-card {
  display: grid;
  gap: 6px;
  padding: 10px 11px;
}

.range-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.range-head output {
  color: #fff8e8;
  font-variant-numeric: tabular-nums;
}

.tune-body {
  gap: 6px;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
}

.tune-body .range-card {
  gap: 2px;
  padding: 6px 8px;
}

.tune-body input[type="range"] {
  display: block;
  height: 16px;
  margin: 0;
}

.tune-choice-panel {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 248, 226, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(223, 52, 80, 0.09), transparent 58%),
    rgba(255, 248, 226, 0.055);
}

.choice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.choice-head output {
  min-width: 0;
  color: #fff8e8;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.look-grid,
.noise-grid {
  display: grid;
  gap: 5px;
}

.look-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.noise-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.filter-sections {
  min-height: 0;
  max-height: clamp(160px, 28dvh, 270px);
  display: grid;
  gap: 6px;
  padding-right: 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 248, 226, 0.34) rgba(255, 248, 226, 0.06);
  scrollbar-width: thin;
}

.filter-sections::-webkit-scrollbar {
  width: 8px;
}

.filter-sections::-webkit-scrollbar-track {
  background: rgba(255, 248, 226, 0.055);
}

.filter-sections::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(255, 248, 226, 0.26);
}

.filter-section {
  min-width: 0;
  border: 1px solid rgba(255, 248, 226, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(32, 168, 143, 0.07), transparent 52%),
    rgba(8, 10, 8, 0.2);
  overflow: hidden;
}

.filter-section > summary {
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  padding: 0 7px;
  color: #fff8e8;
  cursor: pointer;
  list-style: none;
}

.filter-section > summary::-webkit-details-marker {
  display: none;
}

.filter-section > summary::after {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  content: "+";
}

.filter-section[open] > summary::after {
  content: "-";
}

.filter-section > summary span {
  min-width: 0;
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-section > summary small {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-section .look-grid {
  padding: 0 5px 6px;
}

.filter-section:not([open]) .look-grid {
  display: none;
}

.look-chip {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 28px;
  padding: 0 6px;
  border: 1px solid rgba(255, 248, 226, 0.16);
  border-radius: 6px;
  background: rgba(255, 248, 226, 0.08);
  color: #fff8e8;
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.look-chip::before,
.look-chip::after {
  position: absolute;
  inset: 0;
  content: "";
  z-index: -1;
}

.look-chip::before {
  background: var(--look);
  opacity: 0.76;
}

.look-chip::after {
  background:
    linear-gradient(90deg, rgba(13, 14, 10, 0.5), rgba(13, 14, 10, 0.08)),
    rgba(13, 14, 10, 0.18);
}

.look-chip.is-active {
  border-color: rgba(255, 248, 226, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(13, 14, 10, 0.5),
    0 8px 18px rgba(223, 52, 80, 0.18);
}

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

.pro-panel {
  min-width: 0;
  min-height: 0;
  align-self: start;
  border: 1px solid rgba(255, 248, 226, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(32, 168, 143, 0.09), transparent 54%),
    rgba(255, 248, 226, 0.05);
  overflow: hidden;
}

.pro-panel[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-self: stretch;
}

.pro-panel > summary {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  color: #fff8e8;
  cursor: pointer;
  list-style: none;
}

.pro-panel > summary::-webkit-details-marker {
  display: none;
}

.pro-panel > summary::after {
  justify-self: end;
  color: var(--accent-2);
  font-size: 15px;
  font-weight: 900;
  content: "+";
}

.pro-panel[open] > summary::after {
  content: "-";
}

.pro-panel > summary strong {
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 20px;
  line-height: 1;
}

.pro-panel > summary span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pro-content {
  min-height: 0;
  max-height: clamp(220px, 32dvh, 340px);
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 0 7px 7px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 248, 226, 0.34) rgba(255, 248, 226, 0.06);
  scrollbar-width: thin;
}

.pro-content:focus-visible {
  outline: 1px solid rgba(255, 248, 226, 0.38);
  outline-offset: -3px;
}

.pro-content::-webkit-scrollbar {
  width: 8px;
}

.pro-content::-webkit-scrollbar-track {
  background: rgba(255, 248, 226, 0.055);
}

.pro-content::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(255, 248, 226, 0.26);
}

.pro-panel:not([open]) > .pro-content {
  display: none;
}

.pro-group {
  min-width: 0;
  border: 1px solid rgba(255, 248, 226, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(223, 52, 80, 0.07), transparent 46%),
    rgba(10, 12, 9, 0.22);
  overflow: hidden;
}

.pro-group > summary {
  min-height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  color: #fff8e8;
  cursor: pointer;
  list-style: none;
}

.pro-group > summary::-webkit-details-marker {
  display: none;
}

.pro-group > summary::after {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 900;
  content: "+";
}

.pro-group[open] > summary::after {
  content: "-";
}

.pro-group-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.pro-group-title span {
  min-width: 0;
  color: #fff8e8;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pro-group-title small {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pro-group-body {
  display: grid;
  gap: 6px;
  padding: 0 6px 6px;
}

.pro-group:not([open]) .pro-group-body {
  display: none;
}

.noise-amount-card {
  min-height: 44px;
}

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

.switch-card {
  min-height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  border: 1px solid rgba(255, 248, 226, 0.13);
  border-radius: 8px;
  background: rgba(255, 248, 226, 0.055);
  color: #f1ead8;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.switch-card input {
  width: 30px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  appearance: none;
  border: 1px solid rgba(255, 248, 226, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--muted) 0 12px, transparent 12px),
    rgba(0, 0, 0, 0.22);
  background-size: 10px 10px, auto;
  background-position: 3px center, 0 0;
  background-repeat: no-repeat;
  cursor: pointer;
}

.switch-card input:checked {
  border-color: rgba(32, 168, 143, 0.65);
  background:
    linear-gradient(90deg, #fff8e8 0 12px, transparent 12px),
    rgba(32, 168, 143, 0.72);
  background-size: 10px 10px, auto;
  background-position: 15px center, 0 0;
  background-repeat: no-repeat;
}

.wide-action {
  min-height: 38px;
  width: 100%;
  color: #fff8e8;
  background: rgba(255, 248, 226, 0.09);
  font-size: 12px;
  font-weight: 700;
}

.wide-action:hover {
  background: rgba(223, 52, 80, 0.2);
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quick-row button,
.text-tools button {
  min-height: 36px;
  padding: 0 9px;
  color: #fff8e8;
  background: rgba(255, 248, 226, 0.09);
  font-size: 12px;
  font-weight: 700;
}

.quick-row button:hover,
.text-tools button:hover {
  background: rgba(32, 168, 143, 0.22);
}

.text-form {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  gap: 10px;
  overflow: hidden;
}

.field-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.field-head span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.title-year-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
}

.text-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.metric {
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 8px;
  background: rgba(0, 0, 0, 0.12);
  text-align: center;
}

.export-box {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.export-line {
  display: flex;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.export-line strong {
  min-width: 0;
  color: #fff8e8;
  font-weight: 700;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.actions button,
.footer-actions button {
  min-height: 42px;
}

.primary {
  background: var(--accent);
}

.primary:hover {
  background: #b9283e;
}

.footer-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.mobile-screen-switch {
  display: none;
}

.preview {
  min-width: 0;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  place-items: center;
  gap: 10px;
  padding: 16px 22px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #20221b;
  background-size: 36px 36px;
}

.preview-toolbar,
.canvas-caption {
  width: min(100%, calc((100dvh - 122px) * 0.75), 760px);
}

.preview-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  overflow: hidden;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.status-pill {
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 248, 226, 0.14);
  border-radius: 8px;
  background: rgba(13, 14, 10, 0.78);
  color: #fff8e8;
  font-size: 12px;
  white-space: nowrap;
}

.status-pill span {
  color: var(--muted);
}

.status-pill strong {
  display: block;
  min-width: 0;
  max-width: min(34ch, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-inner {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  width: min(100%, calc((100dvh - 122px) * 0.75), 760px);
}

canvas {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 122px);
  aspect-ratio: 3 / 4;
  height: auto;
  background: var(--paper);
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.48),
    0 2px 0 rgba(255, 255, 255, 0.22) inset;
  cursor: grab;
  touch-action: none;
}

canvas.dragging {
  cursor: grabbing;
}

.inline-editor-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.inline-field {
  position: absolute;
  display: block;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: transparent;
  caret-color: var(--accent);
  outline: none;
  pointer-events: auto;
  resize: none;
  overflow: hidden;
  box-shadow: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.inline-editor-layer input.inline-field[type="text"] {
  width: auto;
  height: auto;
  min-height: 0;
  padding: 7px 9px;
  border: 1px solid transparent;
  background: transparent;
  color: transparent;
  outline: none;
  box-shadow: none;
}

.inline-editor-layer input.inline-field[type="text"]:hover {
  border-color: rgba(223, 52, 80, 0.5);
  background: rgba(255, 248, 226, 0.08);
}

.inline-editor-layer input.inline-field[type="text"]:focus {
  z-index: 4;
  border-color: var(--accent);
  background: rgba(247, 241, 223, 0.94);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.inline-field:hover {
  border-color: rgba(223, 52, 80, 0.5);
  background: rgba(255, 248, 226, 0.08);
}

.inline-field:focus {
  z-index: 4;
  border-color: var(--accent);
  background: rgba(247, 241, 223, 0.94);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.inline-field-title {
  left: 7.6%;
  top: 56.8%;
  right: 22%;
  height: 17.8%;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(18px, calc(58px * var(--canvas-scale, 0.6)), 44px);
  line-height: 1.03;
  font-weight: 900;
}

.inline-editor-layer .inline-field-year {
  top: 57.2%;
  right: 7.4%;
  width: 16.8%;
  height: 6.4%;
  min-width: 58px;
  text-align: right;
  font-size: clamp(13px, calc(34px * var(--canvas-scale, 0.6)), 26px);
  font-weight: 900;
}

.inline-editor-layer input.inline-field-year[type="text"] {
  width: 16.8%;
  height: 6.4%;
}

.inline-editor-layer input.inline-field-year[type="text"]:focus {
  width: min(16.8%, 118px);
  height: 6.4%;
}

.preview-inner[data-theme="series"] .inline-field-title {
  right: 30%;
}

.preview-inner[data-theme="newspaper"] .inline-field-title {
  right: 30%;
}

.preview-inner[data-theme="series"] .inline-editor-layer .inline-field-year {
  top: 62.7%;
  right: 9.3%;
  width: 19.1%;
  height: 5%;
  min-width: 64px;
  text-align: center;
  transform: rotate(-8deg);
}

.preview-inner[data-theme="series"] .inline-editor-layer input.inline-field-year[type="text"],
.preview-inner[data-theme="series"] .inline-editor-layer input.inline-field-year[type="text"]:focus {
  width: 19.1%;
  height: 5%;
}

.preview-inner[data-theme="newspaper"] .inline-editor-layer .inline-field-year {
  top: 64.7%;
  right: 10.2%;
  width: 19.8%;
  height: 4.7%;
  min-width: 64px;
  text-align: center;
}

.preview-inner[data-theme="newspaper"] .inline-editor-layer input.inline-field-year[type="text"],
.preview-inner[data-theme="newspaper"] .inline-editor-layer input.inline-field-year[type="text"]:focus {
  width: 19.8%;
  height: 4.7%;
}

.inline-field-description {
  left: 7.6%;
  right: 7.6%;
  top: 71.2%;
  height: 20.8%;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(12px, calc(26px * var(--canvas-scale, 0.6)), 20px);
  line-height: 1.35;
  font-weight: 900;
}

.canvas-caption {
  margin: 0;
  color: #d8d0bd;
  font-size: 13px;
  line-height: 1.25;
}

@media (max-height: 820px) {
  .editor {
    gap: 8px;
    padding: 10px;
  }

  .editor .lead {
    display: none;
  }

  .tab-button {
    min-height: 32px;
    font-size: 12px;
    padding: 0 3px;
  }

  .panel-heading {
    min-height: 24px;
    padding-bottom: 5px;
  }

  .panel-heading h2 {
    font-size: 18px;
  }

  .theme-card {
    min-height: 48px;
    padding: 7px;
  }

  .drop-zone {
    min-height: 72px;
  }

  .range-card {
    padding: 7px 9px;
  }

  .tune-body {
    gap: 5px;
  }

  .tune-body .range-card {
    padding: 4px 7px;
  }

  .tune-choice-panel {
    padding: 5px;
  }

  .pro-panel > summary {
    min-height: 34px;
    padding: 0 8px;
  }

  .pro-panel > summary strong {
    font-size: 17px;
  }

  .pro-panel > summary span {
    font-size: 11px;
  }

  .pro-content {
    max-height: clamp(170px, 30dvh, 250px);
    gap: 4px;
    padding: 0 5px 5px;
  }

  .pro-group > summary {
    min-height: 32px;
    padding: 0 7px;
  }

  .pro-group-body {
    gap: 4px;
    padding: 0 5px 5px;
  }

  .choice-head {
    margin-bottom: 4px;
    font-size: 11px;
  }

  .filter-sections {
    max-height: clamp(130px, 26dvh, 205px);
    gap: 4px;
  }

  .filter-section > summary {
    min-height: 26px;
    padding: 0 6px;
  }

  .filter-section .look-grid {
    padding: 0 4px 5px;
  }

  .look-grid,
  .noise-grid,
  .tune-range-grid,
  .switch-grid {
    gap: 4px;
  }

  .tune-range-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .look-chip {
    min-height: 24px;
    padding: 0 4px;
    font-size: 10px;
  }

  .switch-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .switch-card,
  .wide-action {
    min-height: 30px;
  }

  .switch-card {
    gap: 3px;
    padding: 4px 3px;
    font-size: 10px;
  }

  textarea.title-field {
    height: 72px;
  }

  textarea.description-field {
    height: 118px;
  }
}

@media (max-width: 900px) {
  :root {
    --editor-w: 100vw;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 47dvh) minmax(0, 53dvh);
  }

  .editor {
    height: 47dvh;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 248, 226, 0.13);
  }

  .preview {
    height: 53dvh;
    padding: 10px;
  }

  .preview-toolbar,
  .preview-inner,
  .canvas-caption {
    width: min(100%, calc((53dvh - 88px) * 0.75), 420px);
  }

  canvas {
    max-height: calc(53dvh - 88px);
  }

  .app[data-active-tab="tune"] {
    grid-template-rows: minmax(0, 74dvh) minmax(0, 26dvh);
  }

  .app[data-active-tab="tune"] .editor {
    height: 74dvh;
    gap: 8px;
    padding: 10px;
  }

  .app[data-active-tab="tune"] .editor .lead {
    display: none;
  }

  .app[data-active-tab="tune"] .preview {
    height: 26dvh;
    padding: 8px;
  }

  .app[data-active-tab="tune"] .preview-toolbar,
  .app[data-active-tab="tune"] .preview-inner,
  .app[data-active-tab="tune"] .canvas-caption {
    width: min(100%, calc((26dvh - 66px) * 0.75), 300px);
  }

  .app[data-active-tab="tune"] canvas {
    max-height: calc(26dvh - 66px);
  }

  .app[data-active-tab="tune"] .tune-body {
    gap: 4px;
  }

  .app[data-active-tab="tune"] .tune-choice-panel {
    padding: 5px;
  }

  .app[data-active-tab="tune"] .pro-panel > summary {
    min-height: 34px;
    padding: 0 8px;
  }

  .app[data-active-tab="tune"] .pro-content {
    max-height: clamp(160px, 26dvh, 220px);
    gap: 4px;
    padding: 0 5px 5px;
  }

  .app[data-active-tab="tune"] .pro-group > summary {
    min-height: 32px;
    padding: 0 7px;
  }

  .app[data-active-tab="tune"] .pro-group-body {
    gap: 4px;
    padding: 0 5px 5px;
  }

  .app[data-active-tab="tune"] .choice-head {
    margin-bottom: 4px;
    font-size: 11px;
  }

  .app[data-active-tab="tune"] .filter-sections {
    max-height: clamp(120px, 22dvh, 170px);
    gap: 4px;
  }

  .app[data-active-tab="tune"] .filter-section > summary {
    min-height: 26px;
    padding: 0 6px;
  }

  .app[data-active-tab="tune"] .filter-section .look-grid {
    padding: 0 4px 5px;
  }

  .app[data-active-tab="tune"] .look-grid,
  .app[data-active-tab="tune"] .noise-grid,
  .app[data-active-tab="tune"] .switch-grid {
    gap: 4px;
  }

  .app[data-active-tab="tune"] .tune-range-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .app[data-active-tab="tune"] .tune-body .range-card {
    padding: 4px;
  }

  .app[data-active-tab="tune"] .range-head {
    gap: 3px;
    font-size: 10px;
  }

  .app[data-active-tab="tune"] .look-chip {
    min-height: 23px;
    padding: 0 3px;
    font-size: 10px;
  }

  .app[data-active-tab="tune"] .switch-card,
  .app[data-active-tab="tune"] .wide-action {
    min-height: 30px;
  }

  .app[data-active-tab="tune"] .switch-card {
    gap: 3px;
    padding: 4px 3px;
    font-size: 10px;
  }
}

@media (max-width: 768px) {
  .app,
  .app[data-active-tab="tune"] {
    position: relative;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    touch-action: pan-y;
  }

  .editor,
  .preview,
  .app[data-active-tab="tune"] .editor,
  .app[data-active-tab="tune"] .preview {
    grid-area: 1 / 1;
    width: 100%;
    height: 100dvh;
    transition: transform 220ms ease, opacity 160ms ease, visibility 160ms ease;
  }

  .editor,
  .app[data-active-tab="tune"] .editor {
    gap: 8px;
    padding: 12px 14px 70px;
    border-right: 0;
    border-bottom: 0;
  }

  .preview,
  .app[data-active-tab="tune"] .preview {
    gap: 8px;
    padding: 12px 14px 70px;
  }

  .app[data-mobile-view="editor"] .editor,
  .app[data-mobile-view="preview"] .preview {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .app[data-mobile-view="editor"] .preview {
    transform: translateX(12%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .app[data-mobile-view="preview"] .editor {
    transform: translateX(-12%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .editor .lead,
  .app[data-active-tab="tune"] .editor .lead {
    display: none;
  }

  .editor h1 {
    font-size: 30px;
  }

  .tab-strip {
    gap: 4px;
    padding: 3px;
  }

  .tab-button {
    min-height: 34px;
    padding: 0 3px;
    font-size: 12px;
  }

  .panel-page.is-active {
    gap: 8px;
  }

  .panel-heading {
    min-height: 26px;
    padding-bottom: 5px;
  }

  .panel-heading h2 {
    font-size: 18px;
  }

  .panel-body {
    padding-right: 2px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(255, 248, 226, 0.34) rgba(255, 248, 226, 0.06);
    scrollbar-width: thin;
  }

  .panel-page[data-panel="design"] .panel-body {
    overflow: hidden;
  }

  .theme-grid {
    gap: 7px;
  }

  .theme-card {
    min-height: 54px;
    padding: 8px;
  }

  .footer-actions {
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 8px;
    padding-top: 8px;
  }

  .footer-actions button {
    min-height: 38px;
  }

  .preview-toolbar,
  .preview-inner,
  .canvas-caption,
  .app[data-active-tab="tune"] .preview-toolbar,
  .app[data-active-tab="tune"] .preview-inner,
  .app[data-active-tab="tune"] .canvas-caption {
    width: min(100%, calc((100dvh - 120px) * 0.75), 520px);
  }

  canvas,
  .app[data-active-tab="tune"] canvas {
    max-height: calc(100dvh - 120px);
  }

  .status-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .status-pill {
    justify-content: center;
    min-height: 28px;
    padding: 5px 6px;
    font-size: 11px;
  }

  .status-pill span {
    display: none;
  }

  .status-pill strong {
    max-width: 100%;
  }

  .canvas-caption {
    max-height: 34px;
    overflow: hidden;
    font-size: 12px;
  }

  .mobile-screen-switch {
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    width: min(430px, calc(100vw - 24px));
    margin: 0 auto;
    padding: 5px;
    border: 1px solid rgba(255, 248, 226, 0.18);
    border-radius: 8px;
    background:
      linear-gradient(90deg, rgba(223, 52, 80, 0.16), rgba(32, 168, 143, 0.09)),
      rgba(13, 14, 10, 0.96);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
  }

  .mobile-screen-switch button {
    min-height: 40px;
    color: var(--muted);
    background: rgba(255, 248, 226, 0.06);
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-screen-switch button.is-active {
    color: #fff8e8;
    background: var(--accent);
    box-shadow: 0 8px 20px rgba(223, 52, 80, 0.24);
  }
}

@media (max-width: 768px) and (max-height: 480px) {
  .editor,
  .app[data-active-tab="tune"] .editor,
  .preview,
  .app[data-active-tab="tune"] .preview {
    padding-top: 10px;
  }

  .editor h1 {
    font-size: 28px;
  }

  .tab-button {
    min-height: 32px;
  }

  .panel-heading h2 {
    font-size: 17px;
  }

  .preview,
  .app[data-active-tab="tune"] .preview {
    gap: 6px;
  }

  .preview-toolbar,
  .app[data-active-tab="tune"] .preview-toolbar {
    display: none;
  }

  .preview-inner,
  .app[data-active-tab="tune"] .preview-inner {
    width: min(100%, calc((100dvh - 92px) * 0.75), 500px);
  }

  canvas,
  .app[data-active-tab="tune"] canvas {
    max-height: calc(100dvh - 92px);
  }

  .canvas-caption {
    display: none;
  }

  .mobile-screen-switch button {
    min-height: 38px;
  }
}

@media print {
  html,
  body {
    overflow: visible;
  }

  body {
    background: #fff;
  }

  .editor,
  .preview-toolbar,
  .canvas-caption {
    display: none;
  }

  .app {
    display: block;
    height: auto;
    overflow: visible;
  }

  .preview {
    min-height: 0;
    height: auto;
    padding: 0;
    background: #fff;
    overflow: visible;
  }

  .preview-inner {
    width: 100%;
  }

  canvas {
    width: 100%;
    max-height: none;
    box-shadow: none;
  }
}
