:root {
  --bg: rgba(15, 18, 32, 1);
  --panel: rgba(21, 25, 53, 1);
  --panel-2: rgba(14, 16, 37, 1);
  --text: rgba(233, 237, 244, 1);
  --muted: rgba(154, 163, 199, 1);
  --accent: rgba(106, 166, 255, 1);
  --accent-2: rgba(113, 247, 197, 1);
  --warn: rgba(240, 193, 75, 1);
  --danger: rgba(255, 107, 107, 1);
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial
}

.app {
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100%
}

.topbar {
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: .6rem 1rem;
  background: linear-gradient(180deg, rgba(25, 32, 71, 1), rgba(18, 22, 51, 1));
  border-bottom: 1px solid rgba(38, 44, 87, 1);
  z-index: 3
}

.title {
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap
}

.controls {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap
}

.searchbar {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex: 1;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid rgba(42, 49, 109, 1);
  border-radius: 12px;
  padding: .3rem .55rem
}

.searchbar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  padding: .35rem .2rem
}

.btn {
  appearance: none;
  border: none;
  outline: none;
  border-radius: 10px;
  padding: .45rem .65rem;
  background: rgba(35, 48, 104, 1);
  color: rgba(234, 240, 255, 1);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid rgba(49, 65, 147, 1);
  white-space: nowrap
}

.btn:hover {
  filter: brightness(1.1)
}

.btn.secondary {
  background: rgba(26, 33, 74, 1);
  border-color: rgba(42, 51, 116, 1);
  color: rgba(203, 214, 255, 1)
}

.select {
  background: var(--panel);
  border: 1px solid rgba(42, 49, 109, 1);
  color: rgba(234, 240, 255, 1);
  border-radius: 10px;
  padding: .4rem .55rem;
  font-size: 13px
}

/* removed Tiny Circles slider */
.breadcrumbs {
  display: flex;
  gap: .35rem;
  align-items: center;
  flex-wrap: wrap;
  padding: .4rem 1rem;
  background: var(--panel-2);
  border-bottom: 1px solid rgba(26, 31, 66, 1);
  z-index: 2
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: rgba(200, 210, 255, 1);
  background: rgba(18, 25, 58, 1);
  border: 1px solid rgba(40, 48, 105, 1);
  padding: .25rem .5rem;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  user-select: none
}

.crumb:hover {
  background: rgba(22, 33, 81, 1)
}

.crumb .sep {
  opacity: .5
}

.stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 900px at 20% 10%, rgba(77, 96, 255, .07), transparent 60%),
    radial-gradient(1000px 700px at 80% 30%, rgba(113, 247, 197, .06), transparent 60%),
    var(--bg)
}

canvas {
  display: block;
  width: 100%;
  height: 100%
}

canvas.loading {
  pointer-events: none;
  opacity: 0.7
}

.fps {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 4;
  background: rgba(18, 22, 51, .78);
  border: 1px solid rgba(44, 53, 120, .9);
  border-radius: 8px;
  padding: .3rem .45rem;
  color: rgba(207, 224, 255, 1);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: pre;
  line-height: 1.2;
  display: none
}

.puff-link {
  position: absolute;
  display: none;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none
}

.puff-link a {
  display: inline-block;
  background: rgba(15, 19, 48, 1);
  border: 1px solid rgba(42, 52, 114, 1);
  color: rgba(234, 240, 255, 1);
  padding: .35rem .6rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px
}

.big-preview {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: none;
  pointer-events: none;
  background: rgba(10, 12, 28, .7);
  border: 1px solid rgba(43, 52, 114, 1);
  border-radius: 10px;
  overflow: hidden;
  opacity: 0;
  transition: opacity .06s ease
}

.big-preview img {
  width: 240px;
  height: auto;
  max-height: 280px;
  display: block
}

.big-preview .empty {
  width: 240px;
  max-height: 280px;
  display: none;
  align-items: center;
  justify-content: center;
  color: rgba(174, 185, 255, 1);
  background: rgba(14, 17, 40, .6);
  font-size: 13px;
  padding: 1.2rem;
  text-align: center
}

