/* ===========================================================================
   Fonty v2.1 -- Design System
   =========================================================================== */

:root {
  --bg0:     #0b0b0e;
  --bg1:     #111115;
  --bg2:     #18181d;
  --bg3:     #202028;
  --bg4:     #282833;
  --bg5:     #32323f;

  --border:  #2a2a36;
  --border2: #38384a;

  --text0:   #eeeef5;
  --text1:   #a8a8c0;
  --text2:   #6a6a84;
  --text3:   #42425a;

  --accent:       #7b6cf6;
  --accent-hover: #8f82f8;
  --accent-dim:   rgba(123, 108, 246, 0.14);
  --accent-dimmer:rgba(123, 108, 246, 0.07);

  --green:  #3ec98a;
  --yellow: #e8a234;
  --red:    #e05757;

  --font-ui:   -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Cascadia Code', 'Fira Code', ui-monospace, monospace;
  --font-logo: 'Syne', var(--font-ui);

  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;

  --sidebar-w: 216px;
  --topbar-h:  44px;
  --statusbar-h: 26px;
}
/* ===========================================================================
   Animation System
   =========================================================================== */

:root {
  --dur-fast:    120ms;
  --dur-normal:  200ms;
  --dur-slow:    320ms;
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-snap:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}



/* ===========================================================================
   Reset
   =========================================================================== */

/*
 * Critical: author CSS display:flex/grid rules override the browser's built-in
 * [hidden] { display:none } rule (UA styles lose to author styles).
 * This one declaration fixes every hidden-vs-display conflict in one shot.
 */
[hidden] { display: none !important; }

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg0);
  color: var(--text0);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Font detail panel - layout managed here, not inline HTML */
#font-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn var(--dur-normal) var(--ease-out);
}

/* ===========================================================================
   App shell
   =========================================================================== */

.app-shell {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--statusbar-h);
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas:
    "topbar  topbar"
    "sidebar main"
    "status  status";
  height: 100vh;
  height: 100dvh;
}

/* Electron custom titlebar pushes everything down */
body.has-titlebar .app-shell {
  grid-template-rows: 32px var(--topbar-h) 1fr var(--statusbar-h);
  grid-template-areas:
    "titlebar titlebar"
    "topbar   topbar"
    "sidebar  main"
    "status   status";
}

/* macOS hiddenInset: traffic lights (78px wide) sit inside the window content.
   Offset the brand area so the logo doesn't render underneath them. */
body.platform-mac .topbar-brand {
  padding-left: 80px;
}

/* ===========================================================================
   Custom Titlebar (Electron Win/Linux only)
   =========================================================================== */

.titlebar {
  display: none;
  grid-area: titlebar;
  align-items: center;
  height: 32px;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
  user-select: none;
  z-index: 200;
}
.titlebar.visible { display: flex; }

.titlebar-drag {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 14px;
}
.titlebar-logo {
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: 12px;
  color: var(--text2);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.titlebar-controls {
  display: flex;
  -webkit-app-region: no-drag;
}
.tb-btn {
  width: 44px; height: 32px;
  background: transparent; border: none; cursor: pointer;
  color: var(--text1); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.tb-btn:hover { background: rgba(255,255,255,.06); }
.tb-cls:hover { background: #c42b1c; color: #fff; }

/* ===========================================================================
   Topbar
   =========================================================================== */

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 16px 0 0;
  padding-right: max(16px, env(safe-area-inset-right));
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: var(--sidebar-w);
  padding: 0 14px;
  border-right: 1px solid var(--border);
  height: 100%;
  flex-shrink: 0;
}

.logo-lockup {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

/* Logo mark: two overlapping rounded rectangles forming an "F" glyph shape */
.logo-mark {
  position: relative;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.logo-mark svg {
  display: block;
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 1px 6px rgba(123, 108, 246, .45));
  transition: filter var(--dur-normal), transform var(--dur-normal) var(--ease-spring);
}
.logo-lockup:hover .logo-mark svg {
  filter: drop-shadow(0 2px 10px rgba(123, 108, 246, .65));
  transform: rotate(-6deg) scale(1.08);
}

.logo {
  font-family: var(--font-logo);
  font-weight: 800;
  font-size: 15px;
  color: var(--text0);
  letter-spacing: -.01em;
  line-height: 1;
  flex-shrink: 0;
}

/* Version badge - separated from the lockup with its own margin */
.logo-version {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: .06em;
  flex-shrink: 0;
  /* deliberate gap from the logo-lockup via the parent's gap:10px */
}

.btn-menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--text1);
  cursor: pointer;
  border-radius: var(--radius);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-menu:hover { background: var(--bg3); color: var(--text0); }
.btn-menu:active { background: var(--bg4); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===========================================================================
   Buttons
   =========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast), opacity var(--dur-fast), transform var(--dur-fast);
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: .38; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(123,108,246,.3); }
.btn-primary:active { transform: scale(0.97) translateY(0); box-shadow: none; }

.btn-secondary {
  background: var(--bg4);
  color: var(--text0);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--bg5); }

