:root {
  --bg: #020706;
  --text: #e8fff7;
  --muted: #7ea299;
  --accent-rgb: 51, 255, 153;
  --accent-2-rgb: 40, 183, 255;
  --danger-rgb: 255, 66, 110;
  --panel-rgb: 2, 14, 13;
  --border-rgb: 69, 255, 183;
  --panel: rgba(2, 14, 13, 0.72);
  --panel-strong: rgba(2, 22, 19, 0.88);
  --border: rgba(var(--border-rgb), 0.2);
  --accent: #33ff99;
  --accent-2: #28b7ff;
  --danger: #ff426e;
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.48);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.light {
  --bg: #edf8f4;
  --text: #06120f;
  --muted: #42645b;
  --panel: rgba(250, 255, 253, 0.76);
  --panel-strong: rgba(250, 255, 253, 0.9);
  --border: rgba(0, 120, 80, 0.16);
  --shadow: 0 18px 70px rgba(20, 72, 58, 0.16);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
}

body.booting {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(var(--accent-rgb), 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 48%, rgba(var(--accent-rgb), 0.14), transparent 34%),
    var(--bg);
  background-size: 28px 28px, 28px 28px, auto, auto;
  transition: opacity .7s ease, visibility .7s ease;
}

.boot-screen.done {
  opacity: 0;
  visibility: hidden;
}

.boot-terminal {
  width: min(720px, calc(100% - 32px));
  min-height: 300px;
  padding: 28px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  background: rgba(0, 8, 7, 0.9);
  box-shadow: 0 0 70px rgba(var(--accent-rgb), 0.16), inset 0 0 42px rgba(var(--accent-rgb), 0.04);
  color: #bfffe0;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
}

.boot-line {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.boot-ok {
  color: #33ff99;
  text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.7);
}

.background-layer,
.cyber-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.background-layer {
  z-index: -3;
  background:
    linear-gradient(rgba(var(--accent-rgb), 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.045) 1px, transparent 1px),
    radial-gradient(circle at 50% 36%, rgba(var(--accent-2-rgb), 0.18), transparent 32%),
    radial-gradient(circle at 18% 78%, rgba(var(--accent-rgb), 0.14), transparent 30%),
    linear-gradient(135deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 78%, var(--accent) 22%) 52%, color-mix(in srgb, var(--bg) 82%, var(--accent-2) 18%) 100%);
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
}

.background-layer video,
.background-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .34;
}

.cyber-canvas {
  z-index: -2;
  width: 100%;
  height: 100%;
  opacity: .86;
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 112px;
}

.glass {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(95, 255, 188, 0.08);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--accent), transparent 18%) top left / 100% 1px no-repeat,
    linear-gradient(var(--accent), transparent 28%) top left / 1px 100% no-repeat;
  opacity: .42;
}

.topbar {
  position: sticky;
  top: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 10px 14px;
  border-radius: 14px;
}

.brand,
.nav,
.meta-row,
.section-head,
.dock,
.player,
.discord-user,
.terminal-top,
.top-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.46);
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  box-shadow: inset 0 0 18px rgba(var(--accent-rgb), 0.12);
  font-weight: 900;
}

.nav {
  gap: 8px;
  color: var(--muted);
}

.nav a,
.icon-button,
.dock-button,
.compact-select,
.color-control {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text);
}

.nav a {
  padding: 10px 12px;
  border-color: transparent;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}

.nav a:hover,
.icon-button:hover,
.dock-button:hover {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.13);
  transform: translateY(-1px);
}

.top-actions {
  gap: 10px;
}

.compact-select,
.color-control,
.icon-button,
.dock-button {
  height: 44px;
  cursor: pointer;
}

.compact-select {
  width: 68px;
  padding: 0 10px;
}

.compact-select option {
  color: #071014;
}

.color-control,
.icon-button,
.dock-button {
  width: 44px;
}

.color-control {
  padding: 6px;
}

.color-control::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-control::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}

