:root {
  --bg: #080b0e;
  --s: #0d1014;
  --s2: #12161c;
  --bd: rgba(255, 255, 255, 0.06);
  --am: #f0a500;
  --gn: #22c55e;
  --tx: #ddd8d0;
  --mt: #3e3a35;
  --title-offset: calc(clamp(28px, 4vw, 44px) + 0.45rem);
}
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  min-height: 100%;
}
body {
  background: var(--bg);
  color: var(--tx);
  font-family: "DM Sans", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.06) 3px,
    rgba(0, 0, 0, 0.06) 4px
  );
}
body::after {
  content: "";
  position: fixed;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 350px;
  pointer-events: none;
  background: radial-gradient(
    ellipse,
    rgba(240, 165, 0, 0.04),
    transparent 70%
  );
  transition: opacity 0.3s;
}
body.lit::after {
  opacity: 3;
}
.page {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.8rem 0.8rem;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100vh;
}
header {
  text-align: center;
  margin-bottom: 0.45rem;
  flex-shrink: 0;
}
header h1 {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0.14em;
  color: var(--am);
  line-height: 1;
  text-shadow: 0 0 30px rgba(240, 165, 0, 0.25);
}
.top {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 9px;
  margin-bottom: 10px;
  align-items: stretch;
  flex-shrink: 0;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(390px, 28vw, 460px);
  gap: 10px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}
.side {
  display: flex;
  flex-direction: column;
  height: calc(100% - var(--title-offset));
  margin-top: var(--title-offset);
  min-height: 0;
}
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.ld {
  font-family: "Bebas Neue", sans-serif;
  font-size: 54px;
  color: var(--am);
  text-shadow: 0 0 14px rgba(240, 165, 0, 0.4);
  background: var(--s);
  border: 1px solid var(--bd);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ld.pop {
  animation: pop 0.18s ease;
}
@keyframes pop {
  0% {
    transform: scale(1.4);
    text-shadow: 0 0 40px rgba(240, 165, 0, 0.9);
  }
  100% {
    transform: scale(1);
  }
}
.cb {
  background: var(--s);
  border: 1px solid var(--bd);
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  min-height: 70px;
}
.cs {
  font-family: "Share Tech Mono", monospace;
  font-size: 26px;
  color: var(--am);
  display: flex;
  gap: 6px;
  align-items: center;
}
.sym.n {
  animation: si 0.12s ease;
}
@keyframes si {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.db {
  grid-column: 1 / -1;
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: 3px;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 14px;
  gap: 12px;
}
.dl {
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: var(--mt);
  letter-spacing: 0.2em;
  flex-shrink: 0;
}
.dt {
  font-family: "Bebas Neue", sans-serif;
  font-size: 28px;
  color: var(--tx);
  letter-spacing: 0.12em;
  word-break: break-all;
  overflow: hidden;
}
.sb {
  background: var(--s);
  border: 1px solid var(--bd);
  border-radius: 3px;
  height: 34px;
  overflow: hidden;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.si {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 10px;
  gap: 7px;
}
.sd {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #0a1510;
  border: 1px solid rgba(34, 197, 94, 0.35);
  box-shadow: inset 0 0 0 6px var(--gn), 0 0 5px rgba(34, 197, 94, 0.5);
  animation: dotFill 0.24s ease-out both;
}
.ss {
  width: 30px;
  height: 11px;
  border-radius: 3px;
  background: #110e06;
  border: 1px solid rgba(240, 165, 0, 0.35);
  box-shadow: 0 0 5px rgba(240, 165, 0, 0.35);
  overflow: hidden;
  position: relative;
}
.ss::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 2px;
  background: var(--am);
  box-shadow: 0 0 6px rgba(240, 165, 0, 0.7);
  transform: scaleX(0);
  transform-origin: left;
  animation: dashFill 0.28s ease-out forwards;
}
@keyframes dotFill {
  from {
    box-shadow: inset 0 0 0 0 var(--gn), 0 0 0 rgba(34, 197, 94, 0);
    opacity: 0;
  }
  to {
    box-shadow:
      inset 0 0 0 6px var(--gn),
      0 0 5px rgba(34, 197, 94, 0.5);
    opacity: 1;
  }
}
@keyframes dashFill {
  to {
    transform: scaleX(1);
  }
}
.kb {
  width: 100%;
  padding: 20px 16px;
  font-family: "Share Tech Mono", monospace;
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tx);
  background: var(--s);
  border: 1px solid rgba(240, 165, 0, 0.25);
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
  transition:
    border-color 0.08s,
    box-shadow 0.08s;
  flex-shrink: 0;
}
.kb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--am);
  opacity: 0;
  transition: opacity 0.08s;
}
.kb span {
  position: relative;
  z-index: 1;
}
.kb.a {
  border-color: var(--am);
  box-shadow: 0 0 18px rgba(240, 165, 0, 0.2);
}
.kb.a::before {
  opacity: 0.07;
}
.kb:focus,
.cb2:focus {
  outline: none;
}
.kb:focus-visible,
.cb2:focus-visible {
  outline: none;
  border-color: rgba(240, 165, 0, 0.45);
  box-shadow: 0 0 12px rgba(240, 165, 0, 0.12);
}
.ct {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.cb2 {
  width: 100%;
  padding: 14px 12px;
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mt);
  background: transparent;
  border: 1px solid var(--bd);
  border-radius: 3px;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.cb2:hover {
  color: var(--am);
  border-color: rgba(240, 165, 0, 0.3);
}
.st {
  font-family: "Share Tech Mono", monospace;
  font-size: 13px;
  color: var(--mt);
  text-align: left;
  min-height: 18px;
  margin-bottom: 14px;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.st.f {
  color: var(--am);
}
.tw {
  background: var(--s);
  border: 1px solid var(--bd);
  border-radius: 3px;
  padding: 4px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#tree {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
}
#tree line,
#tree circle,
#tree rect,
#tree text {
  transition:
    fill 0.22s ease,
    stroke 0.22s ease,
    stroke-width 0.22s ease,
    opacity 0.22s ease;
}
.bt {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: var(--mt);
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.bt span {
  padding: 8px 10px;
  background: var(--s);
  border: 1px solid var(--bd);
  border-radius: 3px;
}
@media (max-width: 900px) {
  body {
    align-items: stretch;
  }
  .page {
    padding: 0.8rem;
    height: auto;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .tw {
    min-height: 58vh;
  }
  .side {
    order: -1;
    height: auto;
    margin-top: 0;
  }
  .ct,
  .bt {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .cb2,
  .bt span {
    flex: 1 1 145px;
  }
  .st {
    text-align: center;
  }
}
