/* ==========================================================================
   onat.uk - Apple Spatial Design System & Bento Grid
   Inspired by macOS Sequoia, visionOS, and Apple Human Interface Guidelines
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* Core Spatial Palette */
  --bg-app: #090A0D;
  --bg-mesh-1: rgba(10, 132, 255, 0.08);
  --bg-mesh-2: rgba(191, 90, 242, 0.06);
  --bg-mesh-3: rgba(48, 209, 88, 0.05);

  /* Glass Surface Tokens */
  --glass-surface-1: rgba(26, 27, 34, 0.62);
  --glass-surface-2: rgba(36, 38, 48, 0.72);
  --glass-surface-elevated: rgba(45, 48, 62, 0.85);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-border-hover: rgba(255, 255, 255, 0.22);
  --glass-border-active: rgba(255, 255, 255, 0.40);
  --glass-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  --glass-shadow-hover: 0 28px 65px rgba(0, 0, 0, 0.65), 0 0 20px rgba(255, 255, 255, 0.08);

  /* Apple HIG Typography & Text Colors */
  --text-primary: #F5F5F7;
  --text-secondary: #A1A1A6;
  --text-tertiary: #6E6E73;
  --text-inverse: #090A0D;

  /* Tool Accents (HIG Spectrum) */
  --accent-plex: #FF9F0A;       /* Apple Warm Amber */
  --accent-flight: #0A84FF;     /* Apple Sky Blue */
  --accent-bus: #30D158;        /* Apple Emerald Green (TFI) */
  --accent-n8n: #FF453A;        /* Apple Vibrant Coral */
  --accent-ha: #64D2FF;         /* Apple Electric Cyan */
  --accent-puzzle: #BF5AF2;     /* Apple Spatial Purple */
  --accent-fact: #FFD60A;       /* Apple Sunny Yellow */

  /* Spacing & Radii */
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --radius-pill: 9999px;

  /* Transitions */
  --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.18s var(--ease-apple);
  --transition-normal: 0.32s var(--ease-apple);
  --transition-slow: 0.65s var(--ease-apple);
}

/* Light Theme Override (Optional Apple Mode) */
[data-theme="light"] {
  --bg-app: #F5F5F7;
  --bg-mesh-1: rgba(10, 132, 255, 0.05);
  --bg-mesh-2: rgba(191, 90, 242, 0.04);
  --bg-mesh-3: rgba(48, 209, 88, 0.04);
  --glass-surface-1: rgba(255, 255, 255, 0.75);
  --glass-surface-2: rgba(255, 255, 255, 0.88);
  --glass-surface-elevated: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-hover: rgba(0, 0, 0, 0.18);
  --text-primary: #1D1D1F;
  --text-secondary: #515154;
  --text-tertiary: #86868B;
  --glass-shadow: 0 16px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Outfit', 'Inter', sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.45;
  selection-background-color: var(--accent-flight);
  selection-color: #FFFFFF;
}

/* Ambient Spatial Background Mesh */
.spatial-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.spatial-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.8;
  animation: orbDrift 24s infinite alternate ease-in-out;
  will-change: transform;
}

.spatial-orb-1 {
  width: 620px;
  height: 620px;
  top: -150px;
  left: 10%;
  background: radial-gradient(circle, var(--bg-mesh-1) 0%, transparent 70%);
}

.spatial-orb-2 {
  width: 540px;
  height: 540px;
  bottom: -120px;
  right: 15%;
  background: radial-gradient(circle, var(--bg-mesh-2) 0%, transparent 70%);
  animation-duration: 28s;
  animation-delay: -5s;
}

.spatial-orb-3 {
  width: 480px;
  height: 480px;
  top: 40%;
  left: 60%;
  background: radial-gradient(circle, var(--bg-mesh-3) 0%, transparent 70%);
  animation-duration: 32s;
  animation-delay: -11s;
}

@keyframes orbDrift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-40px, 40px, 0) scale(1.15); }
  100% { transform: translate3d(50px, -30px, 0) scale(0.95); }
}

/* Layout Wrapper */
.app-container {
  position: relative;
  z-index: 10;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 64px 32px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ==========================================================================
   Apple Floating Navigation & Status Bar
   ========================================================================== */
.spatial-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--glass-surface-1);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-shadow);
  position: sticky;
  top: 20px;
  z-index: 100;
  transition: all var(--transition-normal);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-monogram {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #1D1D1F 0%, #323236 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.brand-monogram::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, transparent 100%);
  pointer-events: none;
}