.icon-button,
.dock-button {
  display: grid;
  place-items: center;
  transition: .2s ease;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.card {
  min-height: 220px;
  padding: clamp(20px, 3vw, 30px);
  border-radius: 16px;
}

.profile-card {
  grid-column: span 7;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  min-height: 364px;
}

.avatar {
  width: 168px;
  aspect-ratio: 1;
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  border-radius: 18px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.34), 0 0 34px rgba(var(--accent-rgb), 0.12);
}

.eyebrow,
.section-head span,
.activity,
.discord-user p {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(42px, 7vw, 78px);
  line-height: .96;
  letter-spacing: 0;
  text-shadow: 0 0 28px rgba(var(--accent-rgb), 0.14);
}

h2 {
  margin-bottom: 18px;
  font-size: 24px;
}

.subtitle {
  max-width: 520px;
  color: var(--muted);
  font-size: 20px;
}

.meta-row {
  flex-wrap: wrap;
  gap: 10px;
}

.meta-row span,
.status-pill {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.06);
}

.about-card {
  grid-column: span 5;
}

.discord-card,
.contacts-card {
  grid-column: span 4;
}

.skills-card,
.projects-card {
  grid-column: span 8;
}

.portfolio-card {
  grid-column: 1 / -1;
}

.section-head {
  justify-content: space-between;
  gap: 16px;
}

.rich-text {
  color: var(--muted);
  line-height: 1.75;
}

.rich-text strong {
  color: var(--text);
}

.discord-user {
  gap: 14px;
}

.discord-user img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
}

.activity,
.spotify,
.project,
.portfolio-item {
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.activity,
.spotify {
  margin-top: 18px;
  padding: 14px;
  line-height: 1.5;
}

.skills-list,
.projects-list,
.contacts-list {
  display: grid;
  gap: 14px;
}

.skill {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 54px;
  gap: 14px;
  align-items: center;
}

.skill-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

.meter {
  height: 8px;
  overflow: hidden;
  background: rgba(var(--accent-rgb), 0.08);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--danger));
  transition: width 1.1s cubic-bezier(.2, .8, .2, 1);
}

.project {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.project strong,
.portfolio-item strong {
  color: var(--text);
}

.project p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.project-meta,
.portfolio-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-meta span,
.portfolio-tags span {
  padding: 6px 9px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.portfolio-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.1), transparent 44%),
    rgba(0, 0, 0, 0.18);
}

.portfolio-hero h3 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1;
  letter-spacing: 0;
}

.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(2, 112px);
  gap: 10px;
}

.portfolio-stats span {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.portfolio-stats strong {
  color: var(--accent);
  font-size: 28px;
}

.portfolio-stats small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.portfolio-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.portfolio-item {
  position: relative;
  display: grid;
  min-height: 260px;
  align-content: space-between;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
}

.portfolio-item::before {
  content: "";
  position: absolute;
  inset: -40% -30%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.16), transparent 42%);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
}

.portfolio-item:hover::before {
  opacity: 1;
  transform: translate3d(4%, -4%, 0);
}

.portfolio-item > * {
  position: relative;
}

.portfolio-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.portfolio-item h3 {
  margin: 0 0 10px;
  font-size: 24px;
}

.portfolio-item p {
  color: var(--muted);
  line-height: 1.6;
}

.portfolio-impact {
  color: var(--accent);
  font-size: 13px;
}

.project-actions,
.contacts-list {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.project-actions {
  display: grid;
  gap: 10px;
}

.project-actions a,
.contacts-list a,
.admin-form button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--text);
  transition: transform .2s ease, background .2s ease;
}

.project-actions a:hover,
.contacts-list a:hover,
.admin-form button:hover {
  transform: translateY(-1px);
  background: rgba(var(--accent-rgb), 0.15);
}

.dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 25;
  width: min(760px, calc(100% - 32px));
  justify-content: space-between;
  gap: 14px;
  padding: 10px;
  border-radius: 14px;
  transform: translateX(-50%);
}