.btn-ghost {
  background: transparent;
  color: var(--text1);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text0); }

.btn-icon {
  width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  background: transparent; border: none; cursor: pointer;
  color: var(--text2); font-size: 14px;
  transition: background 0.12s, color 0.12s;
}
.btn-icon:hover { background: var(--bg3); color: var(--text0); }

.btn-sm { height: 26px; padding: 0 9px; font-size: 11px; }

.btn-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  height: 24px;
  padding: 0 8px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  color: var(--text1);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.btn-copy:hover { background: var(--bg5); color: var(--text0); }
.btn-copy.copied { color: var(--green); border-color: var(--green); }

/* ===========================================================================
   Form controls
   =========================================================================== */

.input {
  height: 30px;
  padding: 0 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text0);
  font-size: 12px;
  outline: none;
  transition: border-color 0.12s;
  width: 100%;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(123,108,246,.15); }
.input::placeholder { color: var(--text3); }

.input-mono { font-family: var(--font-mono); }

.input-sm { height: 26px; font-size: 11px; padding: 0 8px; }

.input-number { width: 64px; text-align: right; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236a6a84'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

textarea.input {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
}

/* ===========================================================================
   Sidebar
   =========================================================================== */

.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  background: var(--bg1);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--bg4);
  border-radius: 9px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text1);
  margin-left: 6px;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.font-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
  counter-reset: font-item;
}
.font-item {
  counter-increment: font-item;
  animation: fadeUp var(--dur-normal) var(--ease-out) both;
  animation-delay: calc((counter(font-item) - 1) * 30ms);
}

.font-list::-webkit-scrollbar { width: 4px; }
.font-list::-webkit-scrollbar-track { background: transparent; }
.font-list::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 2px; }

.font-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  user-select: none;
  border-radius: 0;
  transition: background 0.1s;
  position: relative;
}
.font-item:hover { background: var(--bg3); }
.font-item.active {
  background: var(--accent-dim);
  transition: background var(--dur-fast);
}
.font-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.font-item.loading { opacity: .5; }
.font-item.error   { opacity: .6; }

.font-item-glyph {
  width: 34px; height: 34px;
  background: var(--bg3);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  color: var(--text0);
  border: 1px solid var(--border);
}

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

.font-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-item-sub {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.font-item-remove {
  opacity: 0;
  width: 20px; height: 20px;
  background: transparent; border: none; cursor: pointer;
  color: var(--text2); font-size: 12px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.1s, background 0.1s, color 0.1s;
}
.font-item:hover .font-item-remove { opacity: 1; }
.font-item-remove:hover { background: var(--bg5); color: var(--red); }

.fmt-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fmt-ttf,
.fmt-otf   { background: #1a2a4a; color: #6ea8fe; }
.fmt-woff,
.fmt-woff2 { background: #1a3a2a; color: #4fcb8a; }
.fmt-fnt   { background: #2a1a4a; color: #b09eff; }
.fmt-var   { background: #3a2a10; color: #fbbf24; }

/* ===========================================================================
   Drop Zone
   =========================================================================== */

.drop-zone {
  position: fixed;
  inset: 0;
  top: var(--topbar-h);
  bottom: var(--statusbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: var(--bg0);
}
.drop-zone.drag-over::after {
  content: '';
  position: absolute;
  inset: 24px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  pointer-events: none;
  background: var(--accent-dimmer);
}

.drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  pointer-events: none;
}

.drop-icon {
  width: 56px; height: 56px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: var(--text2);
  margin-bottom: 4px;
}

.drop-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text0);
  letter-spacing: -.01em;
}

.drop-sub {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text2);
}

.drop-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: all;
  margin-top: 4px;
}

/* ===========================================================================
   Main content area
   =========================================================================== */

.main-content {
  grid-area: main;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg0);
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text3);
}
.empty-state-icon { font-size: 32px; opacity: .3; }
.empty-state-text { font-size: 13px; }

