:root {
  --bg: #08111f;
  --panel: rgba(8, 17, 31, 0.78);
  --panel-strong: rgba(16, 29, 51, 0.96);
  --line: rgba(150, 199, 255, 0.18);
  --text: #e8f1ff;
  --muted: #8fa9c7;
  --accent: #7ef0c2;
  --accent-2: #ffb86b;
  --danger: #ff6b6b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --gold: #ffd36b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(85, 163, 255, 0.18), transparent 40%),
    linear-gradient(135deg, #050a14, #0b1630 55%, #091426);
}

.shell-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  padding: 24px;
  min-height: 100vh;
  height: 100vh;
}

.hud,
.terminal-frame {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hud {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
}

.eyebrow,
.label {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand {
  padding: 4px 4px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand .eyebrow,
.brand h1,
.brand .brand-copy {
  margin: 0;
}

.brand h1 {
  margin-top: 8px;
  font-size: clamp(2rem, 3.8vw, 2.6rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.brand-copy {
  margin-top: 10px;
  color: var(--muted);
  max-width: 24ch;
  line-height: 1.45;
}

.ascii-banner {
  display: none;
  margin: 14px 0 0;
  color: rgba(255, 211, 107, 0.86);
  font-size: 0.8rem;
  line-height: 1.25;
  white-space: pre;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 211, 107, 0.18);
  background: linear-gradient(135deg, rgba(255, 211, 107, 0.1), rgba(126, 240, 194, 0.05));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 26px rgba(0, 0, 0, 0.18);
}

.card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.objective-card p {
  margin: 8px 0 0;
  line-height: 1.4;
}

.objective-header {
  margin-bottom: 10px;
}

#completion-percent {
  color: var(--accent);
  font-size: 0.95rem;
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #b8ffd8);
  transition: width 180ms ease;
}

.objective-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
}

.objective-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.objective-item:first-child {
  border-top: 0;
  padding-top: 2px;
}

.objective-user {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.objective-text {
  line-height: 1.45;
}

.objective-item.is-complete .objective-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.objective-item.is-current .objective-text {
  color: var(--accent);
}

.objective-item.is-bonus .objective-user {
  color: var(--gold);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(126, 240, 194, 0.1);
  border: 1px solid rgba(126, 240, 194, 0.24);
  color: var(--accent);
  font-size: 0.9rem;
}

.cosmetic-list {
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
  max-height: 160px;
  overflow-y: auto;
}

.cosmetic-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cosmetic-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.cosmetic-item strong {
  color: var(--gold);
  font-size: 0.95rem;
}

.cosmetic-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cosmetic-item span,
.cosmetic-empty {
  color: var(--muted);
  line-height: 1.45;
}

.cosmetic-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  display: inline-flex;
  align-items: center;
  width: 46px;
  height: 28px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 120ms ease;
}

.toggle-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f3f8ff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  transform: translateX(0);
  transition: transform 120ms ease;
}

.toggle input:checked + .toggle-track {
  background: rgba(126, 240, 194, 0.35);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

body.skin-amber-prompt #prompt {
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 211, 107, 0.18);
}

body.skin-amber-prompt #command-input {
  caret-color: var(--gold);
  color: var(--gold);
}

body.skin-amber-prompt .current-line {
  text-shadow: 0 0 10px rgba(255, 211, 107, 0.12);
}

.terminal-frame {
  position: relative;
}

.terminal-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 4px
  );
  transition: opacity 120ms ease;
}

body.skin-scanline-theme .terminal-frame::before {
  opacity: 0.62;
  animation: scanline-drift 10s linear infinite;
}

body.skin-scanline-theme .terminal-frame {
  border-color: rgba(126, 240, 194, 0.28);
  box-shadow:
    0 0 0 1px rgba(126, 240, 194, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.35),
    inset 0 0 80px rgba(126, 240, 194, 0.05);
}

body.skin-scanline-theme .terminal-header {
  color: #aeeed7;
  background: linear-gradient(180deg, rgba(126, 240, 194, 0.08), transparent);
}

