/* ====================================================================
   Font Feature Freezer — design system
   Zinc palette base · Violet accent · Dark default · Light toggle
   ==================================================================== */

/* ─── Tokens ─── */
:root {
  --bg-0: #ffffff;
  --bg-1: #fafafa;
  --bg-2: #f4f4f5;
  --border: #e4e4e7;
  --border-hi: #d4d4d8;
  --tx-0: #18181b;
  --tx-1: #52525b;
  --tx-2: #a1a1aa;
  --acc: #8b5cf6;
  --acc-hi: #7c3aed;
  --acc-lo: #a78bfa;
  --acc-bg: #f5f3ff;
  --warn: #f59e0b;
  --err: #ef4444;
  --ok: #10b981;
  --radius: 6px;
  --radius-lg: 8px;
  --trans: .15s ease;
}

.dark-mode {
  --bg-0: #09090b;
  --bg-1: #18181b;
  --bg-2: #27272a;
  --border: #27272a;
  --border-hi: #3f3f46;
  --tx-0: #fafafa;
  --tx-1: #a1a1aa;
  --tx-2: #71717a;
  --acc: #a78bfa;
  --acc-hi: #8b5cf6;
  --acc-lo: #c4b5fd;
  --acc-bg: #1e1b29;
  --warn: #fbbf24;
  --err: #f87171;
  --ok: #34d399;
}

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

body {
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  background: var(--bg-0);
  color: var(--tx-0);
  height: 100vh;
  overflow: hidden;
  transition: background .2s, color .2s;
  font-size: 13px;
  line-height: 1.5;
}

input,
button,
textarea {
  font-family: inherit
}

/* ─── Selection ─── */
::selection {
  background: var(--acc);
  color: #fff;
}

/* ─── Scrollbars (Auto-hiding) ─── */
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color .3s;
}

*:hover {
  scrollbar-color: var(--border-hi) transparent;
}

/* Chrome/Safari/Webkit */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background-color: transparent;
}

::-webkit-scrollbar-track {
  background-color: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0);
  /* Полная прозрачность */
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: background-color .2s;
}

*:hover::-webkit-scrollbar-thumb {
  background-color: var(--border-hi);
  /* Появляется при наведении */
}

*:hover::-webkit-scrollbar-thumb:hover {
  background-color: var(--tx-2);
}

/* ─── Top Bar ─── */
.top-bar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--tx-0)
}

.logo svg {
  color: var(--acc)
}


.top-bar-actions {
  display: flex;
  gap: 12px
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--tx-1);
  transition: var(--trans);
}

.theme-toggle:hover {
  background: var(--bg-2);
  color: var(--tx-0)
}

.dark-mode .icon-sun {
  display: none
}

.dark-mode .icon-moon {
  display: block
}

body:not(.dark-mode) .icon-sun {
  display: block
}

body:not(.dark-mode) .icon-moon {
  display: none
}

/* ─── Layout ─── */
.main-layout {
  display: flex;
  height: calc(100vh - 48px);
  overflow: hidden;
}

.col-left {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.col-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-0);
  overflow: hidden;
}

.col-right {
  width: 320px;
  flex-shrink: 0;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

/* ─── Panels ─── */
.panel {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border)
}

.panel:last-child {
  border-bottom: none
}

.panel-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tx-1);
  margin-bottom: 12px;
}

.panel-hint {
  font-size: 11px;
  color: var(--tx-2);
  margin-bottom: 12px;
  line-height: 1.5
}

/* Panel header with clear button */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px
}

.panel-header .panel-title {
  margin-bottom: 0
}

.btn-clear {
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--tx-2);
  transition: var(--trans);
}

.btn-clear:hover {
  background: var(--err);
  border-color: var(--err);
  color: #fff
}

/* ─── Inputs ─── */
.input-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px
}

.input-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--tx-1)
}

.input-text {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--tx-0);
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  transition: var(--trans);
}

.input-text:focus {
  outline: none;
  border-color: var(--acc);
  background: var(--bg-0)
}

/* ... existing styles ... */

.input-text::placeholder {
  color: var(--tx-2)
}

/* ─── Autocomplete ─── */
.input-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  margin-top: 4px;
}

.autocomplete-list.visible {
  display: block;
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--tx-1);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active,
.autocomplete-item.selected {
  background: var(--acc);
  color: #fff;
}

.btn-secondary {
  padding: 7px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--tx-0);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--trans);
}

.btn-secondary:hover {
  background: var(--bg-1);
  border-color: var(--border-hi);
  color: var(--tx-0)
}

.btn-secondary:active {
  transform: scale(.98)
}

.btn-secondary:disabled {
  opacity: .4;
  cursor: not-allowed
}

/* ─── Divider ─── */
.divider {
  display: flex;
  align-items: center;
  margin: 14px 0;
  color: var(--tx-2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border)
}

