/* ===== Tech Tree — Next-level design ===== */

:root {
  /* Palette: deep space + teal accent (no generic purple) */
  --bg: #06060a;
  --bg-elevated: #0c0c12;
  --surface: #12121a;
  --surface-hover: #1a1a26;
  --border: #252532;
  --border-focus: #2e2e3e;
  --text: #f2f2f7;
  --text-muted: #71717d;
  --text-subtle: #52525b;
  --accent: #14b8a6;
  --accent-dim: rgba(20, 184, 166, 0.2);
  --accent-glow: rgba(20, 184, 166, 0.35);
  --match-bg: rgba(34, 197, 94, 0.12);
  --donate-bg: #003087;
  --donate-hover: #0047ab;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Sora', system-ui, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 24px var(--accent-glow);
  --transition: 0.25s ease;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f4f4f5;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f4f4f5;
  --border: #e4e4e7;
  --border-focus: #d4d4d8;
  --text: #18181b;
  --text-muted: #71717a;
  --text-subtle: #a1a1aa;
  --accent: #0d9488;
  --accent-dim: rgba(13, 148, 136, 0.15);
  --accent-glow: rgba(13, 148, 136, 0.25);
  --match-bg: rgba(22, 163, 74, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 24px var(--accent-glow);
}

/* File protocol banner (when opening from file://) */
.file-protocol-banner {
  padding: 0.5rem 1rem;
  background: var(--accent-dim);
  border-bottom: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.85rem;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.file-protocol-banner.hidden { display: none !important; }
.file-protocol-banner code {
  padding: 0.2rem 0.5rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.file-protocol-banner a { color: var(--accent); font-weight: 500; }
.file-protocol-banner a:hover { text-decoration: underline; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; transition: background-color 0.3s ease, color 0.3s ease; }
html.a11y-large-text { font-size: 18px; }
html.a11y-high-contrast { --border: #14b8a6; --text-muted: #f2f2f7; }

/* Mobile: use full viewport and safe areas */
:root {
  --sat: env(safe-area-inset-top);
  --sar: env(safe-area-inset-right);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  padding-left: var(--sal);
  padding-right: var(--sar);
}
body.mobile-menu-open { overflow: hidden; }

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 6, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.3s ease;
}
[data-theme="light"] .header { background: rgba(244, 244, 245, 0.9); }
.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  padding-top: max(0.9rem, var(--sat));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  justify-content: space-between;
}

.logo {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
}
.logo:visited { color: var(--text); }
.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-hover) 100%);
  border: 1px solid var(--border);
}
.logo-icon svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.header-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}
.btn-icon:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-focus);
}
.btn-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: inline !important; }
.theme-icon-light.hidden { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }

.footer-toolbar {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.footer-toolbar-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.footer-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.footer-toolbar-btn:hover {
  color: var(--accent);
  background: var(--surface-hover);
  border-color: var(--accent);
}
.footer-toolbar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.footer-toolbar-btn:active {
  transform: scale(0.98);
}
.disclosure-text {
  width: 100%;
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.disclosure-text.hidden { display: none !important; }
.disclosure-text p { margin: 0; }

.a11y-panel {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.a11y-panel.hidden { display: none !important; }
.a11y-panel-inner { padding: 0.75rem 1rem; }
.a11y-panel-inner h4 { margin: 0 0 0.5rem 0; font-size: 0.9rem; color: var(--text); }
.a11y-option { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text); cursor: pointer; margin-bottom: 0.35rem; }
.a11y-option:last-child { margin-bottom: 0; }
.a11y-option input { accent-color: var(--accent); }

/* Search — command-bar style */
.search-wrap {
  position: relative;
  width: 100%;
  min-width: 240px;
  max-width: 360px;
}
.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-icon svg { width: 100%; height: 100%; }
.search-input {
  width: 100%;
  padding: 0.6rem 2.75rem 0.6rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input::placeholder { color: var(--text-subtle); }
.search-input:hover { border-color: var(--border-focus); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.clear-search {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
}
.clear-search:hover { color: var(--text); background: var(--surface-hover); }
.search-wrap.has-value .clear-search { display: flex; }

/* Search suggestions dropdown (top) */
.search-suggestions {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  margin-top: 0.25rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
}
.search-suggestions.hidden { display: none !important; }
.search-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  text-align: right;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  width: 100%;
  background: transparent;
  font-family: var(--font-sans);
}
.search-suggestion-item:hover,
.search-suggestion-item.highlighted {
  background: var(--accent-dim);
  color: var(--accent);
}
.search-suggestion-label { flex: 1; font-weight: 500; }
.search-suggestion-cat {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.search-suggestion-item.highlighted .search-suggestion-cat { color: var(--accent); opacity: 0.9; }
.search-suggestion-empty {
  cursor: default;
  color: var(--text-muted);
}
.search-suggestion-empty:hover { background: transparent; color: var(--text-muted); }

/* Buttons */
.btn-donate {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  background: var(--donate-bg);
  border: none;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: background var(--transition), transform var(--transition);
}
.btn-donate:hover { background: var(--donate-hover); transform: translateY(-1px); }
.donate-icon { width: 18px; height: 18px; }

.btn-favorites {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.btn-favorites:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}
.fav-icon { font-size: 1.05rem; }
.fav-count {
  font-weight: 600;
  color: var(--accent);
  min-width: 1.25em;
}

/* ===== Main ===== */
.main {
  flex: 1;
  display: flex;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  padding: 1.25rem;
  gap: 1.25rem;
}

/* Sidebar */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  height: fit-content;
  position: sticky;
  top: 76px;
  box-shadow: var(--shadow-sm);
}
.sidebar h3 {
  margin: 0 0 0.85rem 0;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}
.category-filters { list-style: none; margin: 0; padding: 0; }
.category-filters li { margin-bottom: 0.2rem; }
.category-filters button {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  text-align: right;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.category-filters button:hover { background: var(--surface-hover); color: var(--text); }
.category-filters button.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}
.sidebar-footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.stats { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.6rem 0; }
.btn-side {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-top: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.btn-side:hover { background: var(--border-focus); border-color: var(--border-focus); }

/* Content area + tabs */
.content-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tabs-wrap {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}
.mobile-menu-btn {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  min-height: 44px;
  min-width: 44px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), border-color var(--transition);
}
.mobile-menu-btn:hover { background: var(--surface-hover); border-color: var(--border-focus); }
.mobile-menu-icon { font-size: 1.25rem; line-height: 1; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex: 1;
}
.tab {
  padding: 0.5rem 1rem;
  min-height: 44px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.tab:hover { color: var(--text); background: var(--surface-hover); }
.tab.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent);
}
.tab-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-panel.hidden { display: none !important; }

/* Mobile menu overlay + bottom sheet */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}
.mobile-menu-overlay:not(.hidden) {
  pointer-events: auto;
}
.mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity var(--transition);
}
.mobile-menu-overlay:not(.hidden) .mobile-menu-backdrop {
  opacity: 1;
}
.mobile-menu-sheet {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0.75rem 1rem;
  padding-bottom: calc(1rem + var(--sab));
  max-height: 85vh;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
}
.mobile-menu-overlay:not(.hidden) .mobile-menu-sheet {
  transform: translateY(0);
}
.mobile-menu-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0.35rem auto 0.75rem;
}
.mobile-menu-close {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition), background var(--transition);
}
.mobile-menu-close:hover { color: var(--text); background: var(--surface-hover); }
.mobile-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}
.mobile-tab {
  display: block;
  width: 100%;
  padding: 1rem 1.25rem;
  min-height: 48px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  text-align: right;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition), background var(--transition);
}
.mobile-tab:hover { color: var(--text); background: var(--surface-hover); }
.mobile-tab.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ===== Developer guide ===== */
.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  max-width: 720px;
}
.guide-title {
  margin: 0 0 0.75rem 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.guide-intro {
  margin: 0 0 1.5rem 0;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.guide-section {
  margin-bottom: 1.5rem;
}
.guide-section:last-of-type { margin-bottom: 1rem; }
.guide-section-title {
  margin: 0 0 0.6rem 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.guide-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(20, 184, 166, 0.35);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.guide-section p {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.55;
}
.guide-list {
  margin: 0.5rem 0 0 0;
  padding-right: 1.5rem;
  list-style: disc;
}
.guide-list li {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.guide-list li strong { color: var(--text); }
.guide-outro {
  margin: 1rem 0 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.guide-outro strong { color: var(--accent); }

/* Tree container */
.tree-container {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  min-height: 420px;
  box-shadow: var(--shadow-sm);
}

/* Tree — branch lines + node cards */
.tree { padding: 0; }
.tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-right: 1.5rem;
  border-right: 2px solid var(--border);
  margin-right: 0.6rem;
}
.tree li { margin: 0.35rem 0; position: relative; }
.tree .node {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-align: right;
  min-height: 40px;
  border: 1px solid transparent;
}
.tree .node:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  transform: translateX(-2px);
}
.tree .node.leaf { padding-right: 2rem; }
.tree .node .icon-wrap {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.tree .node:hover .icon-wrap {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
}
.tree .node .icon-wrap img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.tree .node .label { flex: 1; font-size: 0.95rem; font-weight: 500; }
.tree .node .toggle {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition);
}
.tree .node.expanded .toggle { transform: rotate(90deg); color: var(--accent); }
.tree .node .fav-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition), transform var(--transition);
}
.tree .node .fav-btn:hover { opacity: 1; transform: scale(1.08); }
.tree .node .fav-btn.is-fav { opacity: 1; }
.tree .node .fav-btn.is-fav .star-outline { display: none; }
.tree .node .fav-btn .star-filled { display: none; }
.tree .node .fav-btn.is-fav .star-filled { display: inline; }
.tree .children { margin-right: 0.6rem; }
.tree .node.match {
  background: var(--match-bg);
  border-color: rgba(34, 197, 94, 0.25);
}

/* Links in tree */
.tree .node.leaf a.external-link {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  transition: color var(--transition);
}
.tree .node.leaf a.external-link:hover { color: var(--accent); }
.tree .node.leaf .external-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
}
.empty-state.hidden { display: none !important; }