.big-preview .cap {
  padding: .3rem .5rem;
  font-size: 12px;
  color: rgba(219, 228, 255, 1);
  background: rgba(14, 17, 40, .85);
  border-top: 1px solid rgba(44, 53, 120, .6)
}

.tooltip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  background: rgba(20, 25, 55, 1);
  border: 1px solid rgba(43, 52, 114, 1);
  color: rgba(234, 240, 255, 1);
  font-size: 12px;
  padding: .45rem .6rem;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  opacity: 0;
  transition: opacity .12s ease;
  display: flex;
  gap: .5rem;
  align-items: center
}

/* Removed small tooltip thumbnail in markup; prune dead rule */
.tooltip .textcol {
  display: flex;
  flex-direction: column;
  gap: .15rem
}

.tooltip .name {
  font-weight: 700;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.tooltip .meta {
  color: rgba(185, 195, 240, 1);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.tooltip .actions {
  display: flex;
  gap: .3rem;
  align-items: center
}

.tooltip .ext {
  pointer-events: auto;
  background: rgba(35, 48, 104, 1);
  border: 1px solid rgba(49, 65, 147, 1);
  border-radius: 6px;
  padding: .15rem .35rem;
  cursor: pointer
}

.tooltip .ext:hover {
  filter: brightness(1.1)
}

.legend {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  pointer-events: none;
  background: rgba(18, 22, 51, .75);
  border: 1px solid rgba(44, 53, 120, .9);
  border-radius: 12px;
  padding: .5rem .75rem;
  color: rgba(219, 228, 255, 1);
  font-size: 12px;
  max-width: 360px
}

.legend b {
  color: rgba(255, 255, 255, 1)
}

.legend ul {
  margin: .25rem 0 0 .9rem;
  padding: 0
}

.legend li {
  margin: .15rem 0
}

.loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(9, 12, 27, .92), rgba(9, 12, 27, .86));
  z-index: 5
}

.loader {
  width: min(520px, 88vw);
  background: rgba(15, 19, 48, 1);
  border: 1px solid rgba(42, 52, 114, 1);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35)
}

.loader h3 {
  margin: .2rem 0 .6rem 0;
  font-size: 16px;
  color: rgba(244, 247, 255, 1)
}

.splash-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: .1rem 0 .6rem 0
}

.splash-brand .logo {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: rgba(11, 14, 36, 1);
  font-weight: 900;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3)
}

.splash-brand .brand-title {
  font-weight: 800;
  font-size: 18px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent
}

.splash-brand .brand-sub {
  color: rgba(198, 207, 247, 1);
  font-size: 12px
}

.splash-hint {
  margin-top: .5rem;
  color: rgba(154, 163, 199, 1);
  font-size: 12px;
  opacity: .9
}

.stage-info {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: .5rem;
  text-align: center
}

.progress-bar {
  height: 12px;
  background: rgba(14, 19, 49, 1);
  border: 1px solid rgba(39, 48, 112, 1);
  border-radius: 8px;
  overflow: hidden
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2))
}

.progress-meta {
  display: flex;
  justify-content: flex-end;
  color: rgba(198, 207, 247, 1);
  font-size: 12px;
  margin-top: .4rem
}

.progress-meta #progressLabel {
  display: none
}

/* removed spinner for single progress bar */
.pulse {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: .6;
  mix-blend-mode: screen;
  display: none
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 20, .72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20
}

.modal.open {
  display: flex
}

.modal-card {
  width: min(900px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  background: rgba(15, 19, 48, 1);
  border: 1px solid rgba(42, 52, 114, 1);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5)
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem
}

.modal-title {
  font-weight: 700
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: .75rem;
  min-height: 300px
}

.modal#helpModal .modal-body,
.modal#aboutModal .modal-body {
  grid-template-columns: 1fr
}

.modal textarea {
  width: 100%;
  height: 50vh;
  resize: vertical;
  background: rgba(14, 21, 55, 1);
  color: rgba(233, 238, 255, 1);
  border: 1px solid rgba(43, 52, 114, 1);
  border-radius: 10px;
  padding: .6rem;
  font-family: ui-monospace, monospace;
  font-size: 12px
}