/* ===========================================================================
   Preview pane
   =========================================================================== */

.preview-pane {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg1);
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-text-input {
  flex: 1;
  height: 32px;
  padding: 0 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text0);
  font-size: 12px;
  outline: none;
}
.preview-text-input:focus { border-color: var(--accent); }
.preview-text-input::placeholder { color: var(--text3); }

.size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.size-slider {
  width: 100px;
  height: 4px;
  appearance: none;
  background: var(--bg4);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.size-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}
.size-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.size-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text1);
  min-width: 36px;
  text-align: right;
}

.metrics-toggle {
  height: 26px; padding: 0 8px;
  font-size: 11px;
}
.metrics-toggle.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); border: 1px solid; }

.preview-display {
  position: relative;
  min-height: 64px;
  display: flex;
  align-items: center;
}

.preview-sample {
  font-size: 64px;
  line-height: 1.1;
  color: var(--text0);
  white-space: nowrap;
  overflow: hidden;
  transition: font-size var(--dur-fast) var(--ease-snap), font-family var(--dur-normal);
  will-change: font-size;
}

/* Metric guide lines */
.metric-lines { position: absolute; inset: 0; pointer-events: none; }
.metric-line {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  opacity: .6;
}
.metric-line-ascender  { background: rgba(100,160,255,.5); }
.metric-line-cap       { background: rgba(100,220,160,.5); }
.metric-line-xheight   { background: rgba(255,200,80,.5);  }
.metric-line-baseline  { background: rgba(246,108,108,.6); }
.metric-line-descender { background: rgba(160,100,255,.5); }

.metric-label {
  position: absolute;
  right: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  transform: translateY(-50%);
  padding: 1px 4px;
  border-radius: 2px;
  color: #fff;
  white-space: nowrap;
}

.preview-waterfall {
  display: flex;
  align-items: baseline;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.preview-waterfall::-webkit-scrollbar { height: 3px; }
.preview-waterfall::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 2px; }

.waterfall-swatch {
  color: var(--text1);
  white-space: nowrap;
  flex-shrink: 0;
  animation: slideInRight var(--dur-normal) var(--ease-out) both;
}

/* Variable axes */
.var-axes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 2px;
  border-top: 1px solid var(--border);
}
.var-axes-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.var-axes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 16px;
}
.var-axis {
  display: grid;
  grid-template-columns: 80px 1fr 44px;
  align-items: center;
  gap: 8px;
}
.var-axis-name {
  font-size: 11px;
  color: var(--text1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.var-axis-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-left: 4px;
}
.var-axis-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  text-align: right;
}

/* ===========================================================================
   Info pane (tabs + content)
   =========================================================================== */

.info-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tabs {
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg1);
  flex-shrink: 0;
}

.tab {
  padding: 10px 14px 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--text1); }
.tab.active { color: var(--text0); border-bottom-color: var(--accent); }

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg5) transparent;
}
.tab-content::-webkit-scrollbar { width: 4px; }
.tab-content::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 2px; }
.tab-content.active { display: flex; flex-direction: column; gap: 16px; animation: fadeUp var(--dur-normal) var(--ease-out) both; }

