html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}



* { box-sizing: border-box; }
html, body, #root, #app { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 20%, var(--glow-b), transparent 50%),
    var(--bg);
}
a { color: var(--accent-soft); }
.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.75rem 0.9rem 1.75rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: relative;
  z-index: 50;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.55rem 0.65rem;
  align-items: center;
  padding: 0.55rem 0 0.9rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.15rem;
}
.logo {
  position: relative;
  z-index: 51;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--text);
  font-size: 1.05rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.nav-toggle {
  position: relative;
  z-index: 51;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.nav-toggle:hover,
.nav-toggle:focus-visible {
  color: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}
.nav-toggle-bars {
  position: relative;
  display: block;
  width: 1rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: background-color 0.2s ease;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 1rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.2s ease;
}
.nav-toggle-bars::before { transform: translateY(-5px); }
.nav-toggle-bars::after { transform: translateY(5px); }
.topbar.is-nav-open .nav-toggle-bars { background: transparent; }
.topbar.is-nav-open .nav-toggle-bars::before { transform: translateY(0) rotate(45deg); }
.topbar.is-nav-open .nav-toggle-bars::after { transform: translateY(0) rotate(-45deg); }
.topbar.is-nav-open { border-bottom-color: transparent; }
.menu-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding:
    calc(4.75rem + env(safe-area-inset-top, 0px))
    0.9rem
    calc(0.9rem + env(safe-area-inset-bottom, 0px));
  border: none;
  border-radius: 0;
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 20%, var(--glow-b), transparent 50%),
    var(--bg);
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease;
}
.topbar.is-nav-open .menu-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  font-size: 1rem;
}
.nav a.active, .nav a:hover {
  color: var(--on-accent);
  background: var(--accent);
}
.topbar-controls {
  display: flex;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.topbar-controls .switch--icon[data-tip]::after { display: none; }
.switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  line-height: 1.2;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
html.is-nav-open { overflow: hidden; }
@media (min-width: 860px) {
  .shell { padding: 1rem 1.1rem 2rem; }
  .topbar {
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding: 0.75rem 0 1.25rem;
    margin-bottom: 1.5rem;
  }
  .logo { font-size: 1.15rem; }
  .nav-toggle { display: none; }
  .menu-panel {
    position: static;
    inset: auto;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    display: flex;
    flex-direction: row;
    flex: 1;
    align-items: center;
    gap: 0.75rem 1rem;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition: none;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1;
    overflow: visible;
    gap: 0.35rem;
  }
  .nav a {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.92rem;
  }
  .topbar-controls {
    width: auto;
    margin-top: 0;
    margin-left: auto;
    padding-top: 0;
    border-top: none;
    justify-content: flex-start;
    gap: 0.4rem;
  }
  .topbar-controls .switch--icon[data-tip]::after { display: block; }
  .switch {
    min-height: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }
  .switch--icon {
    width: 2.2rem;
    height: 2.2rem;
    min-height: 0;
  }
  html.is-nav-open { overflow: auto; }
}
.switch:hover {
  color: var(--accent-soft);
  border-color: var(--accent);
}

.switch--icon {
  position: relative;
  width: 2.4rem;
  height: 2.4rem;
  min-height: 2.4rem;
  padding: 0;
}

.switch--icon svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.switch--icon .icon-sun {
  display: none;
}

html[data-theme="light"] .switch--icon .icon-moon {
  display: none;
}

html[data-theme="light"] .switch--icon .icon-sun {
  display: block;
}

.switch--icon[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: 12rem;
  padding: 0.35rem 0.55rem;
  border-radius: 0.45rem;
  background: var(--text);
  color: var(--bg);
  font-size: 0.75rem;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.topbar-controls .switch--icon:last-child[data-tip]::after {
  left: auto;
  right: 0;
  transform: translateY(-4px);
}

.switch--icon[data-tip]:hover::after,
.switch--icon[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.topbar-controls .switch--icon:last-child[data-tip]:hover::after,
.topbar-controls .switch--icon:last-child[data-tip]:focus-visible::after {
  transform: translateY(0);
}
.content { flex: 1; }
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}
.footer-contacts a {
  color: inherit;
  text-decoration: none;
}
.footer-contacts a:hover { color: var(--text); }
.badge { color: var(--accent-soft); font-weight: 600; }
h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
}
h2 { margin: 0 0 0.75rem; font-size: 1.2rem; }
.lead, .muted { color: var(--muted); line-height: 1.55; }
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0; }
.chip {
  background: var(--bg-soft);
  color: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.stack { display: grid; gap: 0.85rem; }
.cases { margin-top: 2.75rem; }
.cases > h2 { margin: 0 0 0.35rem; }
.cases > .lead { margin: 0 0 1rem; }
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  border-radius: 10px;
  padding: 0.55rem 0.95rem;
  font-size: 0.95rem;
  font-family: inherit;
}
.btn.ghost {
  background: transparent;
  color: var(--accent-soft);
  border: 1px solid var(--border);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
input,
textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  font: inherit;
}
textarea {
  resize: vertical;
  max-width: 100%;
}
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.form { display: grid; gap: 0.75rem; }
.game-board {
  position: relative;
  height: 280px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--bg-soft);
  overflow: hidden;
  user-select: none;
}
.bug {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: radial-gradient(circle at 30% 30%, var(--accent-soft), var(--accent) 55%, #2a8fad);
  box-shadow: 0 0 0 3px rgba(97, 218, 251, 0.25);
  font-size: 1.2rem;
}
.stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 1rem;
  color: var(--muted);
}
.stats strong { color: var(--text); }
.severity {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-weight: 700;
}
.severity.critical { background: rgba(255, 107, 138, 0.2); color: var(--danger); }
.severity.warning { background: rgba(97, 218, 251, 0.18); color: var(--accent-soft); }
.severity.info { background: rgba(92, 224, 168, 0.15); color: var(--ok); }