/* Favorites panel */
.favorites-panel {
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin-top: 1.25rem;
  background: var(--bg-elevated);
}
.favorites-panel.hidden { display: none !important; }
.favorites-panel h3 {
  margin: 0 0 0.85rem 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.favorites-panel ul { list-style: none; margin: 0; padding: 0; }
.favorites-panel li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.favorites-panel li:last-child { border-bottom: none; }
.favorites-panel a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}
.favorites-panel a:hover { color: var(--text); }
.favorites-panel .remove-fav {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.favorites-panel .remove-fav:hover { color: var(--text); background: var(--surface-hover); }
.favorites-panel li.muted { color: var(--text-muted); font-size: 0.9rem; }

/* Footer */
.footer {
  padding: 1.25rem 1.5rem;
  padding-bottom: max(1.25rem, var(--sab));
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--surface);
  margin-top: auto;
}
.footer p { margin: 0; }
.footer-credit { margin-top: 0.35rem; }
.footer-credit strong { color: var(--accent); }
.footer-donate {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}
.footer-donate:hover { color: var(--text); }
.footer-donate img { vertical-align: middle; }
.footer-admin {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}
.footer-admin:hover { color: var(--text); }

/* ===== Project Map ===== */
.project-map-section.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.project-map-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .project-map-layout { grid-template-columns: 1fr; }
}
.project-map-select .plan-label { margin-bottom: 0.5rem; }
.project-map-categories {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}
.project-map-cat { display: flex; flex-direction: column; gap: 0.4rem; }
.project-map-cat-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}
.project-map-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.project-map-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.project-map-chip:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-focus);
}
.project-map-chip.selected {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(20, 184, 166, 0.4);
}
.project-map-chip-icon { width: 16px; height: 16px; object-fit: contain; }
.project-map-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.project-map-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  min-height: 200px;
  position: relative;
}
.project-map-preview.export-transparent {
  background: transparent;
  border-color: transparent;
}
.project-map-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.project-map-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}
.project-map-group { display: flex; flex-direction: column; gap: 0.5rem; }
.project-map-group-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.project-map-group-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.project-map-card {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.project-map-card img { width: 24px; height: 24px; object-fit: contain; }
.map-watermark {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.7;
  letter-spacing: 0.05em;
}
.project-map-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* PWA install banner */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 8%);
  pointer-events: none;
}
.pwa-install-banner.hidden { display: none !important; }
.pwa-install-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(20, 184, 166, 0.2);
  pointer-events: auto;
}
.pwa-install-icon { font-size: 1.75rem; }
.pwa-install-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}
.pwa-install-text strong { color: var(--accent); }
.pwa-install-actions { display: flex; align-items: center; gap: 0.5rem; }
.pwa-install-btn {
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.pwa-install-btn:hover { background: #0d9488; transform: scale(1.02); }
.pwa-install-dismiss {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.pwa-install-dismiss:hover { color: var(--text); background: var(--surface-hover); }

/* ===== Plan & Prompts ===== */
.plan-builder.card,
.suggested-prompts.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.plan-section-title {
  margin: 0 0 0.35rem 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.plan-section-desc {
  margin: 0 0 1.25rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.plan-form { display: flex; flex-direction: column; gap: 0.85rem; }
.plan-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}
.plan-select,
.plan-input,
.plan-textarea {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color var(--transition);
}
.plan-select { cursor: pointer; max-width: 280px; }
.plan-input:focus,
.plan-textarea:focus { border-color: var(--accent); }
.plan-textarea { resize: vertical; min-height: 100px; }
.plan-tech-row { position: relative; }
.plan-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.5rem 0.3rem 0.6rem;
  font-size: 0.85rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: var(--radius-full);
  border: 1px solid rgba(20, 184, 166, 0.3);
}
.plan-chip-remove {
  padding: 0 0.2rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: color var(--transition);
}
.plan-chip-remove:hover { color: var(--text); }
.plan-suggestions {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  margin-top: 0.25rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
}
.plan-suggestion-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  text-align: right;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}
.plan-suggestion-item:hover { background: var(--border-focus); }
.plan-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Plan flow table */
.plan-flow-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.plan-flow-title {
  margin: 0 0 0.35rem 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.plan-flow-desc {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.plan-flow-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.plan-flow-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.plan-flow-table th,
.plan-flow-table td {
  padding: 0.5rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.plan-flow-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
}
.plan-flow-table tbody tr:last-child td { border-bottom: none; }
.plan-flow-table tbody tr:hover { background: var(--surface-hover); }
.plan-flow-col-num { width: 2.5rem; color: var(--text-subtle); }
.plan-flow-col-name { min-width: 140px; }
.plan-flow-col-desc { min-width: 180px; }
.plan-flow-col-actions { width: 2.5rem; }
.plan-flow-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
.plan-flow-input:focus {
  outline: none;
  border-color: var(--accent);
}
.plan-flow-input::placeholder { color: var(--text-subtle); }
.plan-flow-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.plan-flow-remove:hover { color: var(--text); background: var(--surface-hover); }
.plan-flow-add-btn { margin-top: 0.25rem; }

.btn-primary {
  padding: 0.55rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: #0d9488; transform: translateY(-1px); }
.btn-secondary {
  padding: 0.55rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.btn-secondary:hover { border-color: var(--accent); background: var(--accent-dim); }
.prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.prompt-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.prompt-card:hover { border-color: var(--border-focus); box-shadow: var(--shadow-sm); }
.prompt-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}
.prompt-card-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prompt-card-copy {
  align-self: flex-start;
  padding: 0.4rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.prompt-card-copy:hover { background: rgba(20, 184, 166, 0.25); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
  }
  .sidebar > h3 { margin: 0; }
  .sidebar .category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    flex: 1;
  }
  .sidebar .category-filters li { margin: 0; }
  .sidebar .category-filters button { width: auto; }
  .sidebar-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 100%;
  }
  .sidebar-footer .stats { margin: 0; margin-left: auto; }
  .btn-side { width: auto; margin: 0; }
  .main { flex-direction: column; }
}

/* Mobile-first menu: show hamburger, hide tab bar below 768px */
@media (max-width: 767px) {
  .mobile-menu-btn { display: inline-flex; }
  .tabs-wrap .tabs { display: none; }
}

@media (min-width: 768px) {
  .mobile-menu-overlay.hidden { display: none !important; }
}

@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: stretch; padding: 0.75rem 1rem; padding-top: max(0.75rem, var(--sat)); }
  .search-wrap { max-width: none; }
  .header-actions { justify-content: center; }
  .tree .node .label { font-size: 0.9rem; }
  .tree ul { padding-right: 1rem; }
  .tree .node { padding: 0.45rem 0.6rem; }
  .logo { font-size: 1.2rem; }
  .logo-icon { width: 32px; height: 32px; }
  .tabs { flex-wrap: wrap; }
  .prompts-grid { grid-template-columns: 1fr; }
  .main { padding: 0.75rem 1rem; padding-left: max(0.75rem, var(--sal)); padding-right: max(0.75rem, var(--sar)); }
}

/* ===== Communities & AI links ===== */
.links-section.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.links-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.links-section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.links-filters {
  margin-bottom: 1rem;
}
.links-filter-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: block;
}
.links-filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.links-filter-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.links-filter-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.links-filter-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(20, 184, 166, 0.4);
}
.link-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.link-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}
.link-card:hover {
  border-color: var(--accent-dim);
  box-shadow: var(--shadow-sm);
}
.link-card-a {
  flex: 1;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  display: block;
}
.link-card-type,
.link-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}
.link-card-title {
  margin: 0 0 0.5rem 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.link-card-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.link-card-actions {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.link-card-edit,
.link-card-delete {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.link-card-edit:hover,
.link-card-delete:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.link-card-delete:hover { color: var(--danger, #dc2626); }
.hidden { display: none !important; }
/* Link modal */
.link-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.link-modal.hidden { display: none !important; }
.link-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.link-modal-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}
.link-modal-title {
  margin: 0 0 1rem 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}
.link-form { display: flex; flex-direction: column; gap: 0.85rem; }
.link-form-group { display: flex; flex-direction: column; gap: 0.85rem; }
.link-form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ===== Memory Game ===== */
.memory-game.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.memory-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
}
.memory-controls .plan-label { margin: 0; }
.memory-moves {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  margin-right: auto;
}
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  max-width: 560px;
  margin: 0 auto 1rem;
}
.memory-card {
  aspect-ratio: 1;
  cursor: pointer;
  perspective: 600px;
  outline: none;
}
.memory-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.memory-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.4s ease;
  transform-style: preserve-3d;
}
.memory-card.flipped .memory-card-inner,
.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}
.memory-card-back,
.memory-card-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}
.memory-card-back {
  background: linear-gradient(135deg, var(--accent-dim) 0%, var(--bg-elevated) 100%);
  border: 2px solid var(--border);
  color: var(--accent);
  font-size: 1.75rem;
  font-weight: 700;
}
.memory-card-front {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  transform: rotateY(180deg);
}
.memory-card.flipped .memory-card-front,
.memory-card.matched .memory-card-front {
  border-color: var(--accent-dim);
}
.memory-card.matched .memory-card-front {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.memory-card-icon {
  width: 56%;
  height: 56%;
  object-fit: contain;
}
.memory-card-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}
.memory-win {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
}
@media (max-width: 520px) {
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  .memory-card-name { font-size: 0.75rem; }
}

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