body {
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8vh 20px;
  position: relative;
}

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(3px);
  box-shadow: 0 0 40px rgba(57, 255, 136, 0.08), inset 0 0 60px rgba(0,0,0,0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 84vh;
  height: 84dvh;
  max-height: 720px;
}

main.party-mode {
  animation: partyGlow 0.7s linear infinite;
}
@keyframes partyGlow {
  0%   { box-shadow: 0 0 40px 4px rgba(255, 60, 60, 0.55), inset 0 0 60px rgba(0,0,0,0.35); }
  20%  { box-shadow: 0 0 40px 4px rgba(255, 170, 40, 0.55), inset 0 0 60px rgba(0,0,0,0.35); }
  40%  { box-shadow: 0 0 40px 4px rgba(255, 240, 40, 0.55), inset 0 0 60px rgba(0,0,0,0.35); }
  60%  { box-shadow: 0 0 40px 4px rgba(60, 255, 140, 0.55), inset 0 0 60px rgba(0,0,0,0.35); }
  80%  { box-shadow: 0 0 40px 4px rgba(60, 160, 255, 0.55), inset 0 0 60px rgba(0,0,0,0.35); }
  100% { box-shadow: 0 0 40px 4px rgba(220, 60, 255, 0.55), inset 0 0 60px rgba(0,0,0,0.35); }
}

main.crashing {
  transition: transform 0.6s ease, opacity 0.6s ease;
  transform: scale(0.85);
  opacity: 0;
}

.crash-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #050505;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.crash-screen.show { opacity: 1; pointer-events: auto; }
.crash-code {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}
.crash-title {
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 700;
  color: var(--err);
  letter-spacing: 0.04em;
  text-shadow: 0 0 20px rgba(255, 107, 107, 0.45);
}
.crash-btn {
  margin-top: 8px;
  padding: 10px 22px;
  border: 1px solid var(--err);
  border-radius: 6px;
  background: none;
  color: var(--err);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.crash-btn:hover { background: var(--err); color: #1a0505; }

.whiteout {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 3.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.whiteout.active { opacity: 1; pointer-events: auto; }
.whiteout-content {
  text-align: center;
  opacity: 0;
  transition: opacity 0.8s ease 2.6s;
}
.whiteout.active .whiteout-content { opacity: 1; }
.whiteout-title {
  font-size: clamp(1.3rem, 6vw, 2rem);
  font-weight: 700;
  color: #111;
  letter-spacing: 0.03em;
}
.whiteout-btn {
  margin-top: 16px;
  padding: 10px 22px;
  border: 1px solid #111;
  border-radius: 6px;
  background: none;
  color: #111;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.whiteout-btn:hover { background: #111; color: #fff; }

.titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(57, 255, 136, 0.05);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.dot { width: 11px; height: 11px; border-radius: 50%; opacity: 0.75; }
.dot.r { background: #ff5f56; }
.dot.y { background: #ffbd2e; }
.dot.g { background: #27c93f; }
.titlebar span.path {
  margin-left: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.term {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 20px 14px;
  cursor: text;
}

#output {
  flex: 1 1 auto;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.65;
  padding-right: 4px;
}
#output::-webkit-scrollbar { width: 8px; }
#output::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
#output::-webkit-scrollbar-track { background: transparent; }

.motd { color: var(--muted); margin-bottom: 14px; }
.motd strong { color: var(--accent); }

.histline { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.histline .prompt { color: var(--accent); white-space: nowrap; }
.histline .cmdtext { color: var(--fg); word-break: break-all; }

.result { margin: 4px 0 2px 0; white-space: pre-wrap; word-break: break-word; }
.result.err { color: var(--err); }
.result.dim { color: var(--muted); }
.result a { color: var(--accent); text-decoration: underline; }
.result a:hover { color: #7dffb0; }

.kv { display: flex; gap: 10px; }
.kv .k { color: var(--accent); min-width: 92px; flex: 0 0 auto; }

.inputline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  flex: 0 0 auto;
}
.inputline .prompt { color: var(--accent); white-space: nowrap; font-size: 0.88rem; }
.inputline input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font: inherit;
  font-size: 0.88rem;
  caret-color: var(--accent);
}
.send-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.send-btn:hover, .send-btn:active { background: rgba(57, 255, 136, 0.12); border-color: var(--accent); }

@media (max-width: 480px) {
  body { padding: 4vh 10px; }
  main { height: 90vh; height: 90dvh; }
  .term { padding: 14px 14px 10px; }
  .inputline input { font-size: 16px; }
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: opacity 0.9s ease;
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash-domain {
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-shadow: 0 0 18px rgba(57, 255, 136, 0.45);
}
.splash-name {
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: var(--fg);
  opacity: 0.85;
}
.splash-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: middle;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
