/* ==========================================================================
   PiliApp.org V2 - Modern, High-Performance, Mobile-First Stylesheet
   Pure CSS3 - Zero Framework Dependencies
   ========================================================================== */

:root {
  --primary: #8a2387;
  --primary-hover: #731c70;
  --accent-pink: #e94057;
  --accent-orange: #f27121;
  --gradient-brand: linear-gradient(135deg, #8a2387 0%, #e94057 50%, #f27121 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(138, 35, 135, 0.08) 0%, rgba(233, 64, 87, 0.08) 100%);
  
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #e94057;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(233, 64, 87, 0.25);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  --header-height: 64px;
  --container-max: 1160px;
}

/* ==========================================================================
   Dark Theme Color Scheme Variables
   ========================================================================== */
[data-theme="dark"] {
  --bg-page: #0b0f19;
  --bg-surface: #131b2e;
  --bg-subtle: #1c263c;
  --bg-hover: #253350;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --border-color: #222f46;
  --border-focus: #e94057;
  
  --gradient-subtle: linear-gradient(135deg, rgba(233, 64, 87, 0.12) 0%, rgba(138, 35, 135, 0.12) 100%);
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(233, 64, 87, 0.35);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg-page: #0b0f19;
    --bg-surface: #131b2e;
    --bg-subtle: #1c263c;
    --bg-hover: #253350;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    --border-color: #222f46;
    --border-focus: #e94057;
    
    --gradient-subtle: linear-gradient(135deg, rgba(233, 64, 87, 0.12) 0%, rgba(138, 35, 135, 0.12) 100%);
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 25px rgba(233, 64, 87, 0.35);
  }
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-page);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  margin-bottom: 0.75rem;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--accent-pink);
}

/* Layout Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Top Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--gradient-brand);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-logo:hover {
  color: #ffffff;
  opacity: 0.95;
}
.site-logo .kaomoji-icon {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Header Nav for Desktop */
.nav-links {
  display: none;
  align-items: center;
  gap: 0.75rem;
}

.nav-link {
  color: rgba(255, 255, 255, 0.9);
  padding: 0.4rem 0.75rem;
  font-size: 0.925rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.nav-link:hover, .nav-link.active {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.2);
}

/* Header Right Actions (Theme Toggle & Desktop Nav) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform 0.2s ease, background-color 0.2s ease;
  user-select: none;
  flex-shrink: 0;
  padding: 0;
}
.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(20deg) scale(1.08);
}
.theme-toggle-btn:active {
  transform: scale(0.92);
}

/* Hamburger Button */
.menu-toggle-btn {
  background: none;
  border: none;
  color: #ffffff;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 8px;
  transition: background-color 0.15s ease;
}
.menu-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}
.menu-toggle-btn span {
  display: block;
  height: 2.5px;
  width: 24px;
  background-color: #ffffff;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Mobile Slide-Out Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--bg-surface);
  z-index: 1001;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer.active {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem;
  background: var(--gradient-brand);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-header .drawer-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
}
.drawer-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drawer-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.drawer-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.drawer-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
.drawer-section-title:first-child {
  margin-top: 0;
}

.drawer-nav-list {
  list-style: none;
}
.drawer-nav-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.drawer-nav-item a:hover {
  background-color: var(--bg-subtle);
  color: var(--accent-pink);
}
.drawer-nav-item a .item-icon {
  font-size: 1.15rem;
  min-width: 28px;
  width: auto;
  white-space: nowrap;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}


/* Category Quick Bar (Horizontal Scrollable on Mobile) */
.category-quickbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 0;
  position: sticky;
  top: var(--header-height);
  z-index: 90;
}
.quickbar-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.quickbar-scroll::-webkit-scrollbar {
  display: none;
}
.quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.quick-pill:hover, .quick-pill.active {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--accent-pink);
  box-shadow: var(--shadow-sm);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  padding: 1.75rem 0 3rem;
}

/* Hero Section */
.hero-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-brand);
}
.hero-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--gradient-subtle);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
  border: 1px solid rgba(233, 64, 87, 0.2);
}
.hero-lead {
  font-size: 1.1rem;
  max-width: 680px;
  margin: 0 auto 1.5rem;
}

