@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;800&family=Space+Grotesk:wght@400;500;700&family=IBM+Plex+Mono:wght@400;500;700&display=swap");

:root {
  --bg-0: #02040a;
  --bg-1: #071127;
  --bg-2: #0e1d37;
  --panel: rgba(6, 13, 24, 0.76);
  --panel-border: rgba(115, 188, 255, 0.32);
  --text: #e2f3ff;
  --muted: #82a3c6;
  --accent: #4dfff2;
  --accent-2: #73a8ff;
  --danger: #ff6f8f;
  --ok: #7bff9c;
  --glow: 0 18px 44px rgba(17, 167, 255, 0.26), 0 0 36px rgba(77, 255, 242, 0.14);
}

body[data-theme="sunrise"] {
  --bg-0: #120d16;
  --bg-1: #281539;
  --bg-2: #3f264c;
  --accent: #72f6ff;
  --accent-2: #ffa885;
  --panel-border: rgba(255, 176, 143, 0.4);
}

body[data-theme="daylight"] {
  --bg-0: #051324;
  --bg-1: #0a2842;
  --bg-2: #103c61;
  --accent: #50fff2;
  --accent-2: #8bc3ff;
  --panel-border: rgba(122, 201, 255, 0.45);
}

body[data-theme="nightfall"] {
  --bg-0: #02040a;
  --bg-1: #050b17;
  --bg-2: #090f1f;
  --accent: #72f5d9;
  --accent-2: #73a8ff;
  --panel-border: rgba(101, 161, 255, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 680px at 8% 12%, rgba(77, 255, 242, 0.09), transparent 60%),
    radial-gradient(980px 720px at 86% -8%, rgba(119, 168, 255, 0.17), transparent 58%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 42%, var(--bg-2) 100%);
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.skip-link,
.sr-only {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  left: 10px;
  top: 10px;
  width: auto;
  height: auto;
  z-index: 40;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0e2038;
  color: #fff;
}

.main-layout {
  position: relative;
  z-index: 1;
  width: min(1060px, 100%);
  margin: 0 auto;
}


.terminal-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0) 45%),
    var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-style: preserve-3d;
  transition: transform 0.32s ease, box-shadow 0.32s ease, border-color 0.32s ease;
}

.terminal-shell::before {
  content: "";
  position: absolute;
  inset: -140% -50%;
  background: conic-gradient(from 170deg at 50% 50%, transparent 0deg, rgba(94, 170, 255, 0.2) 70deg, transparent 140deg, rgba(79, 255, 245, 0.15) 220deg, transparent 360deg);
  animation: rotateField 22s linear infinite;
  pointer-events: none;
}

.terminal-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(137, 213, 255, 0.14);
  border-radius: 18px;
  pointer-events: none;
}

.terminal-shell.is-command-ok {
  box-shadow: 0 20px 45px rgba(0, 255, 176, 0.18), 0 0 24px rgba(0, 255, 176, 0.26);
  border-color: rgba(117, 255, 180, 0.62);
}

.terminal-shell.is-command-error {
  box-shadow: 0 22px 46px rgba(255, 63, 105, 0.26), 0 0 26px rgba(255, 63, 105, 0.3);
  border-color: rgba(255, 112, 148, 0.68);
}

.terminal-shell.is-voice-hot .voice-trigger {
  border-color: rgba(255, 168, 84, 0.88);
  color: #ffd8a6;
  box-shadow: 0 0 18px rgba(255, 162, 72, 0.36);
}

.terminal-header {
  position: relative;
  z-index: 2;
  min-height: 58px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(130, 181, 255, 0.24);
  padding: 10px 16px;
  background: rgba(4, 11, 21, 0.82);
}

.header-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 14px currentColor;
}

.dot.red {
  background: #ff597b;
  color: #ff597b;
}

.dot.yellow {
  background: #ffd866;
  color: #ffd866;
}

.dot.green {
  background: #6aff94;
  color: #6aff94;
}