.side {
  background: rgba(14, 19, 49, 1);
  border: 1px solid rgba(39, 48, 112, 1);
  border-radius: 10px;
  padding: .6rem;
  overflow: auto
}

.side h4 {
  margin: .2rem 0 .4rem 0
}

.side p {
  color: rgba(199, 209, 255, 1);
  font-size: 12px;
  line-height: 1.3;
  margin: .2rem 0
}

.filebox {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin: .3rem 0 .6rem 0
}

.error {
  color: var(--danger);
  font-size: 12px;
  min-height: 1.2em
}

/* Search results dropdown */
.searchbar {
  position: relative
}

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: rgba(15, 19, 48, 1);
  border: 1px solid rgba(42, 52, 114, 1);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  z-index: 20;
  max-height: 50vh;
  overflow: auto;
  display: none
}

.search-results .item {
  padding: .4rem .6rem;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: .5rem
}

.search-results .item:hover {
  background: rgba(22, 33, 81, 1)
}

.search-results .name {
  color: rgba(255, 255, 255, 1)
}

.search-results .path {
  color: rgba(154, 163, 199, 1);
  opacity: .9;
  font-size: 12px
}

/* Dark scrollbar for search results */
.search-results {
  scrollbar-color: rgba(26, 32, 69, 1) rgba(11, 14, 36, 1);
  scrollbar-width: thin
}

.search-results::-webkit-scrollbar {
  width: 10px
}

.search-results::-webkit-scrollbar-track {
  background: rgba(11, 14, 36, 1);
  border-radius: 10px
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(26, 32, 69, 1);
  border: 1px solid rgba(42, 52, 114, 1);
  border-radius: 10px
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 48, 112, 1)
}

/* Landing Page Styles */
.landing-page {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(15, 18, 32, 1) 0%, rgba(21, 25, 53, 1) 50%, rgba(14, 16, 37, 1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  backdrop-filter: blur(2px)
}

.landing-content {
  text-align: center;
  max-width: 600px;
  padding: 2rem;
  margin: 2rem
}

.landing-header {
  margin-bottom: 3rem
}

.landing-logo {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: inline-block
}

.landing-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: .5rem
}

.landing-tagline {
  color: rgba(154, 163, 199, 1);
  font-size: 1.1rem;
  margin: 0;
  font-weight: 400
}

.landing-menu {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 3rem
}

.landing-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  min-height: 60px;
  text-decoration: none
}

.landing-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: rgba(15, 18, 32, 1);
  box-shadow: 0 8px 25px rgba(106, 166, 255, .3)
}

.landing-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(106, 166, 255, .4)
}

.landing-btn.secondary {
  background: rgba(21, 25, 53, 1);
  border: 2px solid rgba(42, 49, 109, 1);
  color: rgba(234, 240, 255, 1)
}

.landing-btn.secondary:hover {
  background: rgba(26, 33, 74, 1);
  border-color: rgba(49, 65, 147, 1);
  transform: translateY(-1px)
}

.btn-icon {
  font-size: 1.5rem;
  pointer-events: none
}

.btn-text {
  white-space: nowrap;
  pointer-events: none
}

.btn-hint {
  font-size: 0.75rem;
  opacity: 0.8;
  font-weight: 400;
  color: rgba(15, 18, 32, 0.7);
  pointer-events: none
}

.landing-btn.primary .btn-hint {
  color: rgba(15, 18, 32, 0.6)
}

.landing-btn.secondary .btn-hint {
  color: rgba(234, 240, 255, 0.6)
}

/* Initially hide buttons that may be disabled by settings */

.landing-footer {
  color: rgba(154, 163, 199, 1);
  font-size: .9rem;
  margin-top: 2rem
}

.landing-footer kbd {
  background: rgba(21, 25, 53, 1);
  border: 1px solid rgba(42, 49, 109, 1);
  border-radius: 4px;
  padding: .2rem .4rem;
  font-size: .8rem;
  color: rgba(200, 210, 255, 1);
  margin: 0 .2rem
}