/* ===========================================================================
   Section headers inside tabs
   =========================================================================== */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text2);
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===========================================================================
   Metadata tab
   =========================================================================== */

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.meta-field { display: flex; flex-direction: column; gap: 4px; }
.meta-field.full { grid-column: 1 / -1; }
.meta-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text2);
}
.meta-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.save-status {
  font-size: 11px;
  color: var(--green);
  font-family: var(--font-mono);
  opacity: 0;
  transition: opacity 0.2s;
}
.save-status.visible { opacity: 1; }

/* ===========================================================================
   Convert tab
   =========================================================================== */

.convert-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.convert-row .input { flex: 1; }

.fnt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px 12px;
}
.fnt-field { display: flex; flex-direction: column; gap: 4px; }
.fnt-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text2);
}

.charset-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.charset-presets { display: flex; flex-wrap: wrap; gap: 5px; }
.preset-btn {
  height: 22px;
  padding: 0 8px;
  font-size: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text1);
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  font-family: var(--font-mono);
}
.preset-btn:hover { background: var(--bg4); color: var(--text0); }
.preset-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.fnt-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 8px 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.fnt-stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}
.fnt-stat-label { color: var(--text2); }
.fnt-stat-value { font-family: var(--font-mono); color: var(--text0); }

.preview-atlas-btn { align-self: flex-start; }

/* File info table */
.info-table {
  width: 100%;
  border-collapse: collapse;
}
.info-table tr { border-bottom: 1px solid var(--border); }
.info-table tr:last-child { border-bottom: none; }
.info-table td {
  padding: 6px 0;
  font-size: 12px;
}
.info-table td:first-child {
  color: var(--text2);
  width: 120px;
  font-size: 11px;
}
.info-table td:last-child {
  font-family: var(--font-mono);
  color: var(--text0);
  font-size: 11px;
}

/* ===========================================================================
   Glyphs tab
   =========================================================================== */

.glyph-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.glyph-count-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text2);
  white-space: nowrap;
}

.glyph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 4px;
}

.glyph-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  aspect-ratio: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
  padding: 4px;
  animation: fadeIn var(--dur-normal) var(--ease-out) both;
}
.glyph-cell:active { transform: scale(0.88); }
.glyph-cell:hover { background: var(--bg3); border-color: var(--border2); }
.glyph-cell:active { background: var(--bg4); }
.glyph-char { font-size: 20px; line-height: 1; color: var(--text0); }
.glyph-code { font-family: var(--font-mono); font-size: 8px; color: var(--text3); }

/* ===========================================================================
   CSS Snippet tab
   =========================================================================== */

.snippet-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.snippet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.snippet-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text2);
}
.snippet-code {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text0);
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
  resize: none;
  outline: none;
  cursor: text;
}
.snippet-code::-webkit-scrollbar { height: 4px; }
.snippet-code::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 2px; }

/* ===========================================================================
   Atlas preview modal
   =========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(2px);
  animation: fadeIn var(--dur-fast) ease;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  animation: scaleIn var(--dur-normal) var(--ease-out) both;
}
.modal-wide { width: 760px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text0);
}
.modal-close {
  width: 28px; height: 28px;
  background: transparent; border: none; cursor: pointer;
  color: var(--text2); font-size: 14px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.modal-close:hover { background: var(--bg4); color: var(--text0); }

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--bg5) transparent;
}
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 2px; }

.modal-desc { font-size: 13px; color: var(--text1); margin-bottom: 16px; }

.modal-row { margin-bottom: 14px; }
.modal-row label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--text2); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.progress-bar {
  height: 4px;
  background: var(--bg4);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--dur-normal) var(--ease-snap);
  width: 0;
}
.progress-label { font-size: 12px; color: var(--text1); font-family: var(--font-mono); }

/* Atlas preview specifics */
.atlas-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.atlas-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text1);
  background: var(--bg3);
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.atlas-pages { display: flex; flex-direction: column; gap: 12px; }
.atlas-page-label { font-size: 11px; color: var(--text2); font-family: var(--font-mono); margin-bottom: 6px; }
.atlas-img {
  display: block;
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #111;
  image-rendering: pixelated;
}

/* ===========================================================================
   Status bar
   =========================================================================== */

.statusbar {
  grid-area: status;
  height: var(--statusbar-h);
  display: flex;
  align-items: center;
  padding: 0 14px;
  padding-left:  max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg1);
  border-top: 1px solid var(--border);
  gap: 16px;
  overflow: hidden;
}