/* Card Grids */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.tool-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(233, 64, 87, 0.4);
}
.tool-card-icon {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
  display: inline-block;
}
.tool-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tool-card-desc {
  font-size: 0.925rem;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 1rem;
}
.tool-card-link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.tool-card-link:hover {
  color: var(--accent-pink);
}

/* Copy Tiles Grid (Lenny Faces, Emojis, Kaomojis) */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 2rem;
}

@media (min-width: 640px) {
  .tiles-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
  }
}

.copy-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}
.copy-tile:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  background-color: #faf5ff;
}
.copy-tile:active {
  transform: scale(0.96);
}
.copy-tile .tile-face {
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.3;
  word-break: break-word;
}
.copy-tile .tile-label {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  text-transform: capitalize;
}

/* Content Box & Article Typography */
.content-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.content-box h2 {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.content-box ul, .content-box ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
}
.content-box li {
  margin-bottom: 0.4rem;
}

/* Floating Toast Notification */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  font-size: 0.925rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.toast-success-icon {
  color: #10b981;
  font-size: 1.1rem;
}
.toast-preview {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Floating Back to Top Button */
#back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--gradient-brand);
  color: #ffffff;
  border: none;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 95;
}
#back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
#back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Footer */
.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 3rem 0 1.5rem;
  margin-top: auto;
  font-size: 0.925rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}
.footer-col h4 {
  color: #ffffff;
  font-size: 1.05rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #334155;
  padding-bottom: 0.35rem;
}
.footer-links {
  list-style: none;
}
.footer-links li {
  margin-bottom: 0.5rem;
}
.footer-links a {
  color: #94a3b8;
  transition: color 0.15s ease;
}
.footer-links a:hover {
  color: #ffffff;
}
.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #64748b;
  font-size: 0.85rem;
  text-align: center;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
  .menu-toggle-btn {
    display: none;
  }
  .footer-bottom {
    flex-direction: row;
  }
}

/* ====================================================
   ADVANCED EMOTICON STUDIO & COMPOSER
   ==================================================== */
