:root {
  --bg: #0a0a0f;
  --bg-2: #0f0f18;
  --surface: #13131d;
  --surface-2: #1a1a27;
  --line: #26263a;
  --line-2: #1f1f2e;
  --text: #e8e8f0;
  --muted: #7a7a90;
  --muted-2: #555568;

  --violet: #a78bfa;
  --pink: #f472b6;
  --blue: #60a5fa;
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #ef4444;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ========== Background FX ========== */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
.bg-noise {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 10%, rgba(167, 139, 250, 0.12), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(244, 114, 182, 0.08), transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(96, 165, 250, 0.06), transparent 50%);
  animation: bg-shift 20s ease-in-out infinite alternate;
}
@keyframes bg-shift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(20px, -30px) scale(1.05); }
}
.scanline {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(255, 255, 255, 0.012) 2px,
    rgba(255, 255, 255, 0.012) 4px
  );
}
.floating-code {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.code-frag {
  position: absolute;
  left: var(--x);
  top: var(--y);
  color: rgba(167, 139, 250, 0.15);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  animation: float 8s ease-in-out infinite;
  animation-delay: var(--d);
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0); opacity: 0.3; }
  50% { transform: translateY(-20px) rotate(3deg); opacity: 0.6; }
}

/* ========== Layout ========== */
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 28px 40px;
}

/* ========== Terminal Header ========== */
.terminal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 56px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(167, 139, 250, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: boot 0.6s ease-out;
}
@keyframes boot {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.terminal-top {
  background: linear-gradient(to bottom, #1e1e2d, #171721);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line-2);
}
.terminal-top .dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.3);
}
.terminal-top .dot.red { background: #ff5f56; }
.terminal-top .dot.yellow { background: #ffbd2e; }
.terminal-top .dot.green { background: #27c93f; }
.term-title {
  margin-left: auto;
  margin-right: auto;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.terminal-body {
  padding: 18px 20px 22px;
  font-size: 13.5px;
  min-height: 140px;
}
.term-line { margin: 0 0 2px; }
.term-out {
  margin: 0 0 14px;
  padding-left: 0;
  color: var(--text);
  min-height: 1.7em;
}
.prompt { color: var(--green); font-weight: 500; }
.path { color: var(--blue); }
.sep { color: var(--muted); }
.cmd { color: var(--text); }
.cursor {
  display: inline-block;
  animation: blink 1s steps(2) infinite;
  color: var(--violet);
  font-weight: 700;
}
@keyframes blink { 50% { opacity: 0; } }

/* ========== Identity ========== */
.identity {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 56px;
  padding: 24px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.identity::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(167, 139, 250, 0.08), transparent 60%);
  animation: spin 12s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 1;
}
.avatar {
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 0 18px rgba(167, 139, 250, 0.4));
}
.avatar .ring {
  animation: ring-pulse 3s ease-in-out infinite;
  transform-origin: center;
}
@keyframes ring-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.id-text { position: relative; z-index: 1; flex: 1; min-width: 0; }
.name {
  margin: 0 0 6px;
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.glitch {
  position: relative;
  display: inline-block;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  overflow: hidden;
}
.glitch::before {
  color: var(--pink);
  animation: glitch-a 4s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}
.glitch::after {
  color: var(--blue);
  animation: glitch-b 3.5s infinite linear alternate-reverse;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}
@keyframes glitch-a {
  0%, 80%, 100% { transform: translate(0, 0); opacity: 0; }
  82% { transform: translate(-2px, 0); opacity: 0.8; }
  84% { transform: translate(1px, 0); opacity: 0.8; }
  86% { transform: translate(0, 0); opacity: 0; }
}
@keyframes glitch-b {
  0%, 90%, 100% { transform: translate(0, 0); opacity: 0; }
  92% { transform: translate(2px, 0); opacity: 0.8; }
  94% { transform: translate(-1px, 0); opacity: 0.8; }
  96% { transform: translate(0, 0); opacity: 0; }
}

/* role cycling */
.title {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  height: 20px;
  overflow: hidden;
}
.role-cycle {
  display: inline-flex;
  flex-direction: column;
  animation: cycle 10s ease-in-out infinite;
}
.role-cycle span {
  height: 20px;
  color: var(--violet);
}
.role-cycle span::before {
  content: '> ';
  color: var(--muted);
}
@keyframes cycle {
  0%, 22% { transform: translateY(0); }
  25%, 47% { transform: translateY(-20px); }
  50%, 72% { transform: translateY(-40px); }
  75%, 97% { transform: translateY(-60px); }
  100% { transform: translateY(0); }
}

.status-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
}
.status-chip.live { color: var(--green); border-color: rgba(74, 222, 128, 0.25); }
.status-chip .ok { color: var(--green); }
.pulse-dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ========== Blocks ========== */
.block { margin-bottom: 52px; }
.block h2 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 18px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.block h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--line), transparent);
  margin-left: 12px;
}
.marker { color: var(--violet); font-weight: 700; }
.count {
  font-size: 10px;
  padding: 2px 7px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 3px;
  color: var(--violet);
  font-weight: 500;
}