.statusbar-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
}
.statusbar-item .val {
  font-family: var(--font-mono);
  color: var(--text1);
}
.statusbar-sep {
  width: 1px; height: 12px;
  background: var(--border2);
}
.statusbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===========================================================================
   Toasts
   =========================================================================== */

.toast-stack {
  position: fixed;
  bottom: calc(var(--statusbar-h) + 10px);
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text0);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  pointer-events: all;
  animation: toast-in 0.2s ease;
  max-width: 320px;
}
.toast::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.toast.info::before    { background: var(--accent); }
.toast.success::before { background: var(--green); }
.toast.error::before   { background: var(--red); }
.toast.warning::before { background: var(--yellow); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-4px); }
}

/* ===========================================================================
   Glyph tooltip / detail panel
   =========================================================================== */

.glyph-detail {
  position: fixed;
  z-index: 300;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  pointer-events: none;
  min-width: 130px;
}
.glyph-detail-char {
  font-size: 40px;
  text-align: center;
  line-height: 1.2;
  margin-bottom: 6px;
}
.glyph-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
  color: var(--text2);
  font-family: var(--font-mono);
}
.glyph-detail-row span { color: var(--text1); }

/* ===========================================================================
   Scrollbars (global)
   =========================================================================== */

* { scrollbar-width: thin; scrollbar-color: var(--bg5) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 3px; }

/* Statusbar GitHub link */
.statusbar-link {
  font-size: 10px;
  color: var(--text2);
  text-decoration: none;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.statusbar-link:hover { color: var(--accent); background: var(--accent-dimmer); }

.statusbar-sep-v {
  width: 1px; height: 10px;
  background: var(--border2);
  flex-shrink: 0;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 150;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* Skeleton loading state */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
}
.skeleton * { opacity: 0; }

.font-item.loading .font-item-glyph {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  color: transparent;
}
.font-item.loading .font-item-name,
.font-item.loading .font-item-sub {
  border-radius: 3px;
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  color: transparent;
  width: 80%;
  height: 10px;
  display: block;
  margin: 3px 0;
}
.font-item.loading .font-item-sub { width: 50%; }


/* Active font name shown in topbar when fonts are loaded */
.topbar-font-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: fadeIn var(--dur-normal) var(--ease-out);
}

