/*
 * Noto Emoji — Minimalist Monochromatic & Friendly Rounded Stylesheet
 * Inspired by https://googlefonts.github.io/noto-emoji-animation/
 * Zero container borders on grid items, floating rounded side panel, monochromatic palette.
 * Includes CSS Sprite Slicing + content-visibility + Full WAI-ARIA Accessibility.
 */

@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;600&family=Google+Sans+Mono:wght@400;500&display=swap');

:root {
  /* Light Theme — Minimalist Monochromatic */
  --bg-page: #f8f8f9;
  --bg-surface: #ffffff;
  --bg-surface-soft: #f1f2f4;
  --bg-surface-hover: #eaebee;
  --text-primary: #111111;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  --accent-bg: #111111;
  --accent-hover-bg: #262626;
  --accent-text: #ffffff;
  --shadow-float: 0 16px 48px rgba(0, 0, 0, 0.10), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-subtle: 0 2px 10px rgba(0, 0, 0, 0.04);

  --font-sans: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Google Sans Mono', monospace;

  --drawer-width: 440px;
}

[data-theme="dark"] {
  --bg-page: #111214;
  --bg-surface: #1b1c1f;
  --bg-surface-soft: #25272b;
  --bg-surface-hover: #2f3237;
  --text-primary: #f3f4f6;
  --text-secondary: #9aa0a6;
  --text-muted: #6e7378;
  --accent-bg: #ffffff;
  --accent-hover-bg: #e5e7eb;
  --accent-text: #111111;
  --shadow-float: 0 20px 56px rgba(0, 0, 0, 0.48), 0 4px 18px rgba(0, 0, 0, 0.30);
  --shadow-subtle: 0 2px 10px rgba(0, 0, 0, 0.25);
}

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

html, body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Visually hidden for Screen Reader Announcements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* High-Contrast Keyboard Focus Ring */
button:focus-visible,
input:focus-visible,
article:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px 12px;
  max-width: 1100px;
  margin: 0 auto;
}

.brand-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-logo-webp {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-nav-pills {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-soft);
  border-radius: 9999px;
  padding: 4px;
  gap: 2px;
}

.header-nav-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.header-nav-btn:hover {
  color: var(--text-primary);
}

.header-nav-btn.active {
  background: var(--accent-bg);
  color: var(--accent-text);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: none;
  background: var(--bg-surface-soft);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-surface-hover);
  transform: scale(1.04);
}

/* Sticky Search & Filter Toolbar */
.toolbar-sticky {
  position: sticky;
  top: 0;
  z-index: 80;
  background: color-mix(in srgb, var(--bg-page) 86%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 12px 0 16px;
}

.toolbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Search Bar */
.search-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  display: flex;
}

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 48px;
  border-radius: 9999px;
  border: none;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  box-shadow: var(--shadow-subtle);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-surface-soft);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  display: none;
  align-items: center;
  justify-content: center;
}

.search-clear-btn .material-symbols-outlined {
  font-size: 16px;
}

.search-clear-btn.visible {
  display: inline-flex;
}

.search-clear-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* Monochromatic Category Pills Row (Wraps cleanly across lines) */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
}

.cat-pill {
  border: none;
  background: var(--bg-surface-soft);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 18px;
  height: 40px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cat-pill--icon {
  width: 44px;
  padding: 0;
}

.cat-pill-icon {
  font-size: 21px;
  line-height: 1;
  pointer-events: none;
}

.cat-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.cat-pill.active {
  background: var(--accent-bg);
  color: var(--accent-text);
  font-weight: 500;
}

/* Reserve right space on body when drawer is open so the 1100px content column stays centered */
body.drawer-open {
  padding-right: calc(var(--drawer-width) + 56px);
}

/* Main Workspace Layout - Centered 1100px max-width paired with GPU FLIP spring transitions */
.workspace-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 40px 96px;
}

/* Category Section with 4px paint-box safety margin */
.category-section {
  padding: 4px;
  margin: -4px -4px 40px -4px;
}

.grid-scroll-sentinel {
  width: 100%;
  height: 1px;
  pointer-events: none;
}

