:root {
  --bg: #0b0f14;
  --surface: #131a22;
  --surface-2: #18212c;
  --scroll-track: #0f1621;
  --scroll-thumb: #2a3a50;
  --scroll-thumb-hover: #3a4f6d;
  --text: #edf2f7;
  --muted: #8ca0b3;
  --accent: #3da9fc;
  --border: #243041;
}

@font-face {
  font-family: "SofiaSansCustom";
  src: url("https://fonts.gstatic.com/s/sofiasans/v20/Yq6T-LCVXSLy9uPBwlATrORKkzApcb8.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  font-family: "SofiaSansCustom", sans-serif;
  background: radial-gradient(circle at top, #111a25 0%, var(--bg) 55%);
  color: var(--text);
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  scrollbar-width: thin;
}

* {
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: var(--scroll-track);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #344a65 0%, var(--scroll-thumb) 100%);
  border-radius: 999px;
  border: 2px solid var(--scroll-track);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

::-webkit-scrollbar-corner {
  background: var(--scroll-track);
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 76px;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 20, 0.92);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.logo-wrap,
.github-link,
.panel-action-btn.tools-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #101723;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
}

#site-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  border: 0;
}

.brand-title {
  margin: 0;
  text-align: left;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}

.brand-home-link {
  text-decoration: none;
  color: inherit;
}

.header-search {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, 56vw);
}

.github-link {
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.github-link:hover {
  border-color: var(--accent);
  background: #162334;
  transform: translateY(-1px);
}

.github-link img {
  width: 20px;
  height: 20px;
  display: block;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tools-menu {
  position: relative;
}

.tools-toggle img {
  width: 20px;
  height: 20px;
  display: block;
}

.tools-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #101723;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  z-index: 20;
}

.tools-dropdown a {
  display: block;
  padding: 0.62rem 0.75rem;
  color: #d7e6f6;
  text-decoration: none;
  font-size: 0.9rem;
}

.tools-dropdown a:hover {
  background: #162335;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

main {
  padding-top: 88px;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-bottom: 1rem;
  min-height: 100vh;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 0.9rem 1rem 1.1rem;
}

.site-footer p {
  margin: 0.2rem 0;
}

.combiner-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 15, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.combiner-modal[hidden] {
  display: none !important;
}

.combiner-modal__dialog {
  width: min(440px, 92vw);
  background: #131a22;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}

.combiner-modal__dialog h3 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  color: #e7eff8;
}

.combiner-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.7rem;
  color: #d1e0f1;
}

.combiner-check input {
  width: 17px;
  height: 17px;
}

.combiner-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.landing-message {
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
}

.landing-message[hidden] {
  display: none !important;
}

#home-status {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #e8f1fb;
}

.landing-subtitle {
  margin: 0;
  font-size: 1.05rem;
  color: #9cb2c8;
}

#file-search {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0 1rem;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#file-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 169, 252, 0.2);
}

#status {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
  display: none;
}

.results-viewer {
  display: none;
  grid-template-columns: minmax(320px, 38vw) 1fr;
  gap: 1rem;
  padding: 0 0 1rem;
}

.results-viewer.visible {
  display: grid;
}

.results-viewer aside,
.results-viewer article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 420px;
  max-height: 62vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  min-height: 48px;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #e7eff8;
}

.content-actions {
  display: inline-flex;
  gap: 0.45rem;
}

.view-tabs {
  display: inline-flex;
  gap: 0.35rem;
}

.view-tab-btn {
  min-width: 70px;
}

.view-tab-btn.active {
  border-color: var(--accent);
  background: #162335;
}

.panel-action-btn {
  height: 32px;
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111a27;
  color: #d7e6f6;
  font-size: 0.82rem;
  font-family: "SofiaSansCustom", sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.panel-action-btn[hidden] {
  display: none !important;
}

.panel-action-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: #162335;
  transform: translateY(-1px);
}

.panel-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.preview-copy-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
}

.preview-copy-btn img {
  width: 20px;
  height: 20px;
  display: block;
}

.name-filter-label {
  display: block;
  margin: 0 0 0.55rem;
  color: #c8d9ea;
  font-size: 0.88rem;
}

.name-filter-input {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #101723;
  color: #e3edf8;
  padding: 0 0.6rem;
  font-size: 0.9rem;
  font-family: "SofiaSansCustom", sans-serif;
}

.name-filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 169, 252, 0.2);
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  max-width: min(92vw, 440px);
  padding: 0.62rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111a27;
  color: #d7e6f6;
  font-size: 0.88rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.copy-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.copy-toast.error {
  border-color: #8f3a46;
  color: #ffd5db;
}

#toggle-paths {
  border: 1px solid var(--border);
  background: #111a27;
  color: #d7e6f6;
  border-radius: 8px;
  height: 32px;
  padding: 0 0.6rem;
  font-size: 0.82rem;
  font-family: "SofiaSansCustom", sans-serif;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#toggle-paths:hover {
  border-color: var(--accent);
  background: #162335;
}

#results {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  height: 100%;
}

#results li button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #1f2937;
  color: var(--text);
  padding: 0.72rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
}

#results li button:hover,
#results li button.active {
  background: var(--surface-2);
}

#results li button mark {
  background: rgba(61, 169, 252, 0.28);
  color: #eaf4ff;
  border-radius: 4px;
  padding: 0 0.08rem;
}

#selected-path {
  margin: 0;
  padding: 0.72rem 0.85rem;
  line-height: 1.2;
  min-height: 41px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: #b8cbe0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#file-content {
  margin: 0;
  padding: 0.9rem;
  overflow: auto;
  font-family: Consolas, Menlo, Monaco, monospace;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #d2e0ef;
}

#file-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b1018;
}

#file-content .preview-note {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-family: "SofiaSansCustom", sans-serif;
}

@media (max-width: 980px) {
  .site-header {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 0.65rem 1rem;
  }

  .brand {
    justify-content: space-between;
  }

  .header-search {
    position: static;
    transform: none;
    width: 100%;
  }

  .github-link {
    margin-left: 0;
    align-self: flex-end;
  }

  .header-actions {
    justify-content: flex-end;
  }

  main {
    padding-top: 130px;
  }

  .landing-message {
    min-height: calc(100vh - 220px);
  }

  .results-viewer {
    grid-template-columns: 1fr;
  }
}
