/* ============================================================
   FONT VIEWER — style.css  |  dzn-it.online/fonts
   ============================================================ */

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

:root {
  --black:       #000000;
  --white:       #ffffff;
  --surface:     #0d0d0d;
  --surface2:    #161616;
  --surface3:    #1e1e1e;
  --border:      #222222;
  --border2:     #2a2a2a;
  --muted:       #555555;
  --muted2:      #3a3a3a;
  --text:        #ffffff;
  --text-dim:    #888888;
  --accent:      rgba(255,255,255,0.07);
  --radius-sm:   4px;
  --radius:      8px;
  --sidebar-w:   300px;
  --toolbar-h:   80px;
  --styles-h:    auto;
  --infobar-h:   42px;
  --mono:        'SF Mono','Fira Code','Consolas',monospace;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--black);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  cursor: none !important;
}

/* ── CUSTOM CURSOR ─────────────────────────────────── */
.cursor {
  position: fixed;
  pointer-events: none;
  width: 12px;
  height: 12px;
  background: rgba(255,255,255,0.7);
  border-radius: 50%;
  z-index: 2147483647;
  opacity: 0;
  transform: translate3d(-50%,-50%,0) scale(1);
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275), background 0.3s;
  mix-blend-mode: difference;
  will-change: transform, opacity;
}
.cursor.visible { opacity: 1; }
body.cursor-hover .cursor { transform: translate3d(-50%,-50%,0) scale(4); background: rgba(255,255,255,0.9); }
*, *:hover { cursor: none !important; }

/* ── LAYOUT ───────────────────────────────────────── */
body { display: flex; height: 100vh; }

/* ── SIDEBAR ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.sidebar-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}
.back-link:hover { color: var(--white); }

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  background: var(--border2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.05em;
  flex-shrink: 0;
}

.perm-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.hint-text {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 14px;
}

.load-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: none !important;
  letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s;
}
.load-btn:hover { background: var(--surface3); border-color: #444; }
.load-btn.loading { opacity: 0.5; pointer-events: none; }

.error-msg {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #3f2020;
  border-radius: var(--radius-sm);
  background: #1a0e0e;
  color: #f87171;
  font-size: 11px;
  line-height: 1.6;
}

.search-wrap { padding: 10px 12px 0; flex-shrink: 0; }

.search-box { position: relative; display: flex; align-items: center; }

.search-ico { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }

.search-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 7px 50px 7px 30px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: #444; }

.search-count { position: absolute; right: 8px; font-size: 10px; font-family: var(--mono); color: var(--muted); }

/* Font list */
.font-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.font-list::-webkit-scrollbar { width: 3px; }
.font-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.font-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  cursor: none !important;
  border-left: 2px solid transparent;
  transition: background 0.1s, border-color 0.1s;
  margin: 0 4px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.font-item:hover { background: var(--accent); }
.font-item.active { background: rgba(255,255,255,0.05); border-left-color: rgba(255,255,255,0.4); }

.font-item__name { font-size: 12px; font-weight: 500; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-item.active .font-item__name { color: #aaa; }

.font-item__preview {
  font-size: 24px;
  line-height: 1.1;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.font-item.active .font-item__preview { color: #fff; }

.font-item__count { font-size: 10px; color: var(--muted); font-family: var(--mono); }

.sidebar-footer { padding: 10px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.total-count { font-size: 10px; color: var(--muted); font-family: var(--mono); }

/* ── MAIN ─────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; min-width: 0; }

/* ── TOOLBAR ──────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: stretch;
  height: var(--toolbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }

.tool-sep { width: 1px; background: var(--border); flex-shrink: 0; align-self: stretch; }

.tool-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px;
  justify-content: center;
  flex-shrink: 0;
  min-width: 0;
}
.tool-group--text { flex: 1; min-width: 200px; }

.tool-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}

/* Textarea preview text */
.tool-textarea {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  width: 100%;
  resize: none;
  line-height: 1.4;
  scrollbar-width: none;
  min-height: 0;
  flex: 1;
}
.tool-textarea::-webkit-scrollbar { display: none; }
.tool-textarea::placeholder { color: var(--muted); }

/* Size */
.size-row { display: flex; align-items: center; gap: 8px; }

.size-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 2px;
  background: var(--border2);
  border-radius: 1px;
  outline: none;
  cursor: none !important;
  flex-shrink: 0;
}
.size-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--white);
  cursor: none !important;
  transition: transform 0.1s;
}
.size-range::-webkit-slider-thumb:hover { transform: scale(1.2); }

.size-val { font-size: 11px; font-family: var(--mono); color: var(--text-dim); min-width: 32px; }

/* Color */
.color-row { display: flex; align-items: center; gap: 6px; }

.color-swatch {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border2);
  border-radius: 5px;
  cursor: none !important;
  padding: 2px;
  background: transparent;
  flex-shrink: 0;
}
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; border-radius: 3px; }
.color-swatch::-webkit-color-swatch { border: none; border-radius: 3px; }