/* ========== Terse list ========== */
.terse { list-style: none; margin: 0; padding: 0; }
.terse li {
  padding: 4px 0;
  color: var(--text);
  transition: transform 0.2s ease;
}
.terse li:hover { transform: translateX(4px); }
.arrow {
  color: var(--violet);
  margin-right: 10px;
  display: inline-block;
  width: 14px;
  font-weight: 700;
}
.sub-list { margin-top: 10px; font-size: 13px; }
.sub-list li { padding: 3px 0; color: var(--muted); }
.sub-list li::before { content: '└'; color: var(--violet); margin-right: 10px; }

/* ========== Stack tags ========== */
.stack { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  position: relative;
  font-size: 12px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  transition: all 0.2s ease;
  cursor: default;
  overflow: hidden;
}
.tag::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.15), transparent);
  transition: left 0.5s;
}
.tag:hover {
  border-color: var(--violet);
  color: var(--violet);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(167, 139, 250, 0.15);
}
.tag:hover::before { left: 100%; }

/* lang accent colors */
.tag[data-lang="cs"]:hover { border-color: #9b72cf; color: #c9a9ff; }
.tag[data-lang="py"]:hover { border-color: var(--yellow); color: var(--yellow); }
.tag[data-lang="sql"]:hover { border-color: var(--blue); color: var(--blue); }
.tag[data-lang="js"]:hover { border-color: #f7df1e; color: #f7df1e; }
.tag[data-lang="html"]:hover { border-color: #e34f26; color: #ff7555; }
.tag[data-lang="bi"]:hover { border-color: #f2c811; color: #f2c811; }
.tag[data-lang="mat"]:hover { border-color: #e16737; color: #ff8b5a; }

/* ========== Skill bars ========== */
.skills { display: flex; flex-direction: column; gap: 14px; }
.skill-row { }
.skill-info {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 6px;
  color: var(--text);
}
.skill-val { color: var(--violet); font-weight: 500; }
.skill-track {
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.skill-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--violet), var(--pink));
  border-radius: 2px;
  transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.5);
  position: relative;
}
.skill-bar::after {
  content: '';
  position: absolute;
  right: 0; top: 0;
  width: 12px; height: 100%;
  background: linear-gradient(90deg, transparent, #fff);
  opacity: 0.5;
  animation: shine 2s ease-in-out infinite;
}
@keyframes shine {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.6; }
}

/* ========== Projects ========== */
.proj {
  padding: 18px 18px;
  margin: 0 -18px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease calc(var(--i) * 0.08s), transform 0.5s ease calc(var(--i) * 0.08s), border-color 0.2s, background 0.2s;
}
.proj.in-view { opacity: 1; transform: translateY(0); }
.proj:hover {
  background: rgba(167, 139, 250, 0.04);
  border-color: var(--line);
}
.proj-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.proj h3 {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.proj:hover h3 { color: var(--violet); }
.meta {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
}
.proj p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

/* ========== Now playing ========== */
.now-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--violet);
  border-radius: 6px;
  padding: 16px 18px;
}
.now-row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line-2);
  font-size: 13px;
}
.now-row:last-child { border-bottom: 0; }
.now-row .label {
  width: 80px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-top: 2px;
  flex-shrink: 0;
}
.now-row .value { color: var(--text); }

/* ========== Links ========== */
.links { list-style: none; padding: 0; margin: 0; }
.links li { padding: 6px 0; }
.links a {
  color: var(--text);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13.5px;
  padding: 6px 10px;
  margin-left: -10px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}
.links a:hover {
  color: var(--violet);
  background: rgba(167, 139, 250, 0.06);
  transform: translateX(4px);
}
.link-icon {
  display: inline-flex;
  color: var(--muted);
  transition: color 0.2s;
}
.links a:hover .link-icon { color: var(--violet); }
.ext {
  color: var(--muted);
  font-size: 11px;
  margin-left: 2px;
}

/* ========== Footer ========== */
.foot {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11.5px;
}
.foot p { margin: 0; }
.foot-prompt { color: var(--green); font-weight: 500; margin-right: 4px; }
.heart {
  color: var(--pink);
  display: inline-block;
  animation: beat 1.2s ease-in-out infinite;
}
@keyframes beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }
.sep-dot { margin: 0 6px; color: var(--muted-2); }

/* ========== Responsive ========== */
@media (max-width: 640px) {
  .wrap { padding: 32px 20px 32px; }
  .terminal-body { padding: 14px 16px 18px; font-size: 12.5px; }
  .identity { flex-direction: column; align-items: flex-start; gap: 18px; padding: 20px; }
  .avatar { width: 76px; height: 76px; }
  .name { font-size: 22px; }
  .proj { margin: 0 -12px; padding: 14px 12px; }
  .now-row { flex-direction: column; gap: 2px; }
  .now-row .label { width: auto; }
}

/* ========== Selection ========== */
::selection { background: var(--violet); color: var(--bg); }

/* ========== Reduced motion ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