/* Format pill in statusbar */
.status-fmt-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.status-fmt-pill.fmt-ttf,
.status-fmt-pill.fmt-otf   { background: #1a2a4a; color: #6ea8fe; }
.status-fmt-pill.fmt-woff,
.status-fmt-pill.fmt-woff2 { background: #1a3a2a; color: #4fcb8a; }
.status-fmt-pill.fmt-fnt   { background: #2a1a4a; color: #b09eff; }
.status-fmt-pill.fmt-bdf   { background: #2a2a1a; color: #fbbf24; }
.status-fmt-pill.fmt-ttc   { background: #1a2a4a; color: #93c5fd; }
.status-fmt-pill.fmt-eot   { background: #3a1a1a; color: #fca5a5; }
.status-fmt-pill.fmt-svg   { background: #1a3a3a; color: #5eead4; }

/* statusbar sep2 */
#status-sep2 {
  width: 1px; height: 12px;
  background: var(--border2);
  flex-shrink: 0;
}

/* Section badge (used for "WebFNT" label) */
.section-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(123,108,246,.25);
  padding: 2px 6px;
  border-radius: 3px;
}

/* WebFNT preview block */
.webfnt-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.webfnt-input-row .input { flex: 1; }

.webfnt-output {
  min-height: 40px;
  padding: 10px 12px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  animation: fadeIn var(--dur-normal) var(--ease-out);
}
.webfnt-note {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
  margin-top: 8px;
  line-height: 1.5;
  display: none;
}

/* Statusbar version text */
.statusbar-ver {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono);
}


/* =========================================================================
   Mobile - full redesign for touch screens
   =========================================================================
   Strategy:
   - Single-column layout, sidebar is a bottom sheet (more thumb-friendly
     than a left drawer on phones)
   - Tabs become a full-width scrollable pill row
   - Preview pane is collapsible so content gets maximum vertical space
   - All tap targets >= 44px (Apple HIG minimum)
   - Font size and spacing scaled up for legibility at arm's length
   ========================================================================= */

@media (max-width: 760px) {
  :root {
    --topbar-h:    52px;
    --statusbar-h: 36px;
    --sidebar-w:   0px;
  }

  /* ---- Layout ---- */
  /* Use dynamic viewport height so browser chrome doesn't clip header/footer */
  html, body { height: 100%; height: 100dvh; }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr var(--statusbar-h);
    grid-template-areas:
      "topbar"
      "main"
      "status";
    height: 100%;
    height: 100dvh;
    min-height: -webkit-fill-available;
  }
  body.has-titlebar .app-shell {
    grid-template-rows: 32px var(--topbar-h) 1fr var(--statusbar-h);
    grid-template-areas:
      "titlebar"
      "topbar"
      "main"
      "status";
  }

  /* ---- Sidebar: bottom sheet ---- */
  .sidebar {
    position: fixed;
    left: 0; right: 0;
    bottom: -100%;
    top: auto;
    width: 100%;
    height: 72vh;
    max-height: 72vh;
    border-right: none;
    border-top: 1px solid var(--border2);
    border-radius: 16px 16px 0 0;
    z-index: 200;
    transition: bottom 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -12px 48px rgba(0, 0, 0, .55);
    overflow: hidden;
  }
  .sidebar.open { bottom: 0; }
  .sidebar-overlay.visible { display: block; }

  /* Pull handle indicator at top of sheet */
  .sidebar-header::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--bg5);
    border-radius: 2px;
    margin: 0 auto 10px;
  }

  .sidebar-header {
    flex-direction: column;
    gap: 4px;
    padding: 10px 16px 12px;
  }

  .font-item {
    min-height: 56px;
    padding: 10px 16px;
    -webkit-tap-highlight-color: transparent;
  }
  .font-item-glyph { width: 40px; height: 40px; font-size: 18px; }
  .font-item-name  { font-size: 13px; }
  .font-item-sub   { font-size: 11px; }
  .font-item-remove { opacity: 1; width: 28px; height: 28px; font-size: 14px; }

  .sidebar-actions .btn { height: 36px; padding: 0 14px; font-size: 12px; }

  /* ---- Topbar ---- */
  .topbar { padding: 0 10px 0 0; }

  .topbar-brand {
    width: auto;
    flex: 0 0 auto;
    border-right: none;
    padding: 0 4px 0 10px;
    gap: 8px;
  }

  .btn-menu { display: flex; }

  /* Hide the less useful topbar controls on small screens */
  #btn-clear-all,
  #btn-export-all { display: none; }

  .topbar-actions {
    flex: 1;
    justify-content: flex-end;
    gap: 6px;
  }
  .topbar-actions select.input { font-size: 11px; height: 32px; }

  /* ---- Drop zone ---- */
  .drop-zone {
    top: var(--topbar-h);
    padding: 20px;
  }
  .drop-icon   { width: 64px; height: 64px; font-size: 26px; border-radius: 14px; }
  .drop-title  { font-size: 18px; }
  .drop-sub    { font-size: 13px; letter-spacing: 0; }
  .drop-actions .btn { height: 44px; font-size: 14px; padding: 0 24px; }

  /* ---- Font detail: stack preview above tabs ---- */
  #font-detail { flex-direction: column; }

  /* ---- Preview pane ---- */
  .preview-pane {
    padding: 14px 14px 10px;
    gap: 10px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
  }

  .preview-controls {
    gap: 8px;
    flex-wrap: wrap;
  }
  .preview-text-input {
    flex: 1 1 100%;
    height: 40px;
    font-size: 14px;
    order: 0;
  }
  .size-control { order: 1; gap: 10px; }
  .size-slider  { width: 120px; }
  .size-label   { font-size: 12px; }
  #btn-metrics  { order: 2; height: 36px; font-size: 12px; }

  .preview-sample { font-size: 48px !important; }

  /* Waterfall: show fewer sizes, larger gaps */
  .preview-waterfall { gap: 10px; }
  .waterfall-swatch  { font-size: inherit; }

  /* ---- Tabs ---- */
  .tabs {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    display: flex;
    border-bottom: 1px solid var(--border);
  }
  .tabs::-webkit-scrollbar { display: none; }

  .tab {
    flex: 1 0 auto;
    min-width: 70px;
    height: 44px;
    font-size: 13px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ---- Tab content ---- */
  .tab-content { padding: 14px; gap: 14px; }

  /* ---- Meta grid ---- */
  .meta-grid { grid-template-columns: 1fr; gap: 8px; }
  .meta-field.full { grid-column: 1; }
  .input { height: 40px; font-size: 14px; }
  .meta-label { font-size: 11px; }
  .meta-actions { gap: 10px; flex-wrap: wrap; }
  .meta-actions .btn { height: 40px; font-size: 13px; flex: 1 1 auto; }

  /* ---- FNT options ---- */
  .fnt-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .fnt-grid > :nth-child(n+7) { grid-column: span 2; }
  .fnt-label { font-size: 11px; }
  .input-sm  { height: 38px; font-size: 13px; }

  .charset-presets { gap: 6px; }
  .preset-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 11px;
    -webkit-tap-highlight-color: transparent;
  }

  /* ---- Glyphs tab ---- */
  .glyph-bar { gap: 8px; }
  .glyph-bar .input { height: 40px; font-size: 14px; }
  .glyph-grid {
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 5px;
  }
  .glyph-cell { border-radius: 6px; min-height: 58px; }
  .glyph-char { font-size: 22px; }
  .glyph-code { font-size: 9px; }

  /* ---- CSS tab ---- */
  .snippet-block { gap: 6px; }
  .snippet-code  { font-size: 11px; padding: 10px; }
  .btn-copy      { height: 32px; font-size: 11px; padding: 0 10px; }

  /* ---- Info table ---- */
  .info-table td { padding: 7px 0; font-size: 12px; }
  .info-table td:first-child { width: 110px; }

  /* ---- Section headers ---- */
  .section-title { font-size: 10px; }
  .convert-row { flex-wrap: wrap; gap: 8px; }
  .convert-row .input { flex: 1 1 auto; height: 40px; }
  .convert-row .btn { height: 40px; flex: 0 0 auto; min-width: 90px; }

  /* ---- Modals: full-screen on mobile ---- */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal, .modal-wide {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
  }
  .modal-header { padding: 16px 18px 14px; }
  .modal-body   { padding: 14px 18px; }
  .modal-footer { padding: 14px 18px 24px; }
  .modal-footer .btn { height: 44px; flex: 1; }
  .modal-title { font-size: 16px; }

  /* Atlas modal images */
  .atlas-img { image-rendering: auto; }

  /* ---- Statusbar ---- */
  .statusbar {
    padding: 0 12px;
    height: var(--statusbar-h);
    font-size: 11px;
  }
  .statusbar-item { font-size: 11px; }
  .statusbar-item span:not(.val) { display: none; } /* hide labels, keep values */
  .statusbar-item .val { font-size: 11px; }
  .status-fmt-pill { font-size: 9px; }
  .statusbar-right { gap: 8px; }
  .statusbar-ver { display: none; }

  /* ---- Variable axes ---- */
  .var-axes-grid { grid-template-columns: 1fr; }
  .var-axis { grid-template-columns: 90px 1fr 44px; gap: 8px; }
  .var-axis-name { font-size: 12px; }
  .var-axis-value { font-size: 12px; }

  /* ---- Toasts ---- */
  .toast-stack { left: 12px; right: 12px; bottom: calc(var(--statusbar-h) + 8px); }
  .toast { max-width: 100%; font-size: 13px; }
}

/* Extra-small phones */
@media (max-width: 400px) {
  .logo-version { display: none; }
  .topbar-actions select.input { display: none; }
  .fnt-grid { grid-template-columns: 1fr; }
  .glyph-grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
}

/* ===========================================================================
   Desktop animation improvements
   Ensure all transitions are visible at full scale (not just mobile)
   =========================================================================== */

/* Font list: stagger items on load */
.font-item:nth-child(1)  { animation-delay:   0ms; }
.font-item:nth-child(2)  { animation-delay:  30ms; }
.font-item:nth-child(3)  { animation-delay:  60ms; }
.font-item:nth-child(4)  { animation-delay:  90ms; }
.font-item:nth-child(5)  { animation-delay: 120ms; }
.font-item:nth-child(6)  { animation-delay: 150ms; }
.font-item:nth-child(n+7){ animation-delay: 180ms; }

/* Tab content: smooth cross-fade + slight upward motion */
.tab-content {
  animation: none; /* reset, applied via .active */
}
.tab-content.active {
  animation: fadeUp var(--dur-normal) var(--ease-out) both;
}

/* Info pane sections animate in sequence */
.section-block {
  animation: fadeUp var(--dur-normal) var(--ease-out) both;
}
.section-block:nth-child(2) { animation-delay: 40ms; }
.section-block:nth-child(3) { animation-delay: 80ms; }

/* Sidebar bottom sheet on mobile: already handled. On desktop, sidebar slides in */
@media (min-width: 761px) {
  .sidebar {
    animation: slideInLeft var(--dur-slow) var(--ease-out) both;
  }
  @keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
  }
}

