/* ==========================================================================
   QR Studio Pro — design system
   Graphite surfaces, hairline structure, one electric accent used sparingly.
   ========================================================================== */

:root {
  /* Ground */
  --bg: #111315;
  --bg-deep: #0c0e10;
  --surface: #181b1f;
  --surface-2: #1e2228;
  --surface-3: #262b32;

  /* Structure */
  --line: #262b32;
  --line-soft: #1e2229;
  --line-bright: #333941;

  /* Ink */
  --text: #e9edf2;
  --text-dim: #98a1ac;
  --text-faint: #626b76;

  /* Accent */
  --accent: #0099ff;
  --accent-bright: #3db2ff;
  --accent-deep: #0072c2;
  --accent-wash: rgba(0, 153, 255, 0.12);
  --accent-glow: rgba(0, 153, 255, 0.28);

  /* Semantic */
  --pro: #f0b429;
  --pro-wash: rgba(240, 180, 41, 0.12);
  --danger: #ff5f56;
  --ok: #35d07f;

  /* Type */
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo,
    Consolas, monospace;

  /* Geometry */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --rail: 336px;
  --bar-h: 60px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* --- reset ---------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  display: flex;
  flex-direction: column;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

::selection {
  background: var(--accent-glow);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Ambient light source behind the artboard — sits under all content. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 62% -10%, rgba(0, 153, 255, 0.09), transparent 70%),
    radial-gradient(600px 400px at 8% 105%, rgba(0, 153, 255, 0.045), transparent 70%);
}

/* --- primitives ----------------------------------------------------------- */

.micro-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hairline {
  height: 1px;
  background: var(--line-soft);
  border: 0;
  margin: 0;
}

/* --- app bar -------------------------------------------------------------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: rgba(17, 19, 21, 0.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(150deg, var(--surface-3), var(--surface));
  border: 1px solid var(--line-bright);
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand__mark svg {
  width: 17px;
  height: 17px;
}

.brand__name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.brand__name em {
  font-style: normal;
  color: var(--accent);
}

.brand__sub {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  margin-top: -2px;
}

.appbar__spacer {
  flex: 1;
}

.appbar__meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Tier badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}

.badge--pro {
  border-color: rgba(240, 180, 41, 0.4);
  background: var(--pro-wash);
  color: var(--pro);
}

.badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* --- buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
    transform 0.1s var(--ease), color 0.16s var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--line-bright);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn--primary {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  border-color: var(--accent-deep);
  color: #04121e;
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 6px 18px -8px var(--accent-glow);
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #57bcff, #0aa0ff);
  border-color: var(--accent-deep);
}

.btn--pro {
  background: linear-gradient(180deg, #f7c650, var(--pro));
  border-color: #c99118;
  color: #241a02;
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset;
}

.btn--pro:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffd469, #f5bb33);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.btn--sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12px;
}

.btn--block {
  width: 100%;
}

/* --- layout --------------------------------------------------------------- */

.studio {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--rail);
  align-items: start;
  gap: 0;
  min-height: calc(100vh - var(--bar-h));
}

.rail {
  border-right: 1px solid var(--line-soft);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: var(--bar-h);
  max-height: calc(100vh - var(--bar-h));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.rail--export {
  border-right: 0;
  border-left: 1px solid var(--line-soft);
}

.rail::-webkit-scrollbar {
  width: 8px;
}

.rail::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 4px;
  border: 2px solid var(--bg);
}

.rail::-webkit-scrollbar-track {
  background: transparent;
}

/* --- panel/card ----------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line-soft);
}

.panel__title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.panel__title svg {
  width: 14px;
  height: 14px;
  color: var(--text-faint);
}

.panel__body {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- segmented type switcher --------------------------------------------- */

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 3px;
  background: var(--bg-deep);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}

.segmented__thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: calc((100% - 6px) / 4);
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line-bright);
  box-shadow: var(--shadow-sm);
  transition: transform 0.28s var(--ease);
  pointer-events: none;
}