body.skin-scanline-theme .terminal-output,
body.skin-scanline-theme .current-line {
  text-shadow: 0 0 10px rgba(126, 240, 194, 0.12);
}

body.skin-ascii-banner .ascii-banner {
  display: block;
  animation: banner-fade-in 180ms ease;
}

body.skin-ascii-banner .brand {
  padding-bottom: 14px;
}

body.skin-glass-cursor .current-line {
  margin-left: -10px;
  margin-right: -10px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(200, 255, 241, 0.16);
  background: linear-gradient(135deg, rgba(200, 255, 241, 0.09), rgba(255, 255, 255, 0.02));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 28px rgba(200, 255, 241, 0.08);
  text-shadow: 0 0 14px rgba(200, 255, 241, 0.18);
}

body.skin-glass-cursor #prompt {
  color: #c8fff1;
}

body.skin-glass-cursor #command-input {
  caret-color: #c8fff1;
  color: #e8fff8;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #051017;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
}

.achievement-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text);
}

.terminal-frame {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.red { background: var(--danger); }
.amber { background: var(--accent-2); }
.green { background: var(--accent); }

.terminal-output {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  font-family: Consolas, "Courier New", monospace;
}

.terminal-history {
  width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.current-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  margin-top: 2px;
  font-family: Consolas, "Courier New", monospace;
}

#prompt {
  white-space: nowrap;
}

#command-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font: inherit;
  caret-color: var(--text);
}

.achievement-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 7, 18, 0.4);
  z-index: 20;
  pointer-events: none;
}

.welcome-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(126, 240, 194, 0.12), transparent 36%),
    rgba(2, 7, 18, 0.74);
  z-index: 25;
}

.welcome-panel {
  max-width: 640px;
  padding: 34px 36px;
  border-radius: 30px;
  border: 1px solid rgba(126, 240, 194, 0.22);
  background:
    linear-gradient(135deg, rgba(126, 240, 194, 0.09), rgba(255, 211, 107, 0.08)),
    rgba(7, 16, 32, 0.96);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.5),
    0 0 90px rgba(126, 240, 194, 0.08);
}

.welcome-panel h2 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.welcome-copy {
  max-width: 54ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

#begin-button {
  margin-top: 24px;
  padding: 10px 18px;
  font-size: 1rem;
}

.achievement-panel {
  position: relative;
  min-width: min(620px, calc(100vw - 48px));
  max-width: 720px;
  padding: 28px 34px;
  border-radius: 28px;
  text-align: center;
  border: 1px solid rgba(255, 211, 107, 0.45);
  background:
    linear-gradient(135deg, rgba(255, 211, 107, 0.16), rgba(126, 240, 194, 0.14)),
    rgba(7, 16, 32, 0.94);
  box-shadow:
    0 0 0 1px rgba(255, 211, 107, 0.12),
    0 30px 80px rgba(0, 0, 0, 0.45),
    0 0 90px rgba(255, 211, 107, 0.18);
  animation: achievement-pop 2.6s ease forwards;
}

.achievement-burst {
  position: absolute;
  width: min(62vw, 620px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 211, 107, 0.36), transparent 42%),
    radial-gradient(circle, rgba(126, 240, 194, 0.18), transparent 66%);
  filter: blur(6px);
  animation: achievement-glow 2.6s ease forwards;
}

.achievement-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

#achievement-text {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1.06;
  color: var(--text);
}

.achievement-detail {
  margin: 14px auto 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hidden {
  display: none;
}

@keyframes achievement-pop {
  0% {
    opacity: 0;
    transform: scale(0.78) translateY(18px);
  }
  12% {
    opacity: 1;
    transform: scale(1.03) translateY(0);
  }
  82% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
  }
}

@keyframes achievement-glow {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes scanline-drift {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(8px);
  }
}

@keyframes banner-fade-in {
  0% {
    opacity: 0;
    transform: translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .shell-layout {
    grid-template-columns: 1fr;
  }
}
