@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/IBMPlexSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/IBMPlexSans-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/SpaceGrotesk-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/SpaceGrotesk-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg-start: #070504;
  --bg-end: #170f0a;
  --surface-glass: rgba(23, 16, 11, 0.84);
  --surface-strong: rgba(31, 22, 15, 0.94);
  --surface-soft: rgba(42, 29, 19, 0.88);
  --border-color: rgba(230, 206, 163, 0.14);
  --border-strong: rgba(211, 161, 90, 0.32);
  --text-main: #f7ead7;
  --text-muted: #dcc49b;
  --text-soft: #9d7f51;
  --primary: #d3a15a;
  --primary-strong: #e6cea3;
  --primary-soft: rgba(211, 161, 90, 0.12);
  --primary-deep: #7c5730;
  --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.26);
  --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.3);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --duration-fast: 140ms;
  --duration-normal: 240ms;
  --ease-standard: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(211, 161, 90, 0.18), transparent 28%),
    radial-gradient(circle at right center, rgba(115, 63, 24, 0.22), transparent 30%),
    linear-gradient(180deg, var(--bg-start), var(--bg-end));
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(230, 206, 163, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230, 206, 163, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 78%);
  pointer-events: none;
}

button,
input,
textarea,
canvas {
  font: inherit;
}

a {
  color: inherit;
}

button,
input,
textarea {
  outline: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 4px rgba(230, 206, 163, 0.2);
}