.divider span {
  padding: 0 10px
}

/* ─── Upload Zone ─── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-2);
  transition: var(--trans);
}

.upload-zone:hover {
  border-color: var(--acc);
  background: var(--acc-bg)
}

.upload-zone svg {
  color: var(--tx-2);
  margin-bottom: 8px;
  transition: var(--trans)
}

.upload-zone:hover svg {
  color: var(--acc)
}

.upload-primary {
  font-size: 12px;
  font-weight: 500;
  color: var(--tx-0);
  margin-bottom: 2px
}

.upload-secondary {
  font-size: 10px;
  color: var(--tx-2)
}

/* ─── Font Identity ─── */
.font-identity {
  margin-bottom: 10px
}

.font-family-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--tx-0);
  margin-bottom: 2px
}

.font-meta-line {
  font-size: 11px;
  font-family: 'Geist Mono', monospace;
  color: var(--tx-2)
}

/* variant pills */
.variant-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px
}

.vpill {
  padding: 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--tx-1);
  cursor: pointer;
  transition: var(--trans);
}

.vpill:hover {
  border-color: var(--border-hi);
  color: var(--tx-0)
}

.vpill.active {
  background: var(--acc-bg);
  border-color: var(--acc);
  color: var(--acc);
  font-weight: 500
}

/* ─── Notice ─── */
.notice {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: var(--bg-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.notice svg {
  flex-shrink: 0;
  margin-top: 1px
}

.notice-warning svg {
  color: var(--warn)
}

.notice p {
  font-size: 10px;
  line-height: 1.5;
  color: var(--tx-1)
}

/* ─── Preview Toolbar ─── */
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px
}

.ctrl-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--tx-1)
}

.ctrl-value {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--tx-2);
  min-width: 40px
}

/* slider */
.slider {
  width: 100px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-2);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 7px;
  background: var(--acc);
  cursor: pointer;
  transition: .1s;
}

.slider::-webkit-slider-thumb:hover {
  background: var(--acc-hi);
  transform: scale(1.15)
}

.slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 7px;
  background: var(--acc);
  cursor: pointer;
}

/* mode pills */
.mode-pills {
  display: flex;
  background: var(--bg-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden
}

.mode-pill {
  padding: 5px 10px;
  background: transparent;
  border: none;
  color: var(--tx-1);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--trans);
}

.mode-pill+.mode-pill {
  border-left: 1px solid var(--border)
}

.mode-pill:hover {
  background: var(--bg-1);
  color: var(--tx-0)
}

.mode-pill.active {
  background: var(--acc);
  color: #fff
}

/* ─── Preview Live ─── */
.preview-live {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden
}

.preview-textarea {
  flex: 1;
  width: 100%;
  padding: 36px;
  background: transparent;
  border: none;
  color: var(--tx-0);
  font-size: 48px;
  line-height: 1.35;
  resize: none;
  outline: none;
  overflow: auto;
}

.preview-textarea::placeholder {
  color: var(--tx-2)
}

/* ─── Preview Compare ─── */
.preview-compare {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  overflow: auto;
}

.compare-pane {
  padding: 36px;
  overflow: auto
}

.compare-label {
  font-size: 10px;
  font-family: 'Geist Mono', monospace;
  color: var(--tx-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.compare-text {
  font-size: 48px;
  color: var(--tx-0);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word
}

.compare-rule {
  width: 1px;
  background: var(--border)
}

/* ─── Features List ─── */
.features-scroll {
  overflow: visible
}

.empty-state {
  text-align: center;
  padding: 36px 16px
}

.empty-state svg {
  color: var(--tx-2);
  opacity: .45;
  margin-bottom: 12px
}

.empty-state p {
  font-size: 11px;
  color: var(--tx-2)
}

.feat-cat {
  margin-bottom: 16px
}

.feat-cat-title {
  font-size: 10px;
  font-family: 'Geist Mono', monospace;
  color: var(--tx-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.feat-list {
  display: flex;
  flex-direction: column;
  gap: 5px
}

.feat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--trans);
}

.feat-item:hover {
  background: var(--bg-1);
  border-color: var(--border-hi)
}

.feat-item.on {
  background: var(--acc-bg);
  border-color: var(--acc)
}

.feat-info {
  flex: 1;
  min-width: 0
}

.feat-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--tx-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.feat-code {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--tx-2)
}

.feat-item.on .feat-code {
  color: var(--acc)
}

.feat-toggle {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--border-hi);
  position: relative;
  transition: .2s;
  flex-shrink: 0;
}

.feat-item.on .feat-toggle {
  background: var(--acc)
}

.feat-toggle::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 7px;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: .2s;
}

.feat-item.on .feat-toggle::after {
  left: 16px
}

/* ─── Axes Panel ─── */
.instance-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px
}

.preset-pill {
  padding: 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--tx-1);
  cursor: pointer;
  transition: var(--trans);
}

