:root {
  color-scheme: light;
  --bg: #f3f6f9;
  --panel: #ffffff;
  --text: #14202b;
  --muted: #5d6b78;
  --accent: #0b5cab;
  --line: #dce3ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #dceefe, var(--bg) 46%);
}

#app {
  display: block;
  min-height: 100vh;
}

#panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 340px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
  z-index: 1100;
  transition: transform 0.22s ease, opacity 0.22s ease;
  box-shadow: 0 8px 26px rgba(20, 32, 43, 0.16);
}

#panelToggleBtn {
  position: fixed;
  top: 12px;
  left: 352px;
  width: auto;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid #b8cadb;
  background: #ffffff;
  color: #18324a;
  z-index: 1200;
  box-shadow: 0 4px 14px rgba(20, 32, 43, 0.12);
}

body.panel-collapsed #panel {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

body.panel-collapsed #panelToggleBtn {
  left: 12px;
}

h1 {
  margin: 0 0 6px;
  font-size: 20px;
}

.muted {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.mini-map-instruction {
  margin: 10px 0 4px;
  font-size: 12px;
  color: #334250;
}

#miniMap {
  width: 100%;
  height: 180px;
  border: 1px solid #c5d2df;
  border-radius: 10px;
  overflow: hidden;
}

.search-results {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #d8e1ea;
  border-radius: 8px;
  background: #fff;
  margin-top: 6px;
  display: none;
}

.search-results.visible {
  display: block;
}

.search-result-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #eef3f8;
  border-radius: 0;
  background: #fff;
  padding: 9px 10px;
  cursor: pointer;
}

.search-result-item:last-child {
  border-bottom: 0;
}

.search-result-item:hover {
  background: #f1f7ff;
}

label {
  display: block;
  font-size: 12px;
  margin: 8px 0 4px;
  color: #334250;
}

input,
select,
button {
  width: 100%;
  border: 1px solid #c5d2df;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.row-single {
  grid-template-columns: 1fr;
}

.actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.debug-panel {
  margin-top: 10px;
  border: 1px solid #d8e1ea;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfdff;
}

.debug-panel summary {
  cursor: pointer;
  font-size: 12px;
  color: #334250;
  font-weight: 600;
}

.debug-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.debug-toggle {
  margin: 0;
  font-size: 12px;
  color: #334250;
  display: flex;
  align-items: center;
  gap: 8px;
}

.debug-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
}

button {
  cursor: pointer;
  background: #fff;
}

button#applyBtn {
  border-color: #0b5cab;
  background: #0b5cab;
  color: #fff;
}

button#copyBtn {
  border-color: #0a7a52;
  color: #0a7a52;
}

.status {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 12px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

#viewerContainer {
  width: 100%;
  height: 100vh;
}

#repoLink {
  position: fixed;
  right: 6px;
  bottom: 2px;
  z-index: 1000;
  display: inline;
  padding: 0;
  color: #ffffff;
  font-size: 10px;
  text-shadow: 0 0 2px #000000;
  text-decoration: none;
  opacity: 0.95;
}

#repoLink:hover {
  text-decoration: underline;
  opacity: 1;
}

@media (max-width: 960px) {
  #panelToggleBtn {
    left: 12px;
    top: 12px;
  }

  #panel {
    width: min(92vw, 340px);
  }

  #repoLink {
    right: 6px;
    bottom: 2px;
  }
}