.header-title {
  margin: 0;
  font-family: "Orbitron", "Space Grotesk", sans-serif;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  color: #b8d8ff;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 8px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(113, 173, 255, 0.36);
  border-radius: 999px;
  background: rgba(7, 18, 33, 0.8);
  color: #afcdf0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-chip-clock {
  min-width: 86px;
  justify-content: center;
}

.status-chip.is-error {
  border-color: rgba(255, 112, 148, 0.72);
  color: #ffc3d0;
}

.status-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px rgba(123, 255, 156, 0.8);
  animation: pulse 1.4s ease-in-out infinite;
}

.header-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-menu-toggle {
  display: none;
  margin-left: auto;
  width: 36px;
  height: 30px;
  border: 1px solid rgba(114, 170, 255, 0.48);
  border-radius: 8px;
  background: rgba(13, 24, 40, 0.92);
  cursor: pointer;
  padding: 6px 7px;
}

.header-menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  margin: 3px 0;
  background: #d8ecff;
  border-radius: 999px;
}

.auto-type-switch {
  min-width: 136px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 6px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  user-select: none;
  cursor: pointer;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.auto-type-label {
  white-space: nowrap;
}

#auto-type-toggle,
#typing-animation-toggle,
#hyper-fx-toggle {
  appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(120, 175, 255, 0.52);
  background: rgba(22, 44, 72, 0.9);
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  justify-self: end;
}

#auto-type-toggle::after,
#typing-animation-toggle::after,
#hyper-fx-toggle::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #c7dfff;
  box-shadow: 0 0 12px rgba(199, 223, 255, 0.6);
  transition: left 0.2s ease, background-color 0.2s ease;
}

#auto-type-toggle:checked,
#typing-animation-toggle:checked,
#hyper-fx-toggle:checked {
  background: rgba(77, 255, 242, 0.28);
  border-color: rgba(77, 255, 242, 0.8);
}

#auto-type-toggle:checked::after,
#typing-animation-toggle:checked::after,
#hyper-fx-toggle:checked::after {
  left: 17px;
  background: var(--accent);
}

.terminal-output {
  position: relative;
  min-height: 56vh;
  max-height: 71vh;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px 20px 12px;
  line-height: 1.55;
  scrollbar-width: thin;
  z-index: 1;
}


.terminal-output::before {
  content: "";
  position: sticky;
  top: 0;
  display: block;
  height: 18px;
  margin-top: -22px;
  background: linear-gradient(180deg, rgba(3, 10, 19, 0.92), transparent);
  pointer-events: none;
  z-index: 2;
}

.output-entry {
  margin-bottom: 14px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(7, 16, 31, 0.38);
  border: 1px solid rgba(121, 175, 255, 0.1);
  animation: entryReveal 260ms ease;
}

.output-entry.is-local {
  border-color: rgba(77, 255, 242, 0.35);
}

.output-command {
  color: #75fff4;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.output-line {
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  font-family: "IBM Plex Mono", monospace;
  color: #e4f4ff;
}

.output-line + .output-line {
  margin-top: 5px;
}

.output-panel {
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(127, 183, 255, 0.34);
  background: rgba(3, 12, 24, 0.7);
}

.output-panel-title {
  margin: 0 0 6px;
  font: 700 0.88rem/1.25 "Orbitron", sans-serif;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-transform: uppercase;
}

.output-panel p {
  margin: 0;
  font: 400 0.86rem/1.5 "IBM Plex Mono", monospace;
  color: #c7dcf5;
}

.output-panel + .output-panel {
  margin-top: 9px;
}

.typed-cursor {
  color: #89fff7;
}

.output-link {
  color: #8ac9ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.output-link:hover {
  color: #b8deff;
}

.output-error {
  color: var(--danger);
}

.output-loading {
  color: #8db2db;
}

.terminal-input-row {
  order: 3;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 13px 16px;
  padding-bottom: calc(13px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(124, 177, 255, 0.24);
  background: rgba(3, 10, 20, 0.88);
  position: sticky;
  bottom: 0;
  z-index: 3;
}

.prompt {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
}

#command-input {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: 500 clamp(14px, 1.5vw, 16px)/1.4 "IBM Plex Mono", monospace;
}