/* Preview sample text: transition color, size and font-family smoothly */
.preview-sample {
  transition:
    font-size     var(--dur-fast)   var(--ease-snap),
    font-family   var(--dur-normal) var(--ease-out),
    color         var(--dur-fast),
    letter-spacing var(--dur-fast);
}

/* Waterfall swatches stagger */
.waterfall-swatch:nth-child(1) { animation-delay:  0ms; }
.waterfall-swatch:nth-child(2) { animation-delay: 20ms; }
.waterfall-swatch:nth-child(3) { animation-delay: 40ms; }
.waterfall-swatch:nth-child(4) { animation-delay: 60ms; }
.waterfall-swatch:nth-child(5) { animation-delay: 80ms; }
.waterfall-swatch:nth-child(6) { animation-delay:100ms; }

/* Glyph grid: fade in when populated */
.glyph-grid {
  animation: fadeIn var(--dur-normal) var(--ease-out);
}

/* Meta grid fields stagger */
.meta-field {
  animation: fadeUp var(--dur-normal) var(--ease-out) both;
}
.meta-field:nth-child(2) { animation-delay:  20ms; }
.meta-field:nth-child(3) { animation-delay:  40ms; }
.meta-field:nth-child(4) { animation-delay:  60ms; }
.meta-field:nth-child(5) { animation-delay:  80ms; }
.meta-field:nth-child(n+6) { animation-delay: 100ms; }

