/* ==========================================================================
   YayaTools — Apple macOS / iOS Inspired Design System
   Responsive: Mobile (320px) -> Tablet -> Desktop (1440px+)
   Zero-lag, 100% client-side privacy-first web utilities
   ========================================================================== */

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  --bg:              #f5f5f7;
  --bg-translucent:  rgba(245, 245, 247, 0.88);
  --surface:         #ffffff;
  --surface-raised:  #ffffff;
  --surface-hover:   #f0f0f4;
  --surface-active:  #e5e5ea;
  
  --border:          rgba(0, 0, 0, 0.08);
  --border-subtle:   rgba(0, 0, 0, 0.04);
  --border-focus:    #0071e3;
  
  --text:            #1d1d1f;
  --text-2:          #424245;
  --text-3:          #86868b;
  --text-4:          #aeaeb2;
  
  /* Apple System Tint Gradients */
  --apple-blue:      #0071e3;
  --apple-blue-soft: rgba(0, 113, 227, 0.10);
  --apple-blue-hover:#0077ed;
  
  --apple-orange:    #ff9500;
  --apple-purple:    #af52de;
  --apple-green:     #34c759;
  --apple-indigo:    #5856d6;
  --apple-pink:      #ff2d55;
  --apple-yellow:    #ffcc00;
  
  --radius-xs:       8px;
  --radius-sm:       12px;
  --radius-md:       16px;
  --radius-lg:       20px;
  --radius-pill:     9999px;
  
  --shadow-subtle:   0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-card:     0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 10px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-workspace:0 16px 36px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-dropdown: 0 14px 36px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.05);

  --font-sans:       -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Plus Jakarta Sans", "Helvetica Neue", sans-serif;
  --font-mono:       "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --sidebar-w:       240px;
  --max-w:           1320px;
  --gutter:          18px;
}

[data-theme="dark"] {
  --bg:              #000000;
  --bg-translucent:  rgba(20, 20, 22, 0.88);
  --surface:         #1c1c1e;
  --surface-raised:  #2c2c2e;
  --surface-hover:   #252528;
  --surface-active:  #3a3a3c;
  
  --border:          rgba(255, 255, 255, 0.10);
  --border-subtle:   rgba(255, 255, 255, 0.05);
  --border-focus:    #2997ff;
  
  --text:            #f5f5f7;
  --text-2:          #d1d1d6;
  --text-3:          #86868b;
  --text-4:          #636366;
  
  --apple-blue:      #2997ff;
  --apple-blue-soft: rgba(41, 151, 255, 0.16);
  --apple-blue-hover:#47a3ff;
  
  --shadow-subtle:   0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-card:     0 2px 8px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
  --shadow-card-hover: 0 12px 28px rgba(0, 0, 0, 0.7), 0 0 1px rgba(255, 255, 255, 0.2);
  --shadow-workspace:0 20px 48px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.15);
  --shadow-dropdown: 0 16px 36px rgba(0, 0, 0, 0.9), 0 0 1px rgba(255, 255, 255, 0.2);
}

/* ── Global Reset ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ── macOS Glass Header ──────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-translucent);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle-btn {
  display: none;
}

@media (max-width: 900px) {
  .sidebar-toggle-btn {
    display: inline-flex;
  }
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  cursor: pointer;
}

.brand-icon-app {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0071e3 0%, #43a8ff 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 3px 10px rgba(0, 113, 227, 0.3);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-wrapper:hover .brand-icon-app {
  transform: scale(1.06);
}

.brand-text-col {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}

/* Spotlight Search */
.command-search-wrapper {
  flex: 1;
  max-width: 440px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon-prefix {
  position: absolute;
  left: 12px;
  font-size: 13px;
  color: var(--text-3);
  pointer-events: none;
}

.command-search-box {
  width: 100%;
  height: 36px;
  padding: 0 36px 0 34px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  box-shadow: var(--shadow-subtle);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.command-search-box::placeholder {
  color: var(--text-3);
  font-size: 12.5px;
}

.command-search-box:focus {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3.5px var(--apple-blue-soft);
}

.command-kbd {
  position: absolute;
  right: 10px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-3);
  font-weight: 600;
  pointer-events: none;
  background: var(--surface-hover);
  border-radius: 6px;
  padding: 2px 5px;
  border: 1px solid var(--border);
}

@media (max-width: 600px) {
  .command-kbd { display: none; }
  .header-inner {
    flex-wrap: wrap;
    gap: 10px;
  }
  .command-search-wrapper {
    order: 3;
    max-width: 100%;
    width: 100%;
  }
}

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

.apple-pill-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: all 0.15s ease;
  user-select: none;
}

