/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --accent:      #FAAD14;
  --accent-dark: #EF9F00;
  --accent-bg:   #FFFBF2;
  --accent-mid:  #FFF1B8;
  --bg:          #FAF8F4;
  --surface:     #FFFFFF;
  --border:      #E8E4DC;
  --text:        #1C1916;
  --muted:       #9C9890;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
body {
  font-family: 'Albert Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ── App shell — full-screen 3-column grid ─────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: clamp(280px, 22vw, 360px) 1fr clamp(280px, 22vw, 360px);
  grid-template-rows: auto 1fr;
  height: 100vh;
  min-width: 1280px;
  background: var(--surface);
}

/* ── Top nav ────────────────────────────────────────────────────────────────── */
.top-nav {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── LEFT SIDEBAR ──────────────────────────────────────────────────────────── */
.col-left {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.logo-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 400;
}

.lib-head {
  padding: 16px 18px 8px;
  flex-shrink: 0;
}

.lib-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ── Search ────────────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  padding: 0 14px 8px;
  flex-shrink: 0;
}

.search-wrap svg {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-62%);
  color: var(--muted);
  pointer-events: none;
}

input[type="text"] {
  width: 100%;
  padding: 7px 10px 7px 32px;
  font-size: 12px;
  font-family: 'Albert Sans', sans-serif;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .12s;
}

input[type="text"]:focus { border-color: var(--accent); }

/* ── Left footer (icon count + more) ───────────────────────────────────────── */
.left-footer {
  flex-shrink: 0;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.count {
  font-size: 11px;
  color: var(--muted);
}


/* ── Icon grid ─────────────────────────────────────────────────────────────── */
.grid-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 10px 8px;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.empty-msg {
  display: none;
  padding: 32px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.icell {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 12px 4px 10px;
  aspect-ratio: 1;
  transition: border-color .12s, background .12s;
  overflow: hidden;
  color: #444;
}

.icell:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.icell.on {
  border: 1.5px solid var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.icell span {
  font-size: 9px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: var(--muted);
  font-weight: 500;
  padding: 0 2px;
}

.icell.on span {
  color: var(--accent);
  font-weight: 600;
}

/* ── Creator card (sits at bottom of right panel) ──────────────────────────── */
.creator-card {
  padding: 14px 16px;
  background: var(--accent-bg);
  border-radius: 12px;
  flex-shrink: 0;
}

.creator-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.creator-role {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}

.creator-text {
  font-size: 11.5px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 12px;
}

.mail-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.mail-link:hover { color: var(--accent); }

/* ── CENTER ────────────────────────────────────────────────────────────────── */
.col-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #FCFAF6;
  gap: 18px;
  padding: 40px;
}

.preview-area {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(200px, 18vw, 300px);
  height: clamp(200px, 18vw, 300px);
  position: relative;
}

/* Scale up the live animated SVG only (not the empty state SVG) */
.preview-area > svg {
  width: clamp(160px, 14vw, 240px) !important;
  height: clamp(160px, 14vw, 240px) !important;
}

.empty-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.empty-label {
  font-size: 16px;
  color: var(--muted);
  font-weight: 400;
}

.preview-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
}

.preview-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  min-height: 1.2em;
}

.src-tag {
  display: none;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* ── RIGHT SIDEBAR ─────────────────────────────────────────────────────────── */
.col-right {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.right-hdr {
  padding: 20px 20px 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.right-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.r-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 0;
}

.r-section:first-child { padding-top: 0; }

.r-divider {
  height: 1px;
  background: var(--border);
  margin: 0 -20px;
  flex-shrink: 0;
}

.r-spacer {
  flex: 1;
  min-height: 20px;
}

/* ── Section title ─────────────────────────────────────────────────────────── */
.sec-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* ── Personality pills ─────────────────────────────────────────────────────── */
.pgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.pc {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  user-select: none;
  text-align: center;
}

.pc:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.pc.on {
  border: 1.5px solid var(--accent);
  background: var(--accent-bg);
}

.pn {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.pc.on .pn { color: var(--accent); }

/* ── Speed ─────────────────────────────────────────────────────────────────── */
.speed-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.speed-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  margin-top: 4px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--accent) var(--fill, 31.8%),
    var(--border) var(--fill, 31.8%)
  );
  cursor: pointer;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: box-shadow .12s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 5px rgba(250, 173, 20, 0.18);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

@keyframes val-tick {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.speed-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: inline-block;
  transform-origin: center;
}

.speed-val.ticking { animation: val-tick .14s ease; }

/* ── Colour section (right panel) ──────────────────────────────────────────── */
.colour-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.colour-swatch {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  background: #000000;
}

/* input#CH beats input[type="text"] specificity — removes double-border */
input#CH {
  flex: 1;
  padding: 7px 10px;
  font-size: 12px;
  font-family: 'Albert Sans', monospace;
  letter-spacing: 0.03em;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .12s;
}

input#CH:focus { border-color: var(--accent); }