.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td {
  text-align: left;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--border);
}
.table th { color: var(--muted); font-weight: 600; }
.msg { white-space: pre-wrap; line-height: 1.45; }
.error { color: var(--danger); }
.row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.incident-card {
  transition: opacity 0.38s ease, transform 0.38s ease, max-height 0.38s ease, margin 0.38s ease, padding 0.38s ease, border-width 0.38s ease;
  max-height: 280px;
  overflow: hidden;
}

.incident-card.is-leaving {
  opacity: 0;
  transform: translateX(56px) scale(0.98);
  max-height: 0;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0;
  pointer-events: none;
}

.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  display: grid;
  gap: 0.55rem;
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.28s ease;
}

.toast.is-hiding {
  animation: toast-out 0.28s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(8px); }
}

/* --- Bug Hunt / VS Code chrome --- */
.vscode {
  border: 1px solid #2b2b2b;
  border-radius: 10px;
  overflow: hidden;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: Consolas, "Courier New", monospace;
  box-shadow: var(--shadow);
  margin: 1rem 0;
}
.vscode-titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: #323233;
  font-size: 0.78rem;
  color: #cccccc;
  font-family: var(--font);
}
.vscode-dots { display: flex; gap: 6px; margin-right: 0.4rem; }
.vscode-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: #555;
}
.vscode-dots span:nth-child(1) { background: #ff5f56; }
.vscode-dots span:nth-child(2) { background: #ffbd2e; }
.vscode-dots span:nth-child(3) { background: #27c93f; }
.vscode-body { display: grid; grid-template-columns: 180px 1fr; min-height: 320px; }
@media (max-width: 720px) {
  .vscode-body { grid-template-columns: 1fr; }
  .vscode-sidebar { display: none; }
}
.vscode-sidebar {
  background: #252526;
  border-right: 1px solid #1e1e1e;
  padding: 0.6rem 0;
  font-family: var(--font);
  font-size: 0.82rem;
}
.vscode-sidebar .side-label {
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  padding: 0.2rem 0.8rem 0.5rem;
}
.vscode-file {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #ccc;
  padding: 0.28rem 0.8rem;
  cursor: default;
  font: inherit;
}
.vscode-file.current {
  background: #37373d;
  color: #fff;
  border-left: 2px solid var(--accent);
  padding-left: calc(0.8rem - 2px);
}
.vscode-file.done { color: #6a9955; }
.vscode-main { display: flex; flex-direction: column; min-width: 0; }
.vscode-tabs {
  display: flex;
  background: #2d2d2d;
  border-bottom: 1px solid #1e1e1e;
  font-family: var(--font);
  font-size: 0.82rem;
}
.vscode-tab {
  padding: 0.45rem 0.9rem;
  background: #1e1e1e;
  color: #fff;
  border-right: 1px solid #2d2d2d;
}
.vscode-editor {
  flex: 1;
  overflow: auto;
  padding: 0.4rem 0;
  max-height: 380px;
}
.vscode-line {
  display: grid;
  grid-template-columns: 48px 1fr;
  cursor: pointer;
  line-height: 1.45;
  font-size: 0.86rem;
}
button.vscode-line {
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus {
  transform: translateY(0);
}

.vscode-line:hover { background: #2a2d2e; }
.vscode-line.is-bug { background: rgba(244, 71, 71, 0.12); }
.vscode-line.is-wrong {
  animation: line-shake 0.35s ease;
  background: rgba(244, 71, 71, 0.22);
}
.vscode-line.is-found {
  background: rgba(78, 201, 176, 0.12);
}
.vscode-gutter {
  color: #858585;
  text-align: right;
  padding: 0 0.7rem 0 0.4rem;
  user-select: none;
}
.vscode-code {
  white-space: pre;
  padding-right: 1rem;
  overflow-x: auto;
}
.vscode-status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.35rem 0.75rem;
  background: #007acc;
  color: #fff;
  font-family: var(--font);
  font-size: 0.78rem;
}
.vscode-status .accent-bar { background: var(--accent); color: #111; }
.fix-panel {
  border-top: 1px solid #333;
  background: #252526;
  padding: 0.85rem 1rem;
  font-family: var(--font);
}
.fix-panel h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  color: #fff;
}
.fix-options { display: grid; gap: 0.45rem; }
.fix-options button {
  text-align: left;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
  background: #1e1e1e;
  color: #d4d4d4;
  border: 1px solid #3c3c3c;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
}
.fix-options button:hover {
  border-color: var(--accent);
  color: #fff;
}
.hunt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 0.75rem 0 0.25rem;
}
.hunt-toolbar .timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-soft);
}
@keyframes line-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.hunt-hint {
  margin: 0.5rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}
.hunt-hint strong { color: var(--accent-soft); }

/* Page route transitions only (Vue Transition / React page key). Shared atoms (.chip/.card) stay static. */
.page {
  animation: page-in 0.34s ease both;
}
.page.is-leaving {
  animation: page-out 0.18s ease both;
}

.page-enter-active,
.page-leave-active {
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.page-enter-from {
  opacity: 0;
  transform: translateY(14px);
}
.page-leave-to {
  opacity: 0;
  transform: translateY(-10px);
}

.incident-card {
  transition: opacity 0.38s ease, transform 0.38s ease, max-height 0.38s ease, margin 0.38s ease, padding 0.38s ease, border-width 0.38s ease;
}
.incident-card.is-leaving {
  animation: none !important;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes page-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-8px); }
}

@media (max-width: 859px) {
  .page,
  .page.is-leaving {
    animation: none !important;
  }
  .page-enter-active,
  .page-leave-active {
    transition: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page,
  .page.is-leaving {
    animation: none !important;
  }
  .page-enter-active,
  .page-leave-active {
    transition: none !important;
  }
  .menu-panel {
    transition: none !important;
  }
}