.dock-button {
  font-size: 28px;
  font-weight: 900;
}

.player {
  min-width: 0;
  flex: 1;
  gap: 12px;
}

.player-toggle {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.2), rgba(var(--accent-2-rgb), 0.12));
  color: var(--accent);
  box-shadow: inset 0 0 24px rgba(var(--accent-rgb), 0.08);
  cursor: pointer;
}

.player-main {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 7px;
}

.player-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

#trackTitle {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#trackTime {
  flex: 0 0 auto;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.player-progress {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.player-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.5);
}

.player-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  height: 18px;
  align-items: end;
}

.player-bars span {
  display: block;
  height: 5px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.2);
}

.player.is-playing .player-bars span {
  animation: wave 1.1s ease-in-out infinite;
  background: rgba(var(--accent-rgb), 0.58);
}

.player.is-playing .player-bars span:nth-child(2n) {
  animation-delay: .14s;
}

.player.is-playing .player-bars span:nth-child(3n) {
  animation-delay: .28s;
}

.volume-control {
  width: 120px;
  accent-color: var(--accent);
}

@keyframes wave {
  0%, 100% { height: 5px; }
  45% { height: 18px; }
}

.terminal,
.admin {
  position: fixed;
  left: 50%;
  z-index: 40;
  width: min(920px, calc(100% - 24px));
  border-radius: 16px;
  transform: translateX(-50%);
}

.terminal {
  bottom: 92px;
  height: min(560px, calc(100vh - 126px));
}

.terminal-top {
  gap: 8px;
  height: 46px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}

.terminal-top span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-top span:nth-child(1) { background: #ff5f56; }
.terminal-top span:nth-child(2) { background: #ffbd2e; }
.terminal-top span:nth-child(3) { background: #27c93f; }

.terminal-top strong {
  margin-left: 8px;
  color: var(--muted);
  font-size: 14px;
}

.terminal-top button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

.terminal-output {
  height: calc(100% - 94px);
  padding: 18px;
  overflow: auto;
  color: #bfffe0;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  line-height: 1.55;
  white-space: pre-wrap;
}

.terminal-input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-top: 1px solid var(--border);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.terminal-input input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.admin {
  top: 24px;
  max-height: calc(100vh - 48px);
  padding: 20px;
  overflow: auto;
}

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

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.color-fieldset,
.block-order-fieldset {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.color-fieldset legend,
.block-order-fieldset legend {
  padding: 0 8px;
  color: var(--accent);
}

.color-fieldset input[type="color"] {
  height: 44px;
  padding: 6px;
}

.block-order-fieldset {
  grid-template-columns: 1fr;
}

.block-order-list {
  display: grid;
  gap: 8px;
}

.block-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.block-order-item span {
  color: var(--text);
}

.block-order-item div {
  display: flex;
  gap: 8px;
}

.block-order-item button {
  width: 38px;
  min-height: 34px;
  padding: 0;
}

.block-order-item button:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.admin-form textarea,
.admin-form input,
.admin-form select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
}

.admin-form textarea,
.admin-form button,
.form-message {
  grid-column: 1 / -1;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
}

.form-message.success {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s ease, transform .7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 860px) {
  .nav {
    display: none;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .grid,
  .profile-card,
  .admin-form,
  .color-fieldset,
  .block-order-fieldset {
    grid-template-columns: 1fr;
  }

  .profile-card,
  .about-card,
  .discord-card,
  .skills-card,
  .projects-card,
  .portfolio-card,
  .contacts-card {
    grid-column: 1;
  }

  .portfolio-hero,
  .portfolio-list {
    grid-template-columns: 1fr;
  }

  .portfolio-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dock {
    align-items: flex-start;
  }

  .player {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .volume-control {
    grid-column: 1 / -1;
    width: 100%;
  }

  .profile-card {
    min-height: auto;
  }

  .avatar {
    width: min(168px, 48vw);
  }
}

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

  .boot-screen {
    display: none;
  }
}