/* FNT stats bar animate in */
.fnt-stats-bar {
  animation: scaleIn var(--dur-normal) var(--ease-spring) both;
}

/* WebFNT output text characters */
.webfnt-output span {
  animation: fadeIn var(--dur-fast) var(--ease-out) both;
}

/* Progress bar fill */
.progress-fill {
  transition: width var(--dur-normal) var(--ease-snap);
}

/* Snippet code blocks */
.snippet-code {
  transition: border-color var(--dur-fast);
}
.snippet-code:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dimmer);
}

/* Font item active indicator slide in */
.font-item.active::before {
  animation: scaleInY var(--dur-fast) var(--ease-spring) both;
}
@keyframes scaleInY {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

/* Modal enter: pop up from slightly below */
.modal {
  animation: modalIn var(--dur-normal) var(--ease-spring) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Toast enter */
.toast {
  animation: toastIn var(--dur-normal) var(--ease-spring) both;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* Drop zone drag-over pulse */
.drop-zone.drag-over .drop-icon {
  animation: pulse 0.6s ease infinite;
}

/* Topbar font name slide in */
.topbar-font-name {
  animation: slideInRight var(--dur-normal) var(--ease-out) both;
}

/* Status bar items appear */
.status-fmt-pill,
#status-name,
#status-glyphs,
#status-size {
  animation: fadeIn var(--dur-fast) var(--ease-out) both;
}