.navbar-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  position: relative;
  width: 280px;
}

.search-box input {
  width: 100%;
  padding: 9px 40px 9px 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  transition: all var(--transition-fast);
  outline: none;
}

.search-box input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-flight);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

.search-box input::placeholder {
  color: var(--text-tertiary);
}

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

.search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(48, 209, 88, 0.12);
  border: 1px solid rgba(48, 209, 88, 0.25);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent-bus);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-bus);
  box-shadow: 0 0 8px var(--accent-bus);
  animation: pulseDot 2.2s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

.nav-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: var(--glass-border-hover);
  transform: translateY(-1px);
}

.live-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  white-space: nowrap;
}

/* ==========================================================================
   Hero Greeting & Context Banner
   ========================================================================== */
.hero-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 6px;
}

.hero-greeting {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  line-height: 1.15;
}

.hero-greeting-accent {
  background: linear-gradient(135deg, #FFFFFF 0%, #9999A1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 640px;
  font-weight: 400;
}

/* ==========================================================================
   Daily Inspiration & Mind Section (Fun Fact & Puzzle Bento Row)
   ========================================================================== */
.daily-bento-row {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 24px;
}

.bento-card {
  position: relative;
  background: var(--glass-surface-1);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.bento-card:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow-hover);
  transform: translateY(-2px);
}

/* Ambient Card Highlights */
.bento-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  opacity: 0.6;
}

/* Fun Fact Card */
.fact-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-fact);
}

.eyebrow-icon {
  width: 18px;
  height: 18px;
}

.fact-category-badge {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 214, 10, 0.12);
  color: var(--accent-fact);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(255, 214, 10, 0.25);
}

.fact-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 12px 0 24px 0;
}

.fact-quote {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  min-height: 84px;
  display: flex;
  align-items: center;
}

.fact-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--glass-border);
  padding-top: 18px;
}

.fact-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.action-btn-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.apple-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.apple-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--glass-border-hover);
  transform: translateY(-1px);
}

/* ==========================================================================
   Puzzle of the Day Card - "The Daily Word Vault" (5-Letter Wordle style)
   ========================================================================== */
.puzzle-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.puzzle-eyebrow {
  color: var(--accent-puzzle);
}

.puzzle-streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(191, 90, 242, 0.12);
  border: 1px solid rgba(191, 90, 242, 0.28);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent-puzzle);
}

.puzzle-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  margin-bottom: 18px;
  align-self: flex-start;
}

.puzzle-tab {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.puzzle-tab.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Wordle Grid */
.wordle-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.wordle-row {
  display: flex;
  gap: 8px;
}

.wordle-tile {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.wordle-tile.active {
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.04);
}

.wordle-tile.correct {
  background: var(--accent-bus);
  border-color: var(--accent-bus);
  color: #000000;
  box-shadow: 0 0 16px rgba(48, 209, 88, 0.4);
}

.wordle-tile.present {
  background: var(--accent-plex);
  border-color: var(--accent-plex);
  color: #000000;
  box-shadow: 0 0 16px rgba(255, 159, 10, 0.4);
}

.wordle-tile.absent {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-tertiary);
}

/* Virtual Keyboard Mini */
.mini-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  margin-top: 14px;
}

.kb-row {
  display: flex;
  gap: 5px;
}

.kb-key {
  padding: 8px 10px;
  min-width: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kb-key:hover {
  background: rgba(255, 255, 255, 0.18);
}

.kb-key.wide {
  padding: 8px 14px;
  font-size: 0.74rem;
}

/* ==========================================================================
   Section Title & Command Center Tools Header
   ========================================================================== */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 4px;
}

.section-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

.section-heading {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.grid-filter-btn {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.grid-filter-btn.active, .grid-filter-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: var(--glass-border-hover);
}

/* ==========================================================================
   The Main Tools Bento Grid (5 Core Tools)
   ========================================================================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Top row: 3 columns. Bottom row: 2 wider columns */
.tool-card {
  position: relative;
  background: var(--glass-surface-1);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 30px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 380px;
  transition: all var(--transition-normal);
  overflow: hidden;
  group: true;
}

/* Make n8n and Home Assistant span 1.5 columns on large screens for visual balance */
.tools-grid .tool-card:nth-child(4),
.tools-grid .tool-card:nth-child(5) {
  grid-column: span 1;
}

@media (min-width: 1100px) {
  .tools-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .tools-grid .tool-card:nth-child(1),
  .tools-grid .tool-card:nth-child(2),
  .tools-grid .tool-card:nth-child(3) {
    grid-column: span 2;
  }
  .tools-grid .tool-card:nth-child(4),
  .tools-grid .tool-card:nth-child(5) {
    grid-column: span 3;
  }
}

.tool-card:hover {
  transform: translateY(-4px) scale(1.006);
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow-hover);
}