.app-shell {
  max-width: 1640px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: rgba(22, 15, 10, 0.74);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  min-width: 80px;
  height: 54px;
  padding: 0 12px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #120c08;
  background: linear-gradient(145deg, #f1deb9, #d3a15a 58%, #8a5f2d);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.brand-eyebrow,
.panel-kicker,
.meta-label,
.template-current__label {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.brand-name,
.panel-title {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-name {
  font-size: 1.72rem;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(43, 29, 19, 0.86);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

.status-pill--speed {
  position: relative;
  border-color: rgba(230, 206, 163, 0.2);
}

.status-pill--speed::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: #9d7f51;
  box-shadow: 0 0 0 5px rgba(157, 127, 81, 0.2);
}

.status-pill--speed[data-speed-mode="warming"]::before {
  background: #d3a15a;
  box-shadow: 0 0 0 5px rgba(211, 161, 90, 0.2);
}

.status-pill--speed[data-speed-mode="fast"] {
  color: #120c08;
  border-color: transparent;
  background: linear-gradient(135deg, #f4e6c8, #e6cea3, #d3a15a);
}

.status-pill--speed[data-speed-mode="fast"]::before {
  background: #7f531f;
  box-shadow: 0 0 0 5px rgba(127, 83, 31, 0.24);
}

.status-pill--editor {
  color: #120c08;
  background: linear-gradient(135deg, #f1deb9, #d3a15a);
  border-color: transparent;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    opacity var(--duration-fast) var(--ease-standard);
}

.status-pill--editor:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

body.editor-mode .status-pill--editor {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.workspace {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr) 340px;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.panel {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  background: var(--surface-glass);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-card);
}

.template-rail,
.inspector,
.preview-panel {
  padding: 24px;
}

.panel-section {
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(230, 206, 163, 0.08);
}

.panel-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.panel-section--tight {
  padding-bottom: 18px;
}

.panel-title {
  font-size: 1.45rem;
  line-height: 1.08;
}

.panel-copy {
  margin: 10px 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.template-current {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(58, 40, 24, 0.92), rgba(21, 14, 10, 0.92));
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px 0 rgba(255, 240, 214, 0.08);
}

.template-current__value {
  display: block;
  margin-top: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
}

.template-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.language-group {
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: linear-gradient(145deg, rgba(44, 31, 21, 0.92), rgba(17, 12, 8, 0.94));
  overflow: hidden;
  transition:
    border-color var(--duration-normal) var(--ease-standard),
    box-shadow var(--duration-normal) var(--ease-standard),
    transform var(--duration-normal) var(--ease-standard);
}

.language-group.is-current {
  border-color: var(--border-strong);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.language-toggle {
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "headline meta";
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  color: inherit;
}

.language-toggle:hover {
  background: rgba(255, 238, 209, 0.04);
}

.language-toggle__headline {
  grid-area: headline;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.language-toggle__flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 1rem;
  flex-shrink: 0;
}

.language-toggle__name {
  font-size: 0.98rem;
  line-height: 1.05;
  font-weight: 600;
  white-space: nowrap;
}

.language-toggle__native {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  line-height: 1.1;
  color: var(--primary-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.language-toggle__meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  flex-shrink: 0;
}

.language-toggle__chevron {
  width: 12px;
  height: 12px;
  border-right: 2px solid rgba(230, 206, 163, 0.86);
  border-bottom: 2px solid rgba(230, 206, 163, 0.86);
  transform: rotate(45deg);
  transition: transform var(--duration-normal) var(--ease-standard);
}

.language-group.is-open .language-toggle__chevron {
  transform: rotate(225deg);
}

.language-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--duration-normal) var(--ease-standard);
}

.language-group.is-open .language-panel {
  grid-template-rows: 1fr;
}

.language-panel__inner {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-fast) var(--ease-standard),
    visibility var(--duration-fast) var(--ease-standard);
}

.language-group.is-open .language-panel__inner {
  opacity: 1;
  visibility: visible;
}

.language-panel__content {
  padding: 0 16px 14px;
  border-top: 1px solid rgba(230, 206, 163, 0.08);
}

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

.vip-chip {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(230, 206, 163, 0.1);
  border-radius: 14px;
  background: rgba(23, 15, 10, 0.9);
  color: var(--text-muted);
  text-align: center;
  font-weight: 600;
  transition:
    transform var(--duration-normal) var(--ease-standard),
    border-color var(--duration-normal) var(--ease-standard),
    background-color var(--duration-normal) var(--ease-standard),
    box-shadow var(--duration-normal) var(--ease-standard),
    color var(--duration-normal) var(--ease-standard);
}

.vip-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(230, 206, 163, 0.24);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
}

.vip-chip.is-active {
  color: #140d09;
  border-color: transparent;
  background: linear-gradient(145deg, #f1deb9, #d3a15a 62%, #8f6631);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

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

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

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

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  color: #120c08;
  background: linear-gradient(135deg, #f1deb9, #d3a15a 58%, #8a5f2d);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.btn--secondary {
  color: var(--primary-strong);
  background: rgba(34, 24, 16, 0.94);
  border-color: rgba(230, 206, 163, 0.18);
}

.btn--secondary:hover {
  border-color: rgba(230, 206, 163, 0.28);
}

.btn--small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.88rem;
}

.btn--block {
  width: 100%;
}

.canvas-frame {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 18px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, rgba(230, 206, 163, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(34, 24, 16, 0.92), rgba(14, 10, 8, 0.94));
  border: 1px solid var(--border-color);
  overflow: hidden;
  min-height: 360px;
}

.canvas-frame::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 24px;
  border: 1px solid rgba(230, 206, 163, 0.06);
  pointer-events: none;
}

.canvas-frame.is-transitioning #previewCanvas {
  animation: previewPulse 260ms var(--ease-standard);
}

@keyframes previewPulse {
  0% {
    opacity: 0.72;
    transform: scale(0.985);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

#previewCanvas {
  position: relative;
  display: block;
  width: min(100%, 988px);
  height: auto;
  border-radius: 20px;
  box-shadow: 0 26px 56px rgba(0, 0, 0, 0.4);
  background: #120c08;
  z-index: 1;
}

.canvas-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(9, 6, 4, 0.66);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-standard);
  z-index: 2;
}

.canvas-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.loading-card {
  min-width: 220px;
  padding: 20px 24px;
  border-radius: 22px;
  background: rgba(24, 17, 12, 0.94);
  border: 1px solid var(--border-color);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.loading-card--error {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid rgba(230, 206, 163, 0.16);
  border-top-color: var(--primary);
  animation: spin 900ms linear infinite;
}

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

.preview-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.cache-progress {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(32, 22, 14, 0.86);
  border: 1px solid rgba(230, 206, 163, 0.14);
}

.cache-progress__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.cache-progress__title {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
}

.cache-progress__count {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  color: var(--primary-strong);
}

.cache-progress__copy {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.cache-progress__bar {
  position: relative;
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(230, 206, 163, 0.12);
  overflow: hidden;
}

.cache-progress__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #b8864b, #d3a15a, #f1deb9);
  transition: width var(--duration-normal) var(--ease-standard);
}

.cache-progress__meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.cache-progress.is-complete .cache-progress__title {
  color: #f4e6c8;
}

.cache-progress.is-complete .cache-progress__copy {
  color: #e6cea3;
}

.preview-meta__block {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(28, 20, 14, 0.84);
  border: 1px solid rgba(230, 206, 163, 0.08);
}

.meta-value {
  display: block;
  margin-top: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
}

.status-strip {
  margin-top: 16px;
  min-height: 48px;
  padding: 13px 16px;
  border-radius: 18px;
  color: var(--primary-strong);
  background: rgba(211, 161, 90, 0.1);
  border: 1px solid rgba(230, 206, 163, 0.14);
  font-size: 0.94rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h3 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(211, 161, 90, 0.12);
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 600;
}

.mini-badge--live {
  color: #120c08;
  background: linear-gradient(135deg, #f1deb9, #d3a15a);
}

.field-label {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field-help {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.55;
}

.text-input,
.file-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(230, 206, 163, 0.14);
  background: rgba(20, 14, 10, 0.94);
  color: var(--text-main);
}

.text-input--multiline {
  min-height: 86px;
  padding: 12px 14px;
  resize: none;
  line-height: 1.25;
}

.text-input::placeholder {
  color: #8f7249;
}

.file-input {
  padding: 10px 12px;
}

.file-input::file-selector-button {
  margin-right: 12px;
  min-height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 12px;
  background: rgba(211, 161, 90, 0.16);
  color: var(--primary-strong);
  font-weight: 600;
  cursor: pointer;
}

.editor-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.segmented-control {
  display: flex;
  gap: 10px;
}

.segment {
  flex: 1;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(230, 206, 163, 0.12);
  background: rgba(21, 15, 10, 0.94);
  color: var(--text-muted);
  font-weight: 600;
}

.segment.is-active {
  background: linear-gradient(145deg, #f1deb9, #d3a15a);
  border-color: transparent;
  color: #120c08;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.nudge-grid {
  width: 138px;
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 42px);
  gap: 6px;
}

.nudge-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(230, 206, 163, 0.14);
  border-radius: 14px;
  background: rgba(21, 15, 10, 0.94);
  position: relative;
}

.nudge-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-style: solid;
}

.nudge-btn--up {
  grid-column: 2;
  grid-row: 1;
}

.nudge-btn--left {
  grid-column: 1;
  grid-row: 2;
}

.nudge-btn--right {
  grid-column: 3;
  grid-row: 2;
}

.nudge-btn--down {
  grid-column: 2;
  grid-row: 3;
}

.nudge-btn--up::before {
  border-width: 0 7px 10px 7px;
  border-color: transparent transparent var(--primary-strong) transparent;
}

.nudge-btn--down::before {
  border-width: 10px 7px 0 7px;
  border-color: var(--primary-strong) transparent transparent transparent;
}

.nudge-btn--left::before {
  border-width: 7px 10px 7px 0;
  border-color: transparent var(--primary-strong) transparent transparent;
}

.nudge-btn--right::before {
  border-width: 7px 0 7px 10px;
  border-color: transparent transparent transparent var(--primary-strong);
}

.size-row {
  display: flex;
  gap: 10px;
}

.size-row--compact {
  gap: 8px;
}

.btn--micro {
  min-height: 32px;
  min-width: 46px;
  padding: 0 10px;
  font-size: 0.8rem;
  border-radius: 10px;
}

.coords-box {
  margin: 0;
  padding: 14px;
  border-radius: 18px;
  background: rgba(22, 15, 10, 0.96);
  border: 1px solid rgba(230, 206, 163, 0.1);
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  min-height: 1.5em;
  padding: 0 0.35em;
  border-radius: 8px;
  border: 1px solid rgba(230, 206, 163, 0.12);
  background: rgba(36, 25, 17, 0.9);
  color: var(--text-main);
  font-size: 0.82rem;
}

.footer-note {
  margin-top: 18px;
  padding: 0 6px 12px;
  color: var(--text-soft);
  text-align: center;
  font-size: 0.88rem;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 16px;
  color: #120c08;
  background: linear-gradient(135deg, #f1deb9, #d3a15a);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity var(--duration-normal) var(--ease-standard),
    transform var(--duration-normal) var(--ease-standard);
  z-index: 10;
}

.toast[data-tone="info"] {
  color: #f6ead7;
  background: linear-gradient(135deg, #362417, #5f3d1f);
}

.toast[data-tone="error"] {
  color: #fff4f4;
  background: linear-gradient(135deg, #8d2020, #d44747);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.name-input-shell {
  border-radius: 14px;
  border: 1px solid rgba(230, 206, 163, 0.14);
  background: rgba(20, 14, 10, 0.94);
  overflow: hidden;
}

.name-input-shell .text-input--multiline {
  border: none;
  background: transparent;
  min-height: 72px;
}

.name-input-shell .text-input--multiline:focus-visible {
  box-shadow: none;
}

.name-inline-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid rgba(230, 206, 163, 0.1);
  background: rgba(34, 24, 16, 0.9);
}

.name-inline-tools__label {
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.name-inline-tools__group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nudge-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nudge-btn--compact {
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

.nudge-btn--compact.nudge-btn--up::before {
  border-width: 0 4px 7px 4px;
}

.nudge-btn--compact.nudge-btn--down::before {
  border-width: 7px 4px 0 4px;
}

.nudge-btn--compact.nudge-btn--left::before {
  border-width: 4px 7px 4px 0;
}

.nudge-btn--compact.nudge-btn--right::before {
  border-width: 4px 0 4px 7px;
}

.public-only[hidden] {
  display: none !important;
}

.editor-only[hidden],
[hidden] {
  display: none !important;
}


body.viewport-fit-active .footer-note {
  display: none;
}

@media (min-width: 1200px) and (min-height: 760px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    max-width: min(1700px, 100vw);
    height: 100vh;
    padding: 12px 16px 8px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
  }

  .topbar {
    padding: 12px 16px;
    gap: 16px;
  }

  .brand-name {
    font-size: 1.45rem;
  }

  .status-pill {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.84rem;
  }

  .workspace {
    margin-top: 0;
    height: 100%;
    min-height: 0;
    gap: 14px;
    grid-template-columns: 224px minmax(0, 1fr) 312px;
    align-items: stretch;
  }

  .panel {
    min-height: 0;
  }

  .template-rail,
  .inspector,
  .preview-panel {
    padding: 14px;
  }

  .template-rail,
  .inspector {
    overflow: auto;
    scrollbar-width: thin;
  }

  .preview-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .panel-head {
    margin-bottom: 10px;
  }

  .panel-title {
    font-size: 1.25rem;
  }

  .panel-copy {
    margin-top: 6px;
    font-size: 0.86rem;
    line-height: 1.4;
  }

  .canvas-frame {
    flex: 1;
    min-height: 0;
    padding: 10px;
  }

  .canvas-frame::before {
    inset: 10px;
  }

  #previewCanvas {
    width: auto;
    max-width: 100%;
    max-height: 100%;
  }

  .preview-meta {
    margin-top: 10px;
    gap: 10px;
  }

  .preview-meta__block {
    padding: 10px 12px;
  }

  .cache-progress {
    margin-top: 10px;
    padding: 10px 12px;
  }

  .cache-progress__copy {
    font-size: 0.82rem;
  }

  .cache-progress__meta {
    margin-top: 8px;
    font-size: 0.8rem;
  }

  .status-strip {
    margin-top: 10px;
    min-height: 40px;
    padding: 10px 12px;
    font-size: 0.86rem;
  }

  .panel-section {
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .template-current {
    padding: 12px 14px;
  }

  .template-current__value {
    margin-top: 6px;
    font-size: 0.96rem;
  }

  .language-toggle {
    padding: 8px 10px;
  }

  .vip-grid {
    gap: 8px;
  }

  .vip-chip {
    min-height: 30px;
    font-size: 0.82rem;
  }

  .text-input,
  .file-input {
    min-height: 42px;
  }

  .text-input--multiline {
    min-height: 62px;
  }

  .btn {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.88rem;
  }

  .btn--small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.82rem;
  }

  .nudge-grid {
    width: 126px;
    grid-template-columns: repeat(3, 38px);
    grid-template-rows: repeat(3, 38px);
    gap: 6px;
  }

  .nudge-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .footer-note {
    margin-top: 0;
    padding: 0 6px 2px;
    font-size: 0.72rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    border-radius: 26px;
  }

  .topbar-meta,
  .action-row {
    width: 100%;
    justify-content: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .template-rail,
  .preview-panel,
  .inspector {
    padding: 18px;
  }

  .language-toggle {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "headline meta";
    align-items: center;
  }

  .language-toggle__meta {
    justify-self: end;
  }

  .preview-meta {
    grid-template-columns: 1fr;
  }

  .cache-progress__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .panel-head {
    flex-direction: column;
  }

  .name-quick-controls__layout {
    flex-direction: column;
    align-items: stretch;
  }

  .size-row--compact {
    justify-content: flex-start;
  }

  .name-inline-tools {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  #previewCanvas {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