.apple-pill-btn:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.apple-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: all 0.15s ease;
}

.apple-icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* ── Google Auth Dropdown ────────────────────────────────── */
.auth-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.google-icon-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px 12px 3px 3px;
  cursor: pointer;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-subtle);
  transition: all 0.15s ease;
}

.user-profile-pill:hover {
  background: var(--surface-hover);
  border-color: var(--apple-blue);
}

.user-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--apple-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  padding: 12px;
  z-index: 2000;
  display: none;
  flex-direction: column;
  gap: 6px;
  animation: appleMenuEnter 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-dropdown-menu.show {
  display: flex;
}

@keyframes appleMenuEnter {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-user-header {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2px;
}

.dropdown-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-email {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-item-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.12s ease;
}

.dropdown-item-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.dropdown-item-btn.danger:hover {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
}

/* ── Mobile Horizontal Category Bar (Instant Touch) ─────── */
.mobile-category-bar {
  display: none;
  overflow-x: auto;
  white-space: nowrap;
  padding: 10px var(--gutter);
  gap: 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.mobile-category-bar::-webkit-scrollbar {
  display: none;
}

@media (max-width: 900px) {
  .mobile-category-bar {
    display: flex;
  }
}

.category-chip {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.category-chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: transparent;
}

/* ── App Shell Layout ────────────────────────────────────── */
.app-shell {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 24px var(--gutter) 60px;
  display: flex;
  gap: 28px;
  flex: 1;
}

@media (min-width: 1024px) {
  .app-shell {
    gap: 32px;
  }
}

/* ── Desktop Left Sidebar & Mobile Drawer ────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998;
}

.sidebar-backdrop.open {
  display: block;
}

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 70px;
  height: fit-content;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.sidebar-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    max-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    z-index: 9999;
    box-shadow: var(--shadow-dropdown);
    transition: left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .app-sidebar.open {
    left: 0;
  }

  .sidebar-mobile-header {
    display: flex;
  }
}

.sidebar-section-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  padding: 4px 12px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  width: 100%;
  text-align: left;
}

.sidebar-nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-nav-item.active {
  background: var(--surface);
  color: var(--apple-blue);
  box-shadow: var(--shadow-subtle);
  border-color: var(--border-subtle);
}

.sidebar-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-icon-box.icon-home { background: linear-gradient(135deg, #0071e3, #43a8ff); }
.sidebar-icon-box.icon-all { background: linear-gradient(135deg, #8e8e93, #636366); }
.sidebar-icon-box.icon-fav { background: linear-gradient(135deg, #ffcc00, #ff9500); }
.sidebar-icon-box.icon-text { background: linear-gradient(135deg, #ff9500, #ff5e3a); }
.sidebar-icon-box.icon-image { background: linear-gradient(135deg, #af52de, #ff2d55); }
.sidebar-icon-box.icon-dev { background: linear-gradient(135deg, #007aff, #5856d6); }
.sidebar-icon-box.icon-calc { background: linear-gradient(135deg, #34c759, #30b0c7); }
.sidebar-icon-box.icon-generator { background: linear-gradient(135deg, #5856d6, #af52de); }

.sidebar-count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-4);
  background: var(--surface-hover);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.sidebar-nav-item.active .sidebar-count-badge {
  background: var(--apple-blue-soft);
  color: var(--apple-blue);
}

.sidebar-footer-card {
  margin-top: auto;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-footer-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-footer-desc {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.45;
}

/* ── Main Content Area ───────────────────────────────────── */
.main-content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Home Landing Page View ──────────────────────────────── */
.home-view {
  display: flex;
  flex-direction: column;
  gap: 32px;
  animation: appleWindowEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.home-hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .home-hero-card {
    padding: 40px 36px;
    border-radius: 26px;
  }
}

.home-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--apple-blue);
  background: var(--apple-blue-soft);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  width: fit-content;
}