.category-header {
  margin-bottom: 18px;
}

.category-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Borderless Friendly Emoji Grid (CSS Sprite Slicing + GPU FLIP Spring Animations) */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
  padding: 2px;
}

.emoji-card {
  position: relative;
  border: none;
  background: transparent;
  border-radius: 24px;
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  backface-visibility: hidden;
  transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.emoji-card.flip-inverting {
  transition: none !important;
  will-change: transform;
}

.emoji-card:hover {
  background: var(--bg-surface);
  box-shadow: var(--shadow-subtle);
  transform: translateY(-2px);
}

.emoji-card.selected {
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 2px var(--text-primary);
}

/* Easter Egg 1: Custom SVG Category Cursors */
.category-section[data-category="Animals & Nature"] .emoji-card {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><g fill='%231f1f1f' stroke='%23ffffff' stroke-width='1.5'><ellipse cx='16' cy='21' rx='6.5' ry='5.5'/><circle cx='8.5' cy='14' r='3'/><circle cx='13.5' cy='10.5' r='3'/><circle cx='18.5' cy='10.5' r='3'/><circle cx='23.5' cy='14' r='3'/></g></svg>") 16 16, pointer;
}

.category-section[data-category="Food & Drink"] .emoji-card {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><g fill='%231f1f1f' stroke='%23ffffff' stroke-width='1.2'><path d='M11 6v8c0 1.66 1.34 3 3 3v9h2v-9c1.66 0 3-1.34 3-3V6h-2v6h-1V6h-2v6h-1V6h-2z'/></g></svg>") 15 15, pointer;
}

.category-section[data-category="Travel & Places"] .emoji-card {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><path d='M6 16l20-9-9 20-3-8-8-3z' fill='%231f1f1f' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round'/></svg>") 16 16, pointer;
}

.category-section[data-category="Activity"] .emoji-card {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><path d='M16 4l3.2 8.8L28 16l-8.8 3.2L16 28l-3.2-8.8L4 16l8.8-3.2z' fill='%231f1f1f' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round'/></svg>") 16 16, pointer;
}

/* Shared GPU Sprite Slicing (16x16 sheet = 1600% background-size) & Progressive CDN Thumbnails */
.emoji-card__img-wrap {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.emoji-card__img-wrap.is-loading {
  background: rgba(0, 0, 0, 0.035);
  animation: emoji-placeholder-pulse 1.4s ease-in-out infinite;
}

[data-theme="dark"] .emoji-card__img-wrap.is-loading {
  background: rgba(255, 255, 255, 0.055);
}

@keyframes emoji-placeholder-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.88); }
  50% { opacity: 0.9; transform: scale(0.93); }
}

