@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/themes/zen/fonts/bricolage-grotesque.woff2") format("woff2");
}

@font-face {
  font-family: "Junicode";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/themes/zen/fonts/Junicode-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "Junicode";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/themes/zen/fonts/Junicode-Bold.ttf") format("truetype");
}

:root {
  /* Base (Cleaner Everforest Light Soft) */
  --bg: #f7f7f5;
  --bg-light: #f0f0ec;
  --bg-hover: #e6e6e1;

  --border: #dcdcd6;
  --border-light: #e7e7e2;

  --text-primary: #2f383e;
  --text-secondary: #6b7478;

  --text-link: #6f8f2f;
  --text-link-visited: #5a7a25;

  --text-cite: #5f6a6f;
  --text-snippet: #4f5a60;

  --search-bar-bg: #f0f0ec;
  --search-bar-bg-hover: #f0f0ec;

  --btn-bg: #e6e6e1;
  --btn-text: #2f383e;

  --overlay-bg: rgba(0, 0, 0, 0.25);

  --white: #ffffff;

  --theme-bar-bg: transparent;
  --theme-bar-text: #6b7478;
  --theme-bar-border: transparent;
  --theme-pagination-active-bg: #e6e6e1;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.08);

  /* Slightly toned-down green */
  --accent: #8aa85a;
  --primary: #6f8f2f;
  --primary-hover: #5f7c28;
  --primary-rgb: 111, 143, 47;

  --danger: #d46a6a;
  --warning: #c9a84e;
  --success: #8aa85a;

  --font-family: "Bricolage Grotesque", sans-serif;
  --font-logo: "Junicode", serif;
}

/* Explicit light */
:root[data-theme="light"] {
  --bg: #f7f7f5;
  --bg-light: #f0f0ec;
  --bg-hover: #e6e6e1;

  --border: #dcdcd6;
  --border-light: #e7e7e2;

  --text-primary: #2f383e;
  --text-secondary: #6b7478;

  --search-bar-bg: #f0f0ec;
  --search-bar-bg-hover: #f0f0ec;

  --btn-bg: #e6e6e1;
  --btn-text: #2f383e;

  --white: #ffffff;

  --primary: #6f8f2f;
  --primary-hover: #5f7c28;
  --primary-rgb: 111, 143, 47;

  --danger: #d46a6a;
  --warning: #c9a84e;
  --success: #8aa85a;

  --contrast-bg: #2f383e;
  --contrast-text: #ffffff;

  --subtle-bg: #e6e6e1;
}

/* Dark (Everforest Soft Dark) */
:root[data-theme="dark"] {
  --bg: #2b3339;
  --bg-light: #323c41;
  --bg-hover: #3a444a;

  --border: #4a555b;
  --border-light: #3c474d;

  --text-primary: #d3c6aa;
  --text-secondary: #9da9a0;

  --text-link: #a7c080;
  --text-link-visited: #83c092;

  --text-cite: #a6b0a0;
  --text-snippet: #c0b8a0;

  --search-bar-bg: #323c41;
  --search-bar-bg-hover: #323c41;

  --btn-bg: #3a444a;
  --btn-text: #d3c6aa;

  --overlay-bg: rgba(0, 0, 0, 0.5);

  --white: #2b3339;

  --theme-bar-bg: transparent;
  --theme-bar-text: #9da9a0;
  --theme-pagination-active-bg: #4a555b;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.45);

  --primary: #a7c080;
  --primary-hover: #b5d48c;
  --primary-rgb: 167, 192, 128;

  --danger: #e67e80;
  --warning: #dbbc7f;
  --success: #a7c080;

  --contrast-bg: #f3ead3;
  --contrast-text: #2b3339;

  --subtle-bg: #323c41;
}