/* ── Custom colour picker popup ──────────────────────────────────────────────── */
.cpk {
  position: fixed;
  z-index: 999;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 16px 16px 20px;
  width: 280px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.10);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cpk-map-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  border-radius: 10px;
  overflow: hidden;
  cursor: crosshair;
  flex-shrink: 0;
}

.cpk-map {
  display: block;
  width: 100%;
  height: 100%;
}

.cpk-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.cpk-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 0 16px;
}

.cpk-eye {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  padding: 0;
  transition: color .12s, background .12s;
}

.cpk-eye:hover { background: var(--bg); color: var(--text); }

.cpk-preview {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #000;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
}

/* Rainbow hue slider — overrides the general range input styles */
input.cpk-hue-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right,
    hsl(0,100%,50%), hsl(40,100%,50%), hsl(80,100%,50%), hsl(120,100%,50%),
    hsl(160,100%,50%), hsl(200,100%,50%), hsl(240,100%,50%), hsl(280,100%,50%),
    hsl(320,100%,50%), hsl(360,100%,50%)) !important;
  outline: none;
  cursor: pointer;
  --fill: 0%;
}

input.cpk-hue-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.15);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

input.cpk-hue-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.15);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

.cpk-rgb {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 4px;
}

.cpk-ch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.cpk-ch input[type="number"] {
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-family: 'Albert Sans', sans-serif;
  padding: 8px 4px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  -moz-appearance: textfield;
  transition: border-color .12s;
}

.cpk-ch input[type="number"]:focus { border-color: var(--accent); }

.cpk-ch input[type="number"]::-webkit-inner-spin-button,
.cpk-ch input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

.cpk-ch label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* ── Welcome dialog ────────────────────────────────────────────────────────── */
.wl-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.wl-overlay.hidden { display: none; }

.wl-card {
  background: #fff;
  border-radius: 24px;
  padding: 56px;
  width: 720px;
  max-width: 96vw;
  height: 760px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.wl-top {
  display: flex;
  flex-direction: column;
}

.wl-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 32px;
  display: block;
}

.wl-c {
  display: inline-block;
  animation: wl-wave 2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 80ms);
}

@keyframes wl-wave {
  0%, 100% { color: var(--accent);  transform: translateY(0);    }
  15%       { color: #FFD43B;        transform: translateY(-4px); }
  30%       { color: var(--accent);  transform: translateY(0);    }
}

.wl-greeting {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 14px;
}

.wl-headline {
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 16px;
}

.wl-amber { color: var(--accent); }

.wl-sub {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 36px;
}

.wl-sub strong { font-weight: 600; }

.wl-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: 'Albert Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 14px 36px;
  cursor: pointer;
  align-self: flex-start;
  transition: background .12s;
}

.wl-cta:hover { background: var(--accent-dark); }

.wl-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.wl-how {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 5px;
}

.wl-how-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

/* ── Export ────────────────────────────────────────────────────────────────── */
.export-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: -4px;
}

.export-btns {
  display: flex;
  gap: 8px;
}

.export-btn {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Albert Sans', sans-serif;
  padding: 8px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
}

.export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.export-btn:disabled { opacity: .5; cursor: not-allowed; }

/* In-button loading spinner */
.btn-loader {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(250, 173, 20, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spn .7s linear infinite;
  flex-shrink: 0;
}

.prog-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.prog-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .05s;
}

.status-txt {
  font-size: 11px;
  color: var(--muted);
  min-height: 1em;
}

/* ── Spinner ───────────────────────────────────────────────────────────────── */
@keyframes spn { to { transform: rotate(360deg); } }

.sdot {
  width: 10px;
  height: 10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spn .7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Mobile wall (shown below 1280px) ──────────────────────────────────────── */
.mobile-wall {
  display: none;
}

@media (max-width: 1279px) {
  .mobile-wall {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    inset: 0;
    background: var(--accent);
    padding: 52px 7vw 6vw;
    z-index: 9999;
    overflow: hidden;
  }

  .wl-overlay { display: none !important; }
}

.mw-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mw-title {
  font-size: clamp(22px, 5.5vw, 32px);
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
}

.mw-dots span {
  display: inline-block;
  animation: mw-dot 1.4s ease-in-out infinite;
}
.mw-dots span:nth-child(2) { animation-delay: 0.2s; }
.mw-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes mw-dot {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0);    }
  30%            { opacity: 1;    transform: translateY(-5px); }
}

.mw-body {
  font-size: clamp(14px, 3.5vw, 18px);
  color: #fff;
  line-height: 1.65;
}

.mw-body strong { font-weight: 700; }

.mw-sig {
  font-size: clamp(13px, 3vw, 16px);
  color: rgba(255,255,255,0.8);
}

.mw-brand {
  /* fills exactly the content width (100vw − 2×7vw padding) ÷ Albert Sans Bold ratio */
  font-size: calc(86vw / 4.48);
  font-weight: 700;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: hidden;
}