.emoji-card__sprite,
.emoji-card__img {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.emoji-card__img {
  transition: opacity 0.16s ease, transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.emoji-card__img--loading {
  opacity: 0;
  transform: scale(0.92);
}

.emoji-card__img--loaded {
  opacity: 1;
  transform: scale(1);
}

.emoji-card__sprite {
  background-repeat: no-repeat;
  background-size: 1600% 1600%;
}

.emoji-card__name {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-secondary);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.35;
  max-width: 100%;
}

.emoji-card:hover .emoji-card__name,
.emoji-card.selected .emoji-card__name {
  color: var(--text-primary);
}

/* Floating Rounded Side Drawer (Detail View) */
.side-drawer {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;
  width: var(--drawer-width);
  height: calc(100vh - 48px);
  background: var(--bg-surface);
  border-radius: 32px;
  border: none;
  box-shadow: var(--shadow-float);
  z-index: 95;
  transform: translateX(calc(100% + 48px));
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.drawer-open .side-drawer {
  transform: translateX(0);
}

.drawer-header {
  padding: 22px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.drawer-title-text {
  flex: 1;
  min-width: 0;
}

.drawer-title-text h2 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
  margin: 0;
}

.drawer-codepoint-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.codepoint-chip {
  display: inline-flex;
  align-items: center;
  border: none;
  outline: none;
  background: #e4e7eb;
  color: #1f1f1f;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 11px;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.codepoint-chip:hover {
  background: #d8dce2;
}

.codepoint-chip:active {
  transform: scale(0.96);
}

[data-theme="dark"] .codepoint-chip {
  background: #2c2e33;
  border: none;
  color: #e8eaed;
}

[data-theme="dark"] .codepoint-chip:hover {
  background: #383b42;
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.drawer-body {
  padding: 8px 24px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Grounded Preview Stage with 3D/2D Toggle & Icon-Only Top-Right Download Button */
.preview-stage-card {
  position: relative;
  background: var(--bg-surface-soft);
  border-radius: 26px;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-header-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

/* 3D / 2D Segmented Toggle Group */
.dimension-toggle-group {
  display: inline-flex;
  background: var(--bg-surface);
  border-radius: 9999px;
  padding: 4px;
  gap: 2px;
  box-shadow: var(--shadow-subtle);
}

.dim-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 18px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dim-toggle-btn:hover {
  color: var(--text-primary);
}

.dim-toggle-btn.active {
  background: var(--accent-bg);
  color: var(--accent-text);
}

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

/* Plain Icon-Only Action Buttons (Link & Download) */
.preview-action-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.preview-action-icon-btn:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--text-primary);
  transform: scale(1.04);
}

[data-theme="dark"] .preview-action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Download Dropdown Menu */
.download-menu-wrapper {
  position: relative;
  display: inline-flex;
}

.download-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 90;
  min-width: 196px;
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.12));
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
  display: none;
  flex-direction: column;
  gap: 1px;
}

[data-theme="dark"] .download-dropdown-menu {
  background: #1e1f22;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

.download-dropdown-menu.open {
  display: flex;
}

.download-menu-header {
  padding: 6px 10px 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.download-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.download-menu-item:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .download-menu-item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

.download-menu-item:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.download-menu-item__left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.download-menu-item__badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.download-menu-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.14);
  margin: 6px 4px;
}

[data-theme="dark"] .download-menu-divider {
  background: rgba(255, 255, 255, 0.16);
}

.download-menu-item--all {
  font-weight: 600;
  color: var(--accent-text-solid, #111111);
}

[data-theme="dark"] .download-menu-item--all {
  color: #ffffff;
}

.preview-stage-canvas-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  flex-shrink: 0;
}

/* Calibrated inside 240px stage so 3D (192px * 0.958 = 184px), 2D SVG (207px * 0.890 = 184px), and 2D Gfonts PNG/WebP/GIF (202px * 0.912 = 184px) have the exact same visual diameter */
.preview-stage-canvas-wrap img {
  width: 202px;
  height: 202px;
  object-fit: contain;
}

.preview-stage-canvas-wrap img.preview-img-3d {
  width: 192px;
  height: 192px;
  object-fit: contain;
}

.preview-stage-canvas-wrap img.preview-img-2d-svg {
  width: 207px;
  height: 207px;
  object-fit: contain;
}