.seg {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 46px;
  border-radius: 7px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.18s var(--ease);
}

.seg svg {
  width: 15px;
  height: 15px;
}

.seg:hover {
  color: var(--text-dim);
}

.seg[aria-selected="true"] {
  color: var(--text);
}

.seg[aria-selected="true"] svg {
  color: var(--accent);
}

/* --- form fields ---------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.field__hint {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}

.input,
.textarea,
.select {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 9px 11px;
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease),
    background 0.16s var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: #4d555f;
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--line-bright);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
  background: #0a0d10;
}

.textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.55;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398a1ac' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Checkbox */
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
  color: var(--text-dim);
}

.check input {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1px solid var(--line-bright);
  background: var(--bg-deep);
  display: grid;
  place-content: center;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
  flex-shrink: 0;
  margin: 0;
}

.check input::after {
  content: "";
  width: 9px;
  height: 9px;
  transform: scale(0);
  transition: transform 0.16s var(--ease);
  background: #04121e;
  clip-path: polygon(14% 47%, 0 61%, 39% 100%, 100% 22%, 85% 9%, 37% 71%);
}

.check input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.check input:checked::after {
  transform: scale(1);
}

.check:hover input {
  border-color: var(--accent);
}

/* --- artboard ------------------------------------------------------------- */

.stage {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--bar-h));
  padding: 24px;
  gap: 16px;
}

.artboard {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  border-radius: var(--r-xl);
  border: 1px solid var(--line-soft);
  background-color: var(--bg-deep);
  /* Precision dot grid — reads as a design surface, not a placeholder. */
  background-image: radial-gradient(circle at 1px 1px, #1d2229 1px, transparent 0);
  background-size: 22px 22px;
  overflow: hidden;
  min-height: 380px;
}

.artboard::after {
  /* Vignette so the code reads as lit from above. */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(6, 8, 10, 0.6) 100%);
}

.artboard__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 32px;
}

/* Registration marks in the artboard corners — reads as a design surface
   rather than an empty div, and gives the canvas a defined edge. */
.artboard__marks {
  position: absolute;
  inset: 18px;
  pointer-events: none;
  z-index: 1;
}

.artboard__marks span {
  position: absolute;
  width: 13px;
  height: 13px;
  border: 1px solid var(--line-bright);
  opacity: 0.75;
}

.artboard__marks span:nth-child(1) {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
}

.artboard__marks span:nth-child(2) {
  top: 0;
  right: 0;
  border-left: 0;
  border-bottom: 0;
}

.artboard__marks span:nth-child(3) {
  bottom: 0;
  left: 0;
  border-right: 0;
  border-top: 0;
}

.artboard__marks span:nth-child(4) {
  bottom: 0;
  right: 0;
  border-left: 0;
  border-top: 0;
}

/* Live status chip, top-left of the canvas */
.artboard__status {
  position: absolute;
  top: 16px;
  left: 44px; /* clears the top-left registration mark */
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.artboard__status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 153, 255, 0.5);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(0, 153, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 153, 255, 0);
  }
}

/* Dimension caption under the plate */
.plate-caption {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.plate {
  position: relative;
  padding: 18px;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.4s var(--ease), opacity 0.3s var(--ease);
  transform-origin: center;
}

.plate img {
  display: block;
  /* Scales with the artboard so the code fills the canvas on large screens
     without overflowing small ones. */
  width: clamp(240px, 24vw, 340px);
  height: clamp(240px, 24vw, 340px);
  image-rendering: pixelated; /* keep module edges crisp when upscaled */
}

.plate--loading {
  opacity: 0.35;
}

.plate--pop {
  animation: plate-pop 0.42s var(--ease);
}

@keyframes plate-pop {
  0% {
    transform: scale(0.965);
    opacity: 0.4;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Empty + error states share the artboard centre */
.stage-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  max-width: 330px;
  padding: 40px 20px;
}

.stage-state__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-faint);
}

.stage-state__icon svg {
  width: 22px;
  height: 22px;
}

.stage-state__title {
  font-size: 14px;
  font-weight: 600;
}

.stage-state__body {
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.6;
}

.stage-state--error .stage-state__icon {
  color: var(--danger);
  border-color: rgba(255, 95, 86, 0.3);
  background: rgba(255, 95, 86, 0.08);
}

/* Metadata readout strip below the artboard */
.readout {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.readout__cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 15px;
  border-right: 1px solid var(--line-soft);
  min-width: 92px;
}

.readout__cell:last-child {
  border-right: 0;
  flex: 1;
  min-width: 160px;
}

.readout__key {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.readout__val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.readout__val--accent {
  color: var(--accent);
}

/* --- export cards --------------------------------------------------------- */

.export-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease),
    transform 0.1s var(--ease);
}

.export-card:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-3);
}

.export-card:active:not(:disabled) {
  transform: translateY(1px);
}

.export-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  color: var(--accent);
  flex-shrink: 0;
}

.export-card__icon svg {
  width: 17px;
  height: 17px;
}

.export-card__text {
  flex: 1;
  min-width: 0;
}

.export-card__title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}

.export-card__meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}

/* Locked Pro variant: hatched, gold-keyed */
.export-card--locked {
  background: var(--surface);
  border-style: dashed;
  border-color: var(--line-bright);
}

.export-card--locked::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.5;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 7px,
    rgba(240, 180, 41, 0.05) 7px,
    rgba(240, 180, 41, 0.05) 14px
  );
}

.export-card--locked:hover {
  border-color: var(--pro);
  background: var(--pro-wash);
}

.export-card--locked .export-card__icon {
  color: var(--pro);
  border-color: rgba(240, 180, 41, 0.28);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag--pro {
  background: var(--pro-wash);
  color: var(--pro);
  border: 1px solid rgba(240, 180, 41, 0.3);
}

.tag--free {
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--line-bright);
}

/* --- stepper / control row ------------------------------------------------ */

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.stepper button {
  width: 28px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-dim);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.stepper button:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.stepper button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stepper svg {
  width: 13px;
  height: 13px;
}

.stepper__value {
  min-width: 62px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--bg-deep);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Color pair */
.swatches {
  display: flex;
  gap: 8px;
}

.swatch {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-deep);
  transition: border-color 0.16s var(--ease);
}

.swatch:hover {
  border-color: var(--line-bright);
}

.swatch input[type="color"] {
  appearance: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-bright);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}

.swatch input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.swatch input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 5px;
}

.swatch input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 5px;
}

.swatch__text {
  min-width: 0;
}

.swatch__label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.swatch__hex {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* --- quota meter ---------------------------------------------------------- */

.meter {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.meter__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.meter__count {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.meter__count b {
  color: var(--accent);
  font-weight: 600;
}

.meter__pips {
  display: flex;
  gap: 4px;
}

.meter__pip {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.meter__pip--filled {
  background: var(--accent);
  box-shadow: 0 0 8px -1px var(--accent-glow);
}

.meter__pip--spent {
  background: var(--surface-3);
  opacity: 0.5;
}

.meter__note {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
}

.meter--exhausted .meter__count b {
  color: var(--pro);
}

.meter--pro {
  border-color: rgba(240, 180, 41, 0.28);
  background: linear-gradient(180deg, var(--pro-wash), transparent);
}

/* --- upsell block --------------------------------------------------------- */

.upsell {
  border-radius: var(--r-lg);
  border: 1px solid rgba(240, 180, 41, 0.26);
  background: linear-gradient(165deg, rgba(240, 180, 41, 0.09), transparent 60%),
    var(--surface);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upsell__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upsell__title {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.upsell__price {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.upsell__amount {
  font-size: 26px;
  font-weight: 680;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.upsell__note {
  font-size: 11.5px;
  color: var(--text-faint);
}

.upsell__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.upsell__list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.upsell__list svg {
  width: 13px;
  height: 13px;
  color: var(--pro);
  flex-shrink: 0;
  margin-top: 3px;
}

/* --- ad slots ------------------------------------------------------------- */

.adslot {
  border-radius: var(--r-md);
  overflow: hidden;
}

.adslot__label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4a525c;
  margin-bottom: 6px;
  text-align: center;
}

/* Placeholder shown when AdSense isn't configured yet (non-production only) */
.adslot__placeholder {
  display: grid;
  place-items: center;
  gap: 5px;
  border: 1px dashed var(--line-bright);
  border-radius: var(--r-md);
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 9px,
    rgba(255, 255, 255, 0.014) 9px,
    rgba(255, 255, 255, 0.014) 18px
  );
  color: #4a525c;
  text-align: center;
  padding: 16px;
}

.adslot--rect .adslot__placeholder {
  min-height: 250px;
}

.adslot--leaderboard .adslot__placeholder {
  min-height: 90px;
}

.adslot__placeholder-size {
  font-family: var(--font-mono);
  font-size: 11px;
}

.adslot__placeholder-hint {
  font-size: 10.5px;
  max-width: 200px;
  line-height: 1.5;
}

.adrail {
  margin-top: auto;
  padding-top: 4px;
}

/* --- footer --------------------------------------------------------------- */

.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line-soft);
  padding: 22px 24px 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg-deep);
}

.footer__ad {
  max-width: 970px;
  margin: 0 auto;
  width: 100%;
}

.footer__legal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-faint);
}

.footer__links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer__links a:hover {
  color: var(--text-dim);
}

/* --- modal ---------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 8, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s var(--ease), visibility 0.22s var(--ease);
}

.modal[data-open="true"] {
  opacity: 1;
  visibility: visible;
}

.modal__card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line-bright);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(10px) scale(0.99);
  transition: transform 0.28s var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}

.modal[data-open="true"] .modal__card {
  transform: none;
}

.modal__head {
  padding: 20px 22px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal__title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
}

.modal__sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 5px 0 0;
  line-height: 1.55;
}

.modal__body {
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal__close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  flex-shrink: 0;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.modal__close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal__close svg {
  width: 15px;
  height: 15px;
}

/* Bulk textarea inside modal */
.bulk-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

/* --- toast ---------------------------------------------------------------- */

.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(440px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line-bright);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  color: var(--text);
  animation: toast-in 0.3s var(--ease);
  pointer-events: auto;
  max-width: 100%;
}

.toast svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.toast--ok svg {
  color: var(--ok);
}

.toast--error {
  border-color: rgba(255, 95, 86, 0.4);
}

.toast--error svg {
  color: var(--danger);
}

.toast--leaving {
  animation: toast-out 0.24s var(--ease) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* --- utility -------------------------------------------------------------- */

[hidden] {
  display: none !important;
}

.spin {
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 1180px) {
  :root {
    --rail: 300px;
  }
}

@media (max-width: 1020px) {
  .studio {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    max-height: none;
    border-right: 0;
    border-left: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .rail--input {
    order: 1;
  }

  .stage {
    order: 2;
    min-height: 0;
    padding: 20px;
  }

  .rail--export {
    order: 3;
    border-bottom: 0;
    border-top: 1px solid var(--line-soft);
  }

  .artboard {
    min-height: 320px;
  }
}

@media (max-width: 640px) {
  .appbar {
    padding: 0 14px;
    gap: 10px;
  }

  .appbar__guides {
    display: none;
  }

  .brand__sub {
    display: none;
  }

  .rail,
  .stage {
    padding: 14px;
  }

  .plate img {
    width: min(240px, 62vw);
    height: min(240px, 62vw);
  }

  .readout__cell {
    min-width: 78px;
    padding: 8px 12px;
  }

  .footer {
    padding: 18px 14px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