/* System dark fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2d353b;
    --bg-light: #343f44;
    --bg-hover: #3d484d;

    --border: #475258;
    --border-light: #3a454a;

    --text-primary: #d3c6aa;
    --text-secondary: #9da9a0;

    --text-link: #a7c080;
    --text-link-visited: #83c092;

    --text-cite: #a6b0a0;
    --text-snippet: #c0b8a0;

    --search-bar-bg: #343f44;
    --search-bar-bg-hover: #343f44;

    --btn-bg: #3d484d;
    --btn-text: #d3c6aa;

    --overlay-bg: rgba(0, 0, 0, 0.5);

    --white: #2d353b;

    --primary: #a7c080;
    --primary-hover: #b5d48c;
    --primary-rgb: 167, 192, 128;

    --danger: #e67e80;
    --warning: #dbbc7f;
    --success: #a7c080;
  }
}

* {
  box-sizing: border-box;
  font-family: var(--font-family);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

html[data-theme="light"],
html[data-theme="light"] body {
  background: var(--bg);
  color: var(--text-primary);
}


html[data-theme="dark"],
html[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text-primary);
}

html[data-theme="light"],
html[data-theme="light"] body {
  background: var(--bg);
  color: var(--text-primary);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]),
  html:not([data-theme="light"]) body {
    background: var(--bg);
    color: var(--text-primary);
  }
}

a {
  color: var(--text-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#header {
  background: transparent;
  border-bottom: none;
  padding: 24px;
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  z-index: 10;
}

.header-right {
  display: flex;
  justify-content: flex-end;
}

.header-link, .settings-gear {
  color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 50%;
}

.header-link:hover, .settings-gear:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

#header svg, #results-header .settings-gear svg {
  stroke: currentColor;
}

#main-home {
  background: transparent;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin-top: -10vh; 
}

#home-logo {
  background: transparent;
}

.logo, .results-logo {
  font-size: 0 !important;
  text-shadow: none;
  margin: 0;
  text-decoration: none;
}

.logo span, .results-logo span {
  display: none !important;
}

.logo::after {
  content: "zen";
  font-family: var(--font-logo);
  font-size: 6rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-shadow: var(--shadow-sm);
}

.results-logo::after {
  display:none
}

.search-container {
  width: 100%;
  max-width: 584px;
  background: transparent;
}

.search-form {
  width: 100%;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--search-bar-bg);
  border: none;
  border-radius: 14px;
  padding: 0 16px 0 20px;
  height: 48px;
  box-shadow: none;
  transition: background-color 0.2s ease;
  position: relative;
}

.search-bar:hover, .search-bar:focus-within {
  box-shadow: none;
  border: none;
}

.search-bar.ac-open {
  border: none;
  border-radius: 14px 14px 0 0;
}

.search-bar .ac-dropdown,
.search-bar.ac-open .ac-dropdown {
  top: 100%;
  left: 0;
  right: 0;
  border: none;
  border-radius: 0 0 14px 14px;
  box-shadow: none;
  background: var(--search-bar-bg);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-primary);
  height: 100%;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}

.search-icon {
  stroke: var(--text-secondary);
  margin-right: 12px;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.button-row .search-btn,
.button-row .lucky-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 0 24px;
  height: 48px;
  line-height: 1;
  width: fit-content;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  text-shadow: none;
  transition: background-color 0.2s ease, transform 150ms ease;
}

.button-row .lucky-btn .lucky-slot-inner span {
  height: 48px;
  line-height: 1;
  font-family: var(--font-family);
  color: var(--text-primary);
}

.search-btn {
  background: var(--contrast-bg);
  color: var(--contrast-text);
  border: 1px solid var(--contrast-bg);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.lucky-btn {
  background: var(--subtle-bg);
  color: var(--text-primary);
  border: none;
  box-shadow: none;
}

.search-btn:hover, .lucky-btn:hover {
  transform: scale(1.02);
  border-color: transparent;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.lucky-btn:hover {
  box-shadow: none;
}

.search-btn:active, .lucky-btn:active {
  transform: scale(0.98);
}

.lucky-btn .lucky-slot-inner span {
  color: var(--text-primary);
}


.lucky-slot-inner span {
  font-family: var(--font-family);
}

#results-page {
  display: flex;
  flex-direction: column;
  width: 100%;
}

#results-header {
  display: flex;
  align-items: center;
  padding: 24px 32px;
  gap: 32px;
  background: var(--bg);
  border-bottom: none;
}

.results-search-bar {
  max-width: 692px;
  display: flex;
  align-items: center;
  background: var(--search-bar-bg);
  border: none;
  border-radius: 14px;
  padding: 0 16px 0 24px;
  height: 48px;
  box-shadow: none;
  transition: background-color 0.2s ease;
  position: relative;
}

.results-search-bar:hover, .results-search-bar:focus-within {
  box-shadow: none;
  border: none;
}

.results-search-bar.ac-open {
  border: none;
  border-radius: 14px 14px 0 0;
}

.results-search-bar .ac-dropdown,
.results-search-bar.ac-open .ac-dropdown {
  top: 100%;
  left: 0;
  right: 0;
  border: none;
  border-radius: 0 0 14px 14px;
  box-shadow: none;
  background: var(--search-bar-bg);
}

.search-submit-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
  box-shadow: none;
}

.search-submit-btn:hover {
  background: var(--theme-pagination-active-bg);
}

.search-submit-btn svg circle,
.search-submit-btn svg path {
  stroke: var(--text-secondary);
}

#results-tabs {
  display: flex;
  gap: 24px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding-left: 140px; 
}

.results-tab {
  padding: 12px 0;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
  background: transparent;
  border-radius: 0;
  font-weight: normal;
}

.results-tab:hover {
  color: var(--text-primary);
  background: transparent;
}

.results-tab.active {
  color: var(--accent);
  font-weight: 500;
  border-bottom: none;
  background: transparent;
}

.results-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--accent);
  border-radius: 3px 3px 0 0;
}

.tools-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  margin-top: 0;
}

.tools-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
  box-shadow: none;
}

.tools-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tools-dropdown {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-light);
  box-shadow: var(--shadow-md);
  position: absolute;
  top: 100%;
  right: 0;
  padding: 8px 0;
  z-index: 50;
}

.tools-option {
  border-radius: 0;
  color: var(--text-primary);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  box-shadow: none;
}

.tools-option.active,
.tools-option:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

#results-meta {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 16px 32px 0;
  padding-left: 140px;
  background: transparent;
  font-style: normal;
}

#results-layout {
  display: flex;
  padding: 24px 32px;
  gap: 40px;
  max-width: 1300px;
  background: transparent;
}

#results-layout.media-mode {
  max-width: none;
}

#results-main {
  flex: 1;
  max-width: 692px;
  margin-left: 108px;
  background: transparent;
}

#sidebar-col {
  width: 350px;
  background: transparent;
  border: none;
  padding: 0;
}

.result-item {
  margin-bottom: 32px;
  border-bottom: none;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.result-item:hover {
  background: transparent;
}

.result-cite {
  display: block;
  font-size: 14px;
  color: var(--text-cite);
  margin-bottom: 4px;
}

.result-title a {
  font-size: 20px;
  line-height: 1.3;
  color: var(--text-link);
  display: inline-block;
  margin-bottom: 4px;
  text-decoration: none;
  font-weight: 500;
}

.result-title a:visited {
  color: var(--text-link-visited);
}

.result-title a:hover {
  text-decoration: underline;
}

.result-snippet {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-snippet);
}

.knowledge-panel {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  color: var(--text-primary);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 40px 0;
}

.pagination a, .pagination span {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-link);
  font-weight: 500;
  transition: background-color 0.2s ease;
  box-shadow: none;
  padding: 0;
}

.pagination a:hover {
  background: var(--bg-hover);
}

.pagination .active {
  background: var(--theme-pagination-active-bg);
  color: var(--accent);
  border-style: none;
}

#home-footer {
  background: transparent;
  border-top: none;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.visitor-counter {
  display: none; 
}

#home-footer a, .home-footer-bottom, .home-footer-version {
  color: var(--text-secondary);
  font-size: 13px;
}

#home-footer a:hover {
  color: var(--text-primary);
}

.ac-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  overflow: hidden;
}

.ac-item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--text-primary);
}

.ac-item:hover, .ac-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.marquee-banner { display: none; }

@media (max-width: 768px) {
  #results-header {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 16px;
  }
  
  .results-logo {
    align-self: flex-start;
  }
  
  .results-search-bar {
    max-width: 100%;
  }

  #results-tabs {
    padding-left: 16px;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  #results-meta {
    padding-left: 16px;
  }
  
  #results-layout {
    flex-direction: column;
    padding: 16px;
  }
  
  #results-main {
    margin-left: 0;
    max-width: 100%;
  }
  
  #sidebar-col {
    width: 100%;
  }
  
  #header {
    position: relative;
    padding: 16px;
  }
  
  #main-home {
    margin-top: 0;
  }
  
  .button-row {
    flex-direction: column;
    align-items: center;
  }
  
  .search-btn, .lucky-btn {
    width: 100%;
    max-width: 250px;
  }
}