.preview-stage-canvas-wrap .lottie-stage {
  width: 202px;
  height: 202px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-stage-canvas-wrap .svg-stage {
  width: 207px;
  height: 207px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.preview-stage-canvas-wrap .svg-stage svg {
  width: 207px;
  height: 207px;
}

/* 3D Loader / Empty State Overlay */
.stage-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-surface-soft);
  border-radius: 20px;
  z-index: 4;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid color-mix(in srgb, var(--text-secondary) 28%, transparent);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* Monochromatic Preview Mode Pills — Fixed Single-Row Height so 3D vs 2D Never Causes Layout Shift */
.preview-mode-pills {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 14px;
  height: 32px;
  min-height: 32px;
  width: 100%;
}

.preview-pill {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.preview-pill:hover {
  background: color-mix(in srgb, var(--text-primary) 7%, transparent);
  color: var(--text-primary);
}

.preview-pill.active {
  background: var(--accent-bg);
  color: var(--accent-text);
  font-weight: 500;
}

/* Section Heading */
.section-heading {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Monochromatic Action Button (High-Contrast Hover Guaranteed) */
.lumi-btn {
  width: 100%;
  border: none;
  background: var(--bg-surface-soft);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.lumi-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.lumi-btn--primary {
  background: var(--accent-bg);
  color: var(--accent-text);
}

.lumi-btn--primary:hover {
  background: var(--accent-hover-bg);
  color: var(--accent-text);
}

.lumi-btn__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lumi-btn__meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.lumi-btn--primary .lumi-btn__meta,
.lumi-btn--primary:hover .lumi-btn__meta {
  color: color-mix(in srgb, var(--accent-text) 82%, transparent);
}

/* Embed Code Section */
.embed-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.embed-box {
  background: var(--bg-surface-soft);
  border-radius: 20px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.embed-box__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.embed-box__label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Icon-Only Luminous Copy Button */
.embed-copy-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.embed-copy-btn .material-symbols-outlined {
  font-size: 16px;
}

.embed-copy-btn:hover {
  background: var(--bg-surface-hover);
  transform: scale(1.06);
}

.embed-box__desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.embed-box__code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border-radius: 10px;
  overflow-x: auto;
  white-space: pre;
  padding: 10px 12px;
  margin-top: 2px;
  scrollbar-width: none;
}

.embed-box__code::-webkit-scrollbar {
  display: none;
}

/* TIFF Preview Placeholder */
.tiff-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  width: 100%;
  height: 100%;
}

.tiff-placeholder-icon {
  font-size: 36px;
  color: var(--text-tertiary, var(--text-secondary));
  opacity: 0.7;
}

.tiff-placeholder-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.tiff-placeholder-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Interactive 3D Modal Overlay */
.lumi-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lumi-modal-backdrop.open {
  display: flex;
}

.lumi-modal-card {
  width: 100%;
  max-width: 660px;
  background: var(--bg-surface);
  border-radius: 32px;
  box-shadow: var(--shadow-float);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lumi-modal-header {
  padding: 22px 28px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lumi-modal-title-group h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.lumi-modal-stage {
  position: relative;
  height: 440px;
  background: var(--bg-surface-soft);
  margin: 0 24px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lumi-modal-stage model-viewer {
  width: 100%;
  height: 100%;
}

.lumi-modal-footer {
  padding: 18px 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.lumi-modal-footer .lumi-btn {
  width: auto;
  padding: 10px 22px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-secondary);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: var(--accent-bg);
  color: var(--accent-text);
  padding: 10px 22px;
  border-radius: 9999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
  z-index: 400;
}

.toast-container.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Unicode Proposal & History Section */
.drawer-utc-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.utc-card {
  background: var(--bg-surface-soft);
  border-radius: 20px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.utc-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.utc-row + .utc-row {
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--text-primary) 7%, transparent);
}

.utc-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.utc-value {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.utc-proposal-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  margin: 2px -10px -4px -10px;
  border-radius: 12px;
  transition: background-color 0.15s ease;
}

.utc-proposal-link:hover {
  background: var(--bg-surface-hover);
}

.utc-doc-badge {
  font-family: var(--font-mono);
  background: color-mix(in srgb, var(--text-primary) 9%, transparent);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.utc-title-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 400;
}

.utc-ext-icon {
  font-size: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Documentation & FAQ View */
.docs-view-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 40px 96px;
}

.docs-hero {
  margin-bottom: 36px;
}

.docs-title {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.docs-intro {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.docs-faq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.docs-faq-heading {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
}

.docs-expand-btn {
  border: none;
  background: var(--bg-surface-soft);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.docs-expand-btn:hover {
  background: var(--bg-surface-hover);
}

.docs-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.docs-faq-item {
  background: var(--bg-surface);
  border-radius: 20px;
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.docs-faq-question {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.docs-faq-question::-webkit-details-marker {
  display: none;
}

.docs-faq-icon {
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.docs-faq-item[open] .docs-faq-icon {
  transform: rotate(180deg);
}

.docs-faq-answer {
  padding: 0 24px 22px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.docs-faq-answer a {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.docs-faq-answer code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  background: var(--bg-surface-soft);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 6px;
}

@media (max-width: 960px) {
  .side-drawer {
    inset: 12px;
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }
  body.drawer-open {
    padding-right: 0;
  }
}

/* --- Page Loading Experience (Cute, Minimal, Emoji-Themed) --- */
.page-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 220px);
  padding: 40px 20px 80px;
  text-align: center;
  user-select: none;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0, 0, 1);
  will-change: opacity, transform;
}

.page-loader.fade-out {
  opacity: 0;
  transform: translateY(-10px) scale(0.97);
  pointer-events: none;
}

#grid-sections-container.loading {
  display: none;
}

#grid-sections-container.loaded {
  animation: gridFadeIn 0.35s ease forwards;
}

@keyframes gridFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loader-visual-stage {
  position: relative;
  width: 128px;
  height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.loader-emoji-halo {
  position: absolute;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 0, 0.28) 0%, rgba(255, 180, 0, 0.09) 55%, transparent 70%);
  filter: blur(14px);
  pointer-events: none;
  animation: loaderHaloPulse 2.4s ease-in-out infinite;
  transition: background 0.4s ease;
}

[data-theme="dark"] .loader-emoji-halo {
  background: radial-gradient(circle, rgba(255, 220, 80, 0.35) 0%, rgba(255, 180, 0, 0.14) 55%, transparent 70%);
}

.loader-emoji-bob {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: loaderEmojiBob 2.4s ease-in-out infinite;
  will-change: transform;
}

.loader-emoji-img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loader-emoji-shadow {
  width: 64px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.16) 0%, transparent 72%);
  margin-top: 4px;
  pointer-events: none;
  animation: loaderShadowBob 2.4s ease-in-out infinite;
  will-change: transform, opacity;
}

[data-theme="dark"] .loader-emoji-shadow {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55) 0%, transparent 72%);
}

.loader-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.loader-title-row {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.loader-dots {
  display: inline-flex;
  margin-left: 2px;
}

.loader-dots .dot {
  display: inline-block;
  animation: loaderDotWave 1.4s infinite;
  opacity: 0.35;
}

.loader-dots .dot:nth-child(1) { animation-delay: 0s; }
.loader-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.loader-dots .dot:nth-child(3) { animation-delay: 0.4s; }

.loader-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 8px;
}

.loader-progress-track {
  width: 160px;
  height: 3.5px;
  background: var(--bg-surface-soft);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.loader-progress-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 9999px;
  background: var(--text-primary);
  animation: loaderProgressMove 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Skeleton pill placeholders for category bar */
.cat-pill-skeleton {
  height: 40px;
  width: 44px;
  border-radius: 9999px;
  background: var(--bg-surface-soft);
  animation: loaderSkeletonPulse 1.6s ease-in-out infinite;
}

.cat-pill-skeleton--all {
  width: 64px;
}

/* Keyframe Animations */
@keyframes loaderEmojiBob {
  0%, 100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
  25% {
    transform: translateY(-10px) scale(1.035) rotate(-2.5deg);
  }
  50% {
    transform: translateY(0) scale(0.99) rotate(0deg);
  }
  75% {
    transform: translateY(-5px) scale(1.015) rotate(2deg);
  }
}

@keyframes loaderShadowBob {
  0%, 100% {
    transform: scale(1);
    opacity: 0.24;
  }
  25% {
    transform: scale(0.74);
    opacity: 0.08;
  }
  50% {
    transform: scale(1);
    opacity: 0.24;
  }
  75% {
    transform: scale(0.86);
    opacity: 0.15;
  }
}

@keyframes loaderHaloPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

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

@keyframes loaderProgressMove {
  0% {
    left: -40%;
    width: 30%;
  }
  50% {
    left: 25%;
    width: 50%;
  }
  100% {
    left: 100%;
    width: 30%;
  }
}

@keyframes loaderSkeletonPulse {
  0%, 100% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.95;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader-emoji-bob,
  .loader-emoji-shadow,
  .loader-emoji-halo,
  .loader-dots .dot,
  .cat-pill-skeleton {
    animation: none !important;
  }
  .loader-progress-indicator {
    width: 50%;
    left: 25%;
    animation: none !important;
  }
}

/* ==========================================================================
   RESPONSIVE LAYER
   Everything below only applies at <= 960px. Desktop (>= 961px) is untouched.
   ========================================================================== */

/* --- Tablet / Small Laptop (<= 960px) ------------------------------------ */
@media (max-width: 960px) {
  .app-header {
    padding: 18px 24px 10px;
  }

  .toolbar-inner {
    padding: 0 24px;
  }

  .workspace-layout {
    padding: 16px 24px 88px;
  }

  .docs-view-container {
    padding: 24px 24px 88px;
  }

  /* Drawer becomes a full-bleed floating sheet. The vh value is the fallback;
     dvh (where supported) keeps collapsing mobile browser chrome from
     clipping the bottom of the panel. */
  .side-drawer {
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
  }

  .drawer-body {
    overscroll-behavior: contain;
  }
}

/* --- Phone (<= 600px) ----------------------------------------------------- */
@media (max-width: 600px) {
  /* Header wraps: brand on top, full-width segmented nav + theme below. */
  .app-header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px 8px;
  }

  .brand-title {
    font-size: 17px;
    gap: 8px;
  }

  .brand-logo-webp {
    width: 26px;
    height: 26px;
  }

  .header-actions {
    width: 100%;
    gap: 8px;
  }

  .header-nav-pills {
    flex: 1;
    min-width: 0;
  }

  .header-nav-btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 13px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  /* Toolbar */
  .toolbar-sticky {
    padding: 10px 0 12px;
  }

  .toolbar-inner {
    padding: 0 16px;
    gap: 12px;
  }

  .search-input {
    height: 46px;
    font-size: 16px; /* >=16px stops iOS Safari from zooming on focus */
    padding: 0 42px 0 44px;
  }

  .search-icon {
    left: 16px;
  }

  /* Category filters become one edge-to-edge horizontally scrollable row
     instead of stacking into 2-3 wrapped rows under the sticky toolbar. */
  .category-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px;
    padding: 0 16px 2px;
  }

  .category-pills::-webkit-scrollbar {
    display: none;
  }

  .cat-pill,
  .cat-pill-skeleton {
    flex-shrink: 0;
  }

  /* Grid */
  .workspace-layout {
    padding: 12px 16px 72px;
  }

  .category-section {
    margin-bottom: 28px;
  }

  .category-header {
    margin-bottom: 12px;
  }

  .category-title {
    font-size: 16px;
  }

  .emoji-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
  }

  .emoji-card {
    border-radius: 18px;
    padding: 12px 6px 10px;
    gap: 7px;
  }

  .emoji-card__sprite,
  .emoji-card__img,
  .emoji-card__img-wrap {
    width: 58px;
    height: 58px;
  }

  .emoji-card__name {
    font-size: 11px;
    line-height: 1.3;
  }

  /* Detail drawer */
  .side-drawer {
    inset: 8px;
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    border-radius: 24px;
  }

  .drawer-header {
    padding: 16px 16px 12px;
  }

  .drawer-title-text h2 {
    font-size: 17px;
  }

  .drawer-body {
    padding: 8px 16px 24px;
    gap: 16px;
  }

  .preview-stage-card {
    padding: 14px 14px 16px;
    border-radius: 22px;
  }

  /* Preview stage was a hard 240px square; make it fluid so it can never
     overflow a narrow drawer, while keeping the desktop proportions. */
  .preview-stage-canvas-wrap {
    width: 100%;
    max-width: 240px;
    height: 216px;
  }

  .preview-stage-canvas-wrap canvas,
  .preview-stage-canvas-wrap img,
  .preview-stage-canvas-wrap img.preview-img-3d,
  .preview-stage-canvas-wrap img.preview-img-2d-svg,
  .preview-stage-canvas-wrap .lottie-stage,
  .preview-stage-canvas-wrap .svg-stage {
    max-width: 100%;
    max-height: 100%;
  }

  .preview-stage-canvas-wrap .svg-stage svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
  }

  .preview-mode-pills {
    gap: 2px;
  }

  .preview-pill {
    font-size: 11.5px;
    padding: 5px 9px;
  }

  .dim-toggle-btn {
    padding: 6px 15px;
  }

  .download-dropdown-menu {
    min-width: 184px;
    max-width: calc(100vw - 64px);
  }

  .embed-box,
  .utc-card {
    border-radius: 18px;
    padding: 12px 14px;
  }

  /* 3D modal */
  .lumi-modal-backdrop {
    padding: 12px;
  }

  .lumi-modal-card {
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 26px;
  }

  .lumi-modal-header {
    padding: 18px 18px 12px;
  }

  .lumi-modal-stage {
    height: min(50vh, 340px);
    height: min(50dvh, 340px);
    margin: 0 16px;
    border-radius: 20px;
  }

  .lumi-modal-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px 18px;
  }

  .modal-hint {
    font-size: 11.5px;
    text-align: center;
  }

  .lumi-modal-footer .lumi-btn {
    width: 100%;
    justify-content: center;
  }

  .lumi-modal-footer .lumi-btn__left {
    justify-content: center;
  }

  /* Documentation */
  .docs-view-container {
    padding: 20px 16px 72px;
  }

  .docs-hero {
    margin-bottom: 26px;
  }

  .docs-title {
    font-size: 26px;
  }

  .docs-intro {
    font-size: 15px;
  }

  .docs-faq-question {
    padding: 16px 18px;
    font-size: 15px;
    gap: 12px;
  }

  .docs-faq-answer {
    padding: 0 18px 18px;
    font-size: 14px;
  }

  /* Loading experience */
  .page-loader {
    min-height: 58vh;
    min-height: 58dvh;
    padding: 28px 16px 56px;
  }

  .loader-visual-stage {
    width: 104px;
    height: 104px;
    margin-bottom: 16px;
  }

  .loader-emoji-img {
    width: 72px;
    height: 72px;
  }

  .loader-emoji-halo {
    width: 94px;
    height: 94px;
  }

  .loader-title-row {
    font-size: 14.5px;
  }

  .loader-subtitle {
    font-size: 12.5px;
  }

  /* Toast must never run past the viewport edge */
  .toast-container {
    max-width: calc(100vw - 32px);
    text-align: center;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

/* --- Small Phone (<= 380px) ---------------------------------------------- */
@media (max-width: 380px) {
  .emoji-grid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 6px;
  }

  .emoji-card__sprite,
  .emoji-card__img,
  .emoji-card__img-wrap {
    width: 52px;
    height: 52px;
  }

  .emoji-card__name {
    font-size: 10.5px;
  }

  .brand-title {
    font-size: 16px;
  }

  .header-nav-btn {
    font-size: 12.5px;
    padding: 8px 8px;
  }

  .preview-pill {
    font-size: 11px;
    padding: 5px 8px;
  }

  .preview-stage-canvas-wrap {
    height: 196px;
  }
}

/* --- Short / Landscape Phones -------------------------------------------- */
@media (max-height: 520px) and (max-width: 960px) {
  .page-loader {
    min-height: 72dvh;
    padding: 16px 16px 24px;
  }

  .lumi-modal-stage {
    height: min(46dvh, 260px);
  }
}

/* --- Touch / Coarse Pointer ---------------------------------------------- */
/* Prevents "sticky hover" states lingering after a tap on touch devices.
   Desktop pointers report hover:hover, so this block never applies there. */
@media (hover: none) {
  .emoji-card:hover {
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .emoji-card.selected:hover {
    background: var(--bg-surface);
    box-shadow: inset 0 0 0 2px var(--text-primary);
  }

  .icon-btn:hover,
  .preview-action-icon-btn:hover,
  .embed-copy-btn:hover {
    transform: none;
  }

  .emoji-card:active {
    transform: scale(0.95);
  }

  button,
  .emoji-card,
  .cat-pill {
    -webkit-tap-highlight-color: transparent;
  }
}