.hash { font-size: 12px; color: var(--muted); font-family: var(--mono); line-height: 1; }

.hex-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border2);
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  width: 56px;
  outline: none;
  padding: 1px 0;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
}
.hex-input:focus { border-color: #555; color: var(--white); }

/* Align */
.align-row { display: flex; gap: 3px; }

.align-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: none !important;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.align-btn:hover { color: var(--white); background: var(--accent); }
.align-btn.active { color: var(--white); border-color: var(--border2); background: var(--surface2); }

/* ── PREVIEW ──────────────────────────────────────── */
.preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  transition: background 0.2s;
  padding: 60px 80px;
  position: relative;
  min-height: 0;
}

.preview::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s;
}

.preview.pattern-dots::before {
  opacity: 1;
  background-image: radial-gradient(circle, var(--pattern-color, rgba(255,255,255,0.18)) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}

.preview.pattern-grid::before {
  opacity: 1;
  background-image:
    linear-gradient(var(--pattern-color, rgba(255,255,255,0.1)) 1px, transparent 1px),
    linear-gradient(90deg, var(--pattern-color, rgba(255,255,255,0.1)) 1px, transparent 1px);
  background-size: 28px 28px;
}

.preview-empty,
.preview-text { position: relative; z-index: 1; }

.preview-empty { text-align: center; pointer-events: none; user-select: none; }
.preview-empty-aa { font-size: 120px; font-weight: 900; line-height: 1; letter-spacing: -0.05em; color: #111; margin-bottom: 20px; }
.preview-empty p { font-size: 13px; color: #2a2a2a; line-height: 1.6; }

.preview-text {
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 100%;
  width: 100%;
  transition: color 0.15s;
}

/* ── STYLES BAR ───────────────────────────────────── */
.styles-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  max-height: 100px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.styles-bar::-webkit-scrollbar { width: 3px; }
.styles-bar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.styles-bar__label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.style-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.style-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid var(--border2);
  border-radius: 100px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-family: inherit;
  cursor: none !important;
  white-space: nowrap;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.style-chip:hover { border-color: #555; color: var(--white); background: var(--accent); }
.style-chip.active { border-color: var(--white); color: var(--black); background: var(--white); font-weight: 600; }

/* ── INFO BAR ─────────────────────────────────────── */
.infobar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--infobar-h);
  padding: 0 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.infobar-left { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.info-item { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-item--mono { font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; }
.info-sep { color: var(--muted2); font-size: 11px; }

.designer-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.designer-link:hover { color: var(--white); }

/* ── MOBILE WARNING ───────────────────────────────── */
.mw-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  cursor: auto !important;
}
@media (max-width: 768px) { .mw-overlay { display: flex; } }
.mw-aa { font-size: 80px; font-weight: 900; letter-spacing: -0.05em; color: #1a1a1a; margin-bottom: 24px; line-height: 1; }
.mw-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: #fff; line-height: 1.2; margin-bottom: 12px; }
.mw-sub { font-size: 14px; color: #555; line-height: 1.7; margin-bottom: 36px; max-width: 320px; }
.mw-btns { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.mw-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px; border-radius: 8px; font-family: 'Inter',-apple-system,sans-serif;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  letter-spacing: 0.01em; transition: all 0.15s; border: 1px solid transparent;
}
.mw-btn--white { background: #fff; color: #000; }
.mw-btn--white:hover { background: #ddd; }
.mw-btn--outline { background: transparent; color: #888; border-color: #222; }
.mw-btn--outline:hover { border-color: #555; color: #fff; }
.mw-btn--ghost { background: transparent; color: #333; border: none; font-size: 12px; padding: 8px; }
.mw-btn--ghost:hover { color: #666; }