#command-input::placeholder {
  color: #6582a4;
}

.command-submit,
.voice-trigger {
  border: 1px solid rgba(107, 169, 255, 0.55);
  background: rgba(8, 22, 41, 0.95);
  color: #b1d8ff;
  border-radius: 8px;
  font: 700 0.72rem/1 "Orbitron", sans-serif;
  letter-spacing: 0.06em;
  padding: 10px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.command-submit {
  min-width: 74px;
}

.voice-trigger {
  color: #ff5c7a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  letter-spacing: 0;
  min-width: 52px;
}

.command-submit:hover,
.voice-trigger:hover {
  border-color: rgba(130, 213, 255, 0.8);
}

.command-submit:hover {
  color: #d8f5ff;
}

.voice-trigger:hover {
  color: #ff8ba0;
}

.terminal-suggestion {
  order: 2;
  min-height: 24px;
  padding: 0 16px 12px;
  color: #84a7ce;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.79rem;
  letter-spacing: 0.02em;
  background: rgba(3, 10, 20, 0.74);
}

.achievement-toast {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 22px));
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(104, 225, 255, 0.62);
  background: rgba(5, 15, 29, 0.95);
  color: #d1ebff;
  font: 500 0.84rem/1.45 "IBM Plex Mono", monospace;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.achievement-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.achievement-toast strong {
  display: block;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
  color: #86fff3;
}

.seo-content {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

body.is-glitch .terminal-shell {
  filter: hue-rotate(18deg) contrast(1.08);
}

.hyper-mode-off .terminal-shell::before,
.hyper-mode-off {
  animation: none;
  opacity: 0.08;
}

.hyper-mode-off .output-entry {
  animation: none;
}

@keyframes entryReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.78;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes rotateField {
  to {
    transform: rotate(1turn);
  }
}

@media (max-width: 1120px) {
  .header-status {
    display: none;
  }

  .header-menu-toggle {
    display: inline-block;
  }

  .header-controls {
    position: absolute;
    top: calc(100% + 8px);
    right: 12px;
    width: min(300px, calc(100vw - 24px));
    margin-left: 0;
    padding: 10px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    border: 1px solid rgba(110, 168, 255, 0.48);
    border-radius: 10px;
    background: rgba(4, 12, 23, 0.97);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.48);
  }

  .header-controls.is-open {
    display: flex;
  }

  .auto-type-switch {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 980px) {
  .terminal-header {
    gap: 10px;
  }

  .header-title {
    font-size: 0.78rem;
  }

  .header-controls {
    gap: 8px;
  }

}

@media (max-width: 860px) {
  .auto-type-switch {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 700px) {
  body {
    padding: 0;
  }

  .terminal-shell {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    min-height: 100dvh;
  }
  .terminal-header {
    position: relative;
    z-index: 5;
    gap: 10px;
  }

  .terminal-output {
    min-height: 0;
    max-height: none;
    padding-top: 16px;
  }

  .terminal-input-row,
  .terminal-suggestion {
    background: rgba(3, 10, 20, 0.95);
  }

  .command-submit,
  .voice-trigger {
    min-width: 48px;
    padding: 9px 8px;
  }

  .achievement-toast {
    right: 10px;
    bottom: 10px;
    font-size: 0.8rem;
  }
}

@media (max-width: 520px) {
  .terminal-header {
    padding: 10px 12px;
  }

  .terminal-output {
    padding: 14px 12px 10px;
  }

  .terminal-input-row {
    padding: 11px 12px;
    gap: 8px;
  }

  #command-input {
    font-size: 16px;
  }

  .command-submit,
  .voice-trigger {
    min-width: 44px;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
  }

  .terminal-suggestion {
    padding: 0 12px 10px;
    font-size: 0.75rem;
  }
}

@media (max-width: 390px) {
  .header-title {
    font-size: 0.72rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