.home-headline {
  font-size: clamp(24px, 4.2vw, 34px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1.18;
}

.home-subtext {
  font-size: clamp(13.5px, 2.4vw, 15px);
  color: var(--text-3);
  line-height: 1.6;
  max-width: 680px;
}

.home-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.apple-cta-btn {
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  border: none;
}

.apple-cta-btn.primary {
  background: var(--apple-blue);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.35);
}

.apple-cta-btn.primary:hover {
  background: var(--apple-blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 113, 227, 0.45);
}

.apple-cta-btn.secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.apple-cta-btn.secondary:hover {
  background: var(--surface-active);
}

/* Home Value Pillars Grid */
.home-pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.home-pillar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-pillar-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.pillar-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
}

.pillar-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.pillar-desc {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
}

/* Home Section Header */
.home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.home-section-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-view-all-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--apple-blue);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.home-view-all-link:hover {
  text-decoration: underline;
}

/* ── Tools Gallery Grid View ─────────────────────────────── */
.gallery-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.gallery-heading {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-subhead {
  font-size: 12.5px;
  color: var(--text-3);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 14px;
}

@media (min-width: 768px) {
  .tools-grid {
    gap: 16px;
  }
}

/* ── Tool Card (Apple Squircle) ──────────────────────────── */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-card);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  user-select: none;
}

.tool-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(0, 113, 227, 0.3);
}

.tool-card:active {
  transform: translateY(-1px) scale(0.995);
}

.tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tool-icon-squircle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tool-card:hover .tool-icon-squircle {
  transform: scale(1.08) rotate(3deg);
}