/* Tool Top Header */
.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}

.tool-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tool-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.16);
  overflow: hidden;
  transition: transform var(--transition-fast);
}

.tool-card:hover .tool-icon-wrapper {
  transform: scale(1.06);
}

.tool-icon-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, transparent 60%);
  pointer-events: none;
}

/* Individual Tool Accent Wrappers */
.icon-plex { background: linear-gradient(135deg, #1E1A14 0%, #352306 100%); color: var(--accent-plex); }
.icon-flight { background: linear-gradient(135deg, #0A1B2E 0%, #06284F 100%); color: var(--accent-flight); }
.icon-bus { background: linear-gradient(135deg, #0C2615 0%, #114B25 100%); color: var(--accent-bus); }
.icon-n8n { background: linear-gradient(135deg, #2B1313 0%, #5C1E1A 100%); color: var(--accent-n8n); }
.icon-ha { background: linear-gradient(135deg, #112630 0%, #16465C 100%); color: var(--accent-ha); }

.tool-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tool-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.tool-tagline {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Top Right Badge / Key Shortcut */
.tool-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.tool-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-online {
  background: rgba(48, 209, 88, 0.12);
  color: var(--accent-bus);
  border: 1px solid rgba(48, 209, 88, 0.26);
}

.badge-active {
  background: rgba(10, 132, 255, 0.12);
  color: var(--accent-flight);
  border: 1px solid rgba(10, 132, 255, 0.26);
}

.badge-automation {
  background: rgba(255, 69, 58, 0.12);
  color: var(--accent-n8n);
  border: 1px solid rgba(255, 69, 58, 0.26);
}

.tool-shortcut-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  padding: 2px 7px;
  border-radius: 6px;
}

/* ==========================================================================
   Live Telemetry & Interactive Visual Canvas / Applets inside each Card
   ========================================================================== */
.tool-canvas-container {
  position: relative;
  flex: 1;
  margin: 22px 0;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  min-height: 160px;
}

/* Plex Visualizer Applet */
.plex-now-playing {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.plex-poster {
  width: 66px;
  height: 98px;
  border-radius: 10px;
  background: linear-gradient(145deg, #E5A00D 0%, #703C00 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.plex-poster::before {
  content: '4K HDR';
  position: absolute;
  bottom: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--accent-plex);
}

.plex-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-plex);
  font-weight: 600;
}

.meta-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.meta-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Equalizer Bars */
.audio-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 22px;
  margin-top: 8px;
}

.eq-bar {
  width: 4px;
  background: var(--accent-plex);
  border-radius: 2px;
  animation: eqPulse 1.2s infinite alternate ease-in-out;
}

.eq-bar:nth-child(1) { height: 60%; animation-delay: 0.1s; }
.eq-bar:nth-child(2) { height: 90%; animation-delay: 0.3s; }
.eq-bar:nth-child(3) { height: 40%; animation-delay: 0.2s; }
.eq-bar:nth-child(4) { height: 100%; animation-delay: 0.5s; }
.eq-bar:nth-child(5) { height: 75%; animation-delay: 0.15s; }
.eq-bar:nth-child(6) { height: 50%; animation-delay: 0.4s; }
.eq-bar:nth-child(7) { height: 85%; animation-delay: 0.25s; }

@keyframes eqPulse {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* Flight Tracker Radar Applet */
.radar-applet {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1px solid rgba(10, 132, 255, 0.3);
  background: radial-gradient(circle, rgba(10, 132, 255, 0.08) 0%, transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(10, 132, 255, 0.22);
}

.radar-ring-1 { width: 100px; height: 100px; }
.radar-ring-2 { width: 50px; height: 50px; }

.radar-sweep {
  position: absolute;
  width: 75px;
  height: 75px;
  top: 0;
  right: 0;
  transform-origin: bottom left;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.5) 0%, transparent 70%);
  border-right: 2px solid var(--accent-flight);
  border-radius: 0 100% 0 0;
  animation: radarRotate 4s linear infinite;
}

@keyframes radarRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.flight-blip {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-flight);
  box-shadow: 0 0 10px var(--accent-flight);
  animation: blipPulse 2s infinite;
}

.blip-1 { top: 28%; left: 62%; }
.blip-2 { bottom: 32%; left: 28%; }
.blip-label {
  position: absolute;
  top: -16px;
  left: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.75);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgba(10, 132, 255, 0.3);
  white-space: nowrap;
}

/* Bus Tracker Applet (TFI Transit Departure Board) */
.transit-board {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.transit-stop {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.transit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(48, 209, 88, 0.08);
  border: 1px solid rgba(48, 209, 88, 0.18);
}

.transit-route {
  display: flex;
  align-items: center;
  gap: 10px;
}

.route-badge {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-bus);
  color: #000000;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.route-dest {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.transit-time {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--accent-bus);
  font-size: 0.9rem;
  animation: pulseDot 2s infinite;
}

/* n8n Workflow Automation Applet */
.workflow-graph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
}

.wf-node {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 69, 58, 0.12);
  border: 1.5px solid var(--accent-n8n);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  box-shadow: 0 0 16px rgba(255, 69, 58, 0.25);
  position: relative;
}

.wf-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-n8n), rgba(255, 69, 58, 0.3));
  position: relative;
  overflow: hidden;
}

.wf-packet {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 0 8px #FFFFFF;
  top: -4px;
  animation: packetMove 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes packetMove {
  0% { left: 0%; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { left: 95%; opacity: 0; }
}

/* Home Assistant Smart Home Applet */
.ha-telemetry-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.telemetry-tile {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.telemetry-tile.active {
  background: rgba(100, 210, 255, 0.15);
  border-color: var(--accent-ha);
}

.telemetry-tile:hover {
  background: rgba(255, 255, 255, 0.1);
}

.tile-icon {
  width: 24px;
  height: 24px;
  color: var(--accent-ha);
}

.tile-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tile-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Tool Footer & Action Launch Buttons
   ========================================================================== */
.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  margin-top: auto;
}

.tool-url-preview {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.btn-config {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-config:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  border-color: var(--glass-border-hover);
}

.apple-btn-launch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.apple-btn-launch::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, transparent 100%);
  pointer-events: none;
}

/* Tool Specific Launch Buttons */
.launch-plex { background: var(--accent-plex); color: #000000; }
.launch-plex:hover { background: #FFAC28; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255, 159, 10, 0.45); }

.launch-flight { background: var(--accent-flight); color: #FFFFFF; }
.launch-flight:hover { background: #2895FF; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(10, 132, 255, 0.45); }

.launch-bus { background: var(--accent-bus); color: #000000; }
.launch-bus:hover { background: #46DD6A; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(48, 209, 88, 0.45); }

.launch-n8n { background: var(--accent-n8n); color: #FFFFFF; }
.launch-n8n:hover { background: #FF5E54; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255, 69, 58, 0.45); }

.launch-ha { background: var(--accent-ha); color: #000000; }
.launch-ha:hover { background: #82DCFF; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(100, 210, 255, 0.45); }

/* ==========================================================================
   Spatial Modal / Sheet (URL Customization & Telemetry Inspector)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.apple-sheet {
  background: var(--glass-surface-elevated);
  backdrop-filter: blur(48px) saturate(200%);
  -webkit-backdrop-filter: blur(48px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 520px;
  padding: 32px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  transform: translateY(24px) scale(0.96);
  transition: transform var(--transition-normal);
}

.modal-overlay.open .apple-sheet {
  transform: translateY(0) scale(1);
}

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

.sheet-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sheet-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.sheet-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sheet-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  outline: none;
}

.sheet-input:focus {
  border-color: var(--accent-flight);
}

.sheet-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

/* ==========================================================================
   Footer & Keyboard Command Helper
   ========================================================================== */
.spatial-footer {
  margin-top: 24px;
  padding-top: 32px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-tertiary);
  font-size: 0.84rem;
}

.shortcuts-legend {
  display: flex;
  align-items: center;
  gap: 18px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 980px) {
  .app-container {
    padding: 16px 18px 48px 18px;
    gap: 28px;
  }
  .daily-bento-row {
    grid-template-columns: 1fr;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .tools-grid .tool-card:nth-child(n) {
    grid-column: span 1;
  }
  .hero-greeting {
    font-size: 2.1rem;
  }
  .spatial-navbar {
    flex-wrap: wrap;
    gap: 12px;
  }
  .search-box {
    width: 100%;
    order: 3;
  }
}
