@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 {
  --bg: #f2f0e3;
  --bg-light: #ebe8d8;
  --bg-hover: #e4e1cf;
  --border: #d6d2be;
  --border-light: #e0dcc9;
  --text-primary: #2e2e2e;
  --text-secondary: #6b6a63;
  --text-link: #f76f53;
  --text-link-visited: #c95539;
  --text-cite: #524d4a;
  --text-snippet: #4a4745;
  --search-bar-bg: #ebe8d8;
  --search-bar-bg-hover: #ebe8d8;
  --btn-bg: #e4e1cf;
  --btn-text: #2e2e2e;
  --overlay-bg: rgba(46, 46, 46, 0.4);
  --white: #f2f0e3;
  --theme-bar-bg: transparent;
  --theme-bar-text: #6b6a63;
  --theme-bar-border: transparent;
  --theme-pagination-active-bg: #f9ddd4;
  --shadow-sm: 0 2px 6px rgba(46, 46, 46, 0.04);
  --shadow-md: 0 6px 16px rgba(46, 46, 46, 0.08);
  --accent: #f76f53;
  --primary: #f76f53;
  --primary-hover: #e55a3e;
  --primary-rgb: 247, 111, 83;
  --danger: #e0594a;
  --warning: #c9a227;
  --success: #4a7c59;
  --font-family: "Bricolage Grotesque", sans-serif;
  --font-logo: "Junicode", serif;
}

:root[data-theme="light"] {
  --bg: #f2f0e3;
  --bg-light: #ebe8d8;
  --bg-hover: #e4e1cf;
  --border: #d6d2be;
  --border-light: #e0dcc9;
  --text-primary: #2e2e2e;
  --text-secondary: #6b6a63;
  --search-bar-bg: #ebe8d8;
  --search-bar-bg-hover: #ebe8d8;
  --btn-bg: #e4e1cf;
  --btn-text: #2e2e2e;
  --white: #f2f0e3;
  --primary: #f76f53;
  --primary-hover: #e55a3e;
  --primary-rgb: 247, 111, 83;
  --danger: #e0594a;
  --warning: #c9a227;
  --success: #4a7c59;
  --contrast-bg: #2e2e2e;
  --contrast-text: #f2f0e3;
  --subtle-bg: #e4e1cf;
}

:root[data-theme="dark"] {
  --bg: #1f1f1f;
  --bg-light: #2a2a2a;
  --bg-hover: #343434;
  --border: #3d3d3d;
  --border-light: #2e2e2e;
  --text-primary: #d1cfc0;
  --text-secondary: #96948a;
  --text-link: #f76f53;
  --text-link-visited: #d8614a;
  --text-cite: #b5b3a6;
  --text-snippet: #c4c2b5;
  --search-bar-bg: #2a2a2a;
  --search-bar-bg-hover: #2a2a2a;
  --btn-bg: #343434;
  --btn-text: #d1cfc0;
  --overlay-bg: rgba(0, 0, 0, 0.6);
  --white: #1f1f1f;
  --theme-bar-bg: transparent;
  --theme-bar-text: #96948a;
  --theme-pagination-active-bg: #3d2820;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
  --primary: #f76f53;
  --primary-hover: #ff8a73;
  --primary-rgb: 247, 111, 83;
  --danger: #e0786a;
  --warning: #e0b84d;
  --success: #81c995;
  --contrast-bg: #f2f0e3;
  --contrast-text: #1f1f1f;
  --subtle-bg: #2a2a2a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1f1f;
    --bg-light: #2a2a2a;
    --bg-hover: #343434;
    --border: #3d3d3d;
    --border-light: #2e2e2e;
    --text-primary: #d1cfc0;
    --text-secondary: #96948a;
    --text-link: #f76f53;
    --text-link-visited: #d8614a;
    --text-cite: #b5b3a6;
    --text-snippet: #c4c2b5;
    --search-bar-bg: #2a2a2a;
    --search-bar-bg-hover: #2a2a2a;
    --btn-bg: #343434;
    --btn-text: #d1cfc0;
    --overlay-bg: rgba(0, 0, 0, 0.6);
    --white: #1f1f1f;
    --theme-bar-bg: transparent;
    --theme-bar-text: #96948a;
    --theme-pagination-active-bg: #3d2820;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
    --primary: #f76f53;
    --primary-hover: #ff8a73;
    --primary-rgb: 247, 111, 83;
    --danger: #e0786a;
    --warning: #e0b84d;
    --success: #81c995;
  }
}

* {
  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: #f2f0e3;
  color: #2e2e2e;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: #1f1f1f;
  color: #d1cfc0;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]),
  html:not([data-theme="dark"]) body {
    background: #f2f0e3;
    color: #2e2e2e;
  }
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]),
  html:not([data-theme="light"]) body {
    background: #1f1f1f;
    color: #d1cfc0;
  }
}

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 {
  content: "zen";
  font-family: var(--font-logo);
  font-size: 2.25rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-shadow: var(--shadow-sm);
}

.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;
  }
}