.preset-pill:hover {
  border-color: var(--acc-lo);
  color: var(--acc)
}

.preset-pill.active {
  background: var(--acc-bg);
  border-color: var(--acc);
  color: var(--acc);
  font-weight: 500
}

.axis-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px
}

.axis-row {
  display: flex;
  flex-direction: column;
  gap: 4px
}

.axis-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between
}

.axis-tag {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--acc);
  font-weight: 600
}

.axis-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--tx-0)
}

.axis-value {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--tx-1)
}

.axis-desc {
  font-size: 10px;
  color: var(--tx-2);
  line-height: 1.4
}

.axis-slider-row {
  display: flex;
  align-items: center;
  gap: 8px
}

.axis-slider-row .slider {
  width: 100%;
  flex: 1
}

.axis-bounds {
  display: flex;
  justify-content: space-between;
  margin-top: 1px
}

.axis-bounds span {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  color: var(--tx-2)
}

/* ─── Download Panel ─── */
.download-panel {
  border-top: 2px solid var(--border)
}

.freeze-summary {
  margin-bottom: 12px
}

.summary-label {
  font-size: 10px;
  color: var(--tx-2);
  margin-bottom: 4px;
  margin-top: 8px
}

.summary-label:first-child {
  margin-top: 0
}

.summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px
}

.stag {
  padding: 3px 7px;
  background: var(--acc-bg);
  border: 1px solid var(--acc);
  border-radius: 4px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--acc);
  font-weight: 500;
}

.tag-none {
  font-size: 10px;
  color: var(--tx-2);
  font-style: italic
}

.download-btns {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--acc);
  border: 1px solid var(--acc);
  border-radius: var(--radius);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--trans);
}

.btn-download:hover {
  background: var(--acc-hi);
  border-color: var(--acc-hi)
}

.btn-download:active {
  transform: scale(.98)
}

.btn-download:disabled {
  opacity: .4;
  cursor: not-allowed
}

/* ─── Status bar ─── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg-2);
  border-radius: var(--radius);
  margin-top: 10px;
  font-size: 11px;
  color: var(--tx-1);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ─── Scrollbars ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-track {
  background: var(--bg-1)
}

::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
  background: var(--tx-2)
}

/* ─── Responsive ─── */
@media(max-width:1100px) {
  .col-right {
    width: 280px
  }
}

@media(max-width:860px) {
  .main-layout {
    flex-direction: column
  }

  .col-left,
  .col-right {
    width: 100%;
    max-height: 280px;
    border: none;
    border-bottom: 1px solid var(--border)
  }
}

/* ─── Header Download Split Button ─── */
.header-download {
  display: flex;
  align-items: center;
  margin-right: 0;
  /* Handled by parent gap */
  background: var(--acc);
  border-radius: var(--radius);
  padding: 0;
  height: 32px;
  position: relative;
  /* Anchor for dropdown */
}

.btn-primary {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 0 16px;
  height: 100%;
  cursor: pointer;
  border-radius: var(--radius) 0 0 var(--radius);
  /* Rounded left */
  transition: var(--trans);
}

.btn-primary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.dropdown-wrapper {
  position: relative;
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-icon {
  background: transparent;
  border: none;
  color: #fff;
  width: 32px;
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
  /* Rounded right */
  transition: var(--trans);
}

/* ... */
.btn-icon:hover,
.btn-icon.active {
  background: rgba(255, 255, 255, 0.2);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Toasts ─── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

.toast {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--tx-0);
  padding: 10px 16px;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn .25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
}

.toast.error {
  border-color: var(--warn);
  color: var(--warn);
}

.toast-success {
  color: var(--acc);
  border-color: var(--acc);
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 160px;
  padding: 4px;
  display: none;
  z-index: 100;
}

.dropdown-menu.show {
  display: flex;
  flex-direction: column;
}

.menu-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--tx-0);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--trans);
}

.menu-item:hover {
  background: var(--bg-2);
  color: var(--acc);
}

/* ─── Mobile Fixes ─── */
@media (max-width: 800px) {

  /* Fix layout stacking */
  .main-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
    /* Let body scroll */
  }

  body {
    height: auto;
    overflow-y: auto;
  }

  .col-left,
  .col-center,
  .col-right {
    width: 100%;
    flex: none;
    height: auto;
    overflow: visible;
    border: none;
    border-bottom: 1px solid var(--border);
  }

  /* Make preview stick or at least reasonably sized */
  .col-center {
    min-height: 50vh;
  }

  /* Top bar adjustments */
  .top-bar {
    padding: 0 12px;
  }

  .header-download {
    margin-right: 8px;
  }

  .btn-primary {
    font-size: 11px;
    padding: 0 8px;
  }

  /* Fix modal/dropdown z-index */
  .top-bar {
    position: sticky;
    top: 0;
  }
}