.tool-icon-squircle.cat-text {
  background: linear-gradient(135deg, #ff9500 0%, #ff5e3a 100%);
  box-shadow: 0 4px 12px rgba(255, 149, 0, 0.35);
}

.tool-icon-squircle.cat-image {
  background: linear-gradient(135deg, #af52de 0%, #ff2d55 100%);
  box-shadow: 0 4px 12px rgba(175, 82, 222, 0.35);
}

.tool-icon-squircle.cat-dev {
  background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.35);
}

.tool-icon-squircle.cat-calc {
  background: linear-gradient(135deg, #34c759 0%, #30b0c7 100%);
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.35);
}

.tool-icon-squircle.cat-generator {
  background: linear-gradient(135deg, #5856d6 0%, #af52de 100%);
  box-shadow: 0 4px 12px rgba(88, 86, 214, 0.35);
}

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

.star-btn {
  background: transparent;
  border: none;
  color: var(--text-4);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s ease;
}

.star-btn:hover {
  color: var(--apple-yellow);
  transform: scale(1.2);
}

.star-btn.active {
  color: var(--apple-yellow);
}

.tool-badge-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  border: 1px solid var(--border);
}

.tool-title {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.3;
}

.tool-description {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  flex: 1;
}

/* ── Dedicated Tool Studio Workspace View ───────────────── */
.tool-workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px var(--gutter);
  margin-bottom: 24px;
  box-shadow: var(--shadow-workspace);
  animation: appleWindowEnter 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (min-width: 768px) {
  .tool-workspace {
    border-radius: 26px;
    padding: 30px 34px;
  }
}

@keyframes appleWindowEnter {
  from { opacity: 0; transform: translateY(-8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.workspace-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
  flex-wrap: wrap;
}

.back-gallery-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.back-gallery-btn:hover {
  background: var(--surface-active);
  transform: translateX(-3px);
  border-color: var(--text-4);
}

.kbd-hint {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 700;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-header-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

@media (max-width: 580px) {
  .workspace-header-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

.workspace-icon-squircle {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

.workspace-icon-squircle.cat-text {
  background: linear-gradient(135deg, #ff9500 0%, #ff5e3a 100%);
  box-shadow: 0 6px 16px rgba(255, 149, 0, 0.35);
}

.workspace-icon-squircle.cat-image {
  background: linear-gradient(135deg, #af52de 0%, #ff2d55 100%);
  box-shadow: 0 6px 16px rgba(175, 82, 222, 0.35);
}

.workspace-icon-squircle.cat-dev {
  background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
  box-shadow: 0 6px 16px rgba(0, 122, 255, 0.35);
}

.workspace-icon-squircle.cat-calc {
  background: linear-gradient(135deg, #34c759 0%, #30b0c7 100%);
  box-shadow: 0 6px 16px rgba(52, 199, 89, 0.35);
}

.workspace-icon-squircle.cat-generator {
  background: linear-gradient(135deg, #5856d6 0%, #af52de 100%);
  box-shadow: 0 6px 16px rgba(88, 86, 214, 0.35);
}

.workspace-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.workspace-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-heading {
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text);
  line-height: 1.15;
}

.workspace-subheading {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.55;
  max-width: 700px;
}

/* ── Workspace Forms & Inputs ────────────────────────────── */
.io-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

@media (min-width: 640px) {
  .io-grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
}

.panel-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-textarea {
  width: 100%;
  min-height: 170px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: all 0.15s ease;
}

.custom-textarea:focus {
  border-color: var(--apple-blue);
  background: var(--surface);
  box-shadow: 0 0 0 3.5px var(--apple-blue-soft);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.btn-action {
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

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

.btn-action.primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-action.secondary {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}

.btn-action.secondary:hover {
  background: var(--surface-active);
  border-color: var(--text-4);
}

.btn-action.accent {
  background: var(--apple-blue);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 113, 227, 0.3);
}

.btn-action.accent:hover {
  background: var(--apple-blue-hover);
  transform: translateY(-1px);
}

.metrics-strip {
  display: flex;
  align-items: center;
  gap: 12px 18px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.metric-cell {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-cell strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

/* ── Toast Notifications ─────────────────────────────────── */
.toast-shelf {
  position: fixed;
  bottom: 24px;
  right: var(--gutter);
  left: var(--gutter);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

@media (min-width: 600px) {
  .toast-shelf {
    left: auto;
    max-width: 360px;
  }
}

.toast-msg {
  background: rgba(29, 29, 31, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-dropdown);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: appleToastIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  max-width: 100%;
}

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

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 40px var(--gutter) 28px;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 640px) {
  .footer-top {
    grid-template-columns: 1fr auto;
    gap: 36px;
    align-items: flex-start;
  }
}

.footer-brand-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
}

.footer-brand-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-brand-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}

.footer-nav-groups {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
}

.footer-nav-col {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 120px;
}

.footer-nav-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text);
  margin-bottom: 2px;
}

.footer-nav-col a {
  color: var(--text-3);
  text-decoration: none;
  font-size: 12.5px;
  transition: color 0.15s;
}

.footer-nav-col a:hover {
  color: var(--apple-blue);
}

.footer-disclaimer-box {
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.6;
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
  font-size: 12px;
  color: var(--text-4);
}

@media (min-width: 560px) {
  .footer-bottom {
    flex-direction: row;
    align-items: center;
  }
}

/* ── Policy Pages ────────────────────────────────────────── */
.policy-container {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 36px var(--gutter) 72px;
  flex: 1;
}

.policy-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.policy-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--apple-blue);
  background: var(--apple-blue-soft);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}

.policy-title {
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 6px;
}

.policy-updated {
  font-size: 12.5px;
  color: var(--text-3);
}

.policy-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  line-height: 1.75;
  font-size: 14px;
  color: var(--text-2);
}

.policy-content h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-top: 12px;
}

.policy-content h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
}

.policy-content p { color: var(--text-2); }

.policy-content ul, .policy-content ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.policy-card-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 8px 0;
}

/* ── Custom Select & Inputs ──────────────────────────────── */
input[type="text"],
input[type="number"],
input[type="url"],
input[type="email"],
select,
textarea {
  color: var(--text);
  font-family: inherit;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px !important;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface-hover);
  border-radius: 6px;
  padding: 2px 6px;
  border: 1px solid var(--border);
}