/* Compact Category Header (Ultra-slim for mobile-first viewport) */
.compact-category-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}
.compact-category-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-brand);
}
.cch-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}
.cch-symbol {
  font-size: 1.35rem;
  font-weight: 700;
  background: var(--gradient-subtle);
  border: 1px solid rgba(233, 64, 87, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 40px;
  cursor: pointer;
  user-select: all;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.15s ease;
}
.cch-symbol:hover {
  transform: scale(1.04);
  background: rgba(233, 64, 87, 0.15);
}
.cch-text {
  min-width: 0;
}
.cch-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cch-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cch-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.btn-cch-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  background: var(--gradient-brand);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.825rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(233, 64, 87, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-cch-copy:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233, 64, 87, 0.35);
}
.btn-cch-cats {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.825rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-cch-cats:hover {
  background: var(--bg-hover);
  color: var(--primary);
  border-color: var(--accent-pink);
}

/* Universal Button Standards */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1.4;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.btn-primary {
  background: var(--gradient-brand);
  color: #ffffff !important;
  border: 1px solid transparent;
  box-shadow: 0 2px 6px rgba(233, 64, 87, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(233, 64, 87, 0.35);
  opacity: 0.96;
  color: #ffffff !important;
}
.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-surface, #ffffff);
  color: var(--text-dark, #1e293b);
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.btn-secondary:hover {
  background: var(--bg-subtle, #f8fafc);
  border-color: var(--primary, #e94057);
  color: var(--primary, #e94057);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.btn-secondary:active {
  transform: scale(0.98);
}
.btn-secondary.active {
  background: var(--gradient-brand);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(233, 64, 87, 0.25);
}

/* Header actions language switcher & button override */
.header-actions .btn-secondary {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Classic Category Header fallback */
.category-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.category-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-brand);
}
.category-header-top {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
@media (min-width: 640px) {
  .category-header-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
.category-title-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.category-main-symbol {
  font-size: 1.6rem;
  background: var(--gradient-subtle);
  border: 1px solid rgba(233, 64, 87, 0.2);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.8rem;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 48px;
  font-weight: 700;
  user-select: all;
  box-shadow: var(--shadow-sm);
}
.category-title {
  font-size: 1.35rem;
  margin: 0 0 0.2rem 0;
  color: var(--text-main);
  line-height: 1.2;
}
.category-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}
.btn-quick-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: var(--gradient-brand);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(233, 64, 87, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-quick-copy:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(233, 64, 87, 0.35);
}

/* ====================================================
   UNIFIED 1-ROW SMART STUDIO BAR (STICKY COMPACT)
   Combines Instant Filter + Composer Pad + Embedded Clear
   ==================================================== */
.studio-unified-bar {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 60px;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.smart-input-box {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.smart-input-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--text-light);
  pointer-events: none;
}
.smart-input-field {
  width: 100%;
  padding: 0.5rem 1.95rem 0.5rem 2rem;
  font-size: 0.925rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-body);
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.smart-input-field:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: #ffffff;
}
.smart-input-field.composer-flash {
  animation: fieldFlash 0.3s ease;
}
@keyframes fieldFlash {
  0% { background: rgba(233, 64, 87, 0.12); }
  100% { background: var(--bg-body); }
}

/* Embedded '✕' Clear Icon Button */
.smart-input-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  border: none;
  display: none; /* Controlled by JS when input has content */
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}
.smart-input-clear:hover {
  background: #ef4444;
  color: #ffffff;
  transform: translateY(-50%) scale(1.1);
}

.studio-unified-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.btn-studio-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.825rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-studio-copy {
  background: var(--primary);
  color: #ffffff;
}
.btn-studio-copy:hover {
  background: var(--accent-pink);
  box-shadow: 0 2px 8px rgba(233, 64, 87, 0.25);
}
.btn-studio-random {
  background: var(--gradient-subtle);
  border-color: rgba(233, 64, 87, 0.2);
  color: var(--primary);
}
.btn-studio-random:hover {
  background: rgba(233, 64, 87, 0.15);
}
.studio-count-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.6rem;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

/* Fallback for legacy 2-row studio bar if loaded */
.emoticon-studio-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 60px;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.composer-wrap {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.composer-input-field {
  flex: 1;
  font-size: 0.95rem;
  padding: 0.5rem 0.85rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  color: var(--text-main);
  outline: none;
}
.composer-actions {
  display: flex;
  gap: 0.35rem;
}
.btn-studio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.825rem;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-studio-clear {
  background: var(--bg-body);
  border-color: var(--border-color);
  color: var(--text-muted);
}
.btn-studio-clear:hover {
  color: #ef4444;
  border-color: #ef4444;
}
.studio-search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}
.studio-search-box {
  position: relative;
  flex: 1;
}
.studio-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.studio-search-input {
  width: 100%;
  padding: 0.45rem 0.85rem 0.45rem 2rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-body);
  outline: none;
}
.studio-count-badge {
  font-size: 0.775rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  background: var(--gradient-subtle);
  color: var(--primary);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

@media (max-width: 540px) {
  .compact-category-header {
    padding: 0.5rem 0.65rem;
  }
  .cch-title {
    font-size: 1.05rem;
  }
  .btn-cch-copy .btn-text-extra {
    display: none;
  }
  .btn-studio-action .action-text {
    display: none;
  }
  .btn-studio-action {
    padding: 0.45rem 0.55rem;
    font-size: 0.9rem;
  }
  .studio-count-pill {
    display: none;
  }
  .main-wrapper {
    padding: 0.65rem 0 2rem;
  }
}

/* Clicked Tile Feedback Badge */
.tile-copied-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #10b981;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
  animation: popBadge 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 5;
}
@keyframes popBadge {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Section Dividers in Master Pages */
.collection-section {
  margin-bottom: 2.5rem;
}
.section-anchor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}
.section-anchor-header h2 {
  font-size: 1.35rem;
  margin: 0;
  color: var(--text-main);
}
.section-anchor-header .section-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ====================================================
   DARK THEME COMPONENT OVERRIDES
   ==================================================== */
[data-theme="dark"] .site-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .studio-unified-bar {
  background: rgba(19, 27, 46, 0.94);
  border-color: #222f46;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .smart-input-field {
  background: #0b0f19;
  color: #f8fafc;
  border-color: #222f46;
}
[data-theme="dark"] .smart-input-field:focus {
  background: #131b2e;
  border-color: var(--accent-pink);
}
[data-theme="dark"] .smart-input-clear {
  background: #253350;
  color: #cbd5e1;
}
[data-theme="dark"] .smart-input-clear:hover {
  background: #ef4444;
  color: #ffffff;
}
[data-theme="dark"] .studio-count-pill {
  background: #1c263c;
  color: #94a3b8;
  border-color: #222f46;
}
[data-theme="dark"] .btn-studio-random {
  background: rgba(233, 64, 87, 0.15);
  border-color: rgba(233, 64, 87, 0.3);
  color: #f472b6;
}

[data-theme="dark"] .compact-category-header {
  background: var(--bg-surface);
  border-color: var(--border-color);
}
[data-theme="dark"] .cch-symbol {
  background: rgba(233, 64, 87, 0.15);
  border-color: rgba(233, 64, 87, 0.3);
  color: #f472b6;
}
[data-theme="dark"] .btn-cch-cats {
  background: #1c263c;
  border-color: #222f46;
  color: #f8fafc;
}
[data-theme="dark"] .btn-cch-cats:hover {
  background: #253350;
  border-color: var(--accent-pink);
}

[data-theme="dark"] .copy-tile {
  background: var(--bg-surface);
  border-color: var(--border-color);
}
[data-theme="dark"] .copy-tile:hover {
  background: #1c263c;
  border-color: var(--accent-pink);
}

[data-theme="dark"] .drawer {
  background: #131b2e;
}
[data-theme="dark"] .drawer-nav-item a {
  color: #e2e8f0;
}
[data-theme="dark"] .drawer-nav-item a:hover {
  background: #1c263c;
  color: #ffffff;
}

[data-theme="dark"] .site-footer {
  background: #060913;
  border-top: 1px solid #1c263c;
}

[data-theme="dark"] .content-box {
  background: var(--bg-surface);
  border-color: var(--border-color);
}
[data-theme="dark"] .content-box code,
[data-theme="dark"] code {
  background: #1c263c;
  color: #fb7185;
  border: 1px solid #253350;
}
[data-theme="dark"] kbd {
  background: #1c263c;
  color: #f8fafc;
  border: 1px solid #253350;
}

[data-theme="dark"] .tool-card {
  background: var(--bg-surface);
  border-color: var(--border-color);
}
[data-theme="dark"] .tool-card:hover {
  background: #18223a;
  border-color: rgba(233, 64, 87, 0.5);
}

[data-theme="dark"] .font-card {
  background: var(--bg-surface);
  border-color: var(--border-color);
}
[data-theme="dark"] .font-card:hover {
  background: #1c263c;
  border-color: var(--accent-pink);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .generator-input,
[data-theme="dark"] .calc-result-box,
[data-theme="dark"] .password-display-box,
[data-theme="dark"] .timer-display-box,
[data-theme="dark"] .stopwatch-display,
[data-theme="dark"] .search-input {
  background: #0b0f19;
  border-color: var(--border-color);
  color: var(--text-main);
}
[data-theme="dark"] .calc-result-value {
  color: #f472b6;
}

[data-theme="dark"] .quick-pill {
  background: #1c263c;
  color: #e2e8f0;
  border-color: #222f46;
}
[data-theme="dark"] .quick-pill:hover,
[data-theme="dark"] .quick-pill.active {
  background: #253350;
  color: #f472b6;
  border-color: var(--accent-pink);
}

[data-theme="dark"] .btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .btn-secondary.active {
  background: var(--gradient-brand);
  color: #ffffff !important;
  border-color: transparent;
}
[data-theme="dark"] .header-actions .btn-secondary {
  background: #18223a;
  color: #e2e8f0;
  border-color: #253350;
}
[data-theme="dark"] .header-actions .btn-secondary:hover {
  background: #1c263c;
  color: #fb7185;
  border-color: var(--accent-pink);
}

