:root {
  --bg:#191919;
  --muted:#bdbdbd;
  --ActiveBg:rgba(25,110,75,0.22);
  --HoverBg:rgba(255,255,255,0.02);
  --SidebarCollapsed:96px;
  --SidebarExpanded:240px;
  --Transition:280ms cubic-bezier(.2,.9,.2,1);
  --PanelBg:#0f1113;
  --LoaderBg:#191919;
  --HeaderBg:#0f1113;
  --ContentBoxBg:rgb(35,35,35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.4;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

html {
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
}

.page {
  margin-left: var(--SidebarCollapsed);
  transition: margin-left var(--Transition);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.main {
  padding: 32px;
  flex: 1 1 auto;
  min-height: 0;
  transition: opacity 300ms ease, transform 400ms cubic-bezier(.2,.9,.2,1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--HeaderBg);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.logo {
  width: 112px;
  height: 112px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.buttons {
  display: flex;
  gap: 20px;
  align-items: center;
}

.btn {
  text-decoration: none;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.4px;
  padding: 6px 8px;
  border-radius: 8px;
  opacity: 0.95;
}

.content {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.content-box {
  background: var(--ContentBoxBg);
  border-radius: 10px;
  padding: 50px 40px 40px 40px;
  width: 100%;
  min-height: 500px;
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
  font-family: "JetBrains Mono", monospace;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  opacity: 0;
  transform: scale(0.95) translateY(20px);
  animation: TerminalAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: 0.1s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

@media (min-width: 721px) {
  .content-box::before {
    cursor: move;
  }
  .content-box.dragging {
    position: fixed;
    z-index: 1000;
  }
}

@keyframes TerminalAppear {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.content-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: rgba(0,0,0,0.25);
  border-radius: 10px 10px 0 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.content-box::after {
  content: '';
  position: absolute;
  top: 13px;
  left: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow:
    20px 0 0 #ffbd2e,
    40px 0 0 #28c840,
    0 0 0 0.5px rgba(0,0,0,0.1) inset;
}

.content-box h1 {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  margin: 0;
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  z-index: 1;
}

.content-box p {
  color: var(--muted);
  margin: 0;
  line-height: 1.8;
  font-size: 17px;
}

.contact-buttons {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  margin-top: 40px;
  flex-wrap: wrap;
  width: 100%;
}

.contact-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  padding: 16px 32px;
  border-radius: 10px;
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  text-decoration: none;
  font-weight: 500;
}

.contact-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

.contact-btn:active {
  transform: translateY(0);
}

.contact-separator {
  color: rgba(255,255,255,0.2);
  font-size: 20px;
  user-select: none;
}

.footer {
  padding: 8px 32px 10px;
  color: #999;
  border-top: 1px solid rgba(255,255,255,0.03);
  flex-shrink: 0;
  line-height: 1.2;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: var(--SidebarCollapsed);
  background: linear-gradient(180deg, #0f1113, var(--bg));
  border-right: 1px solid rgba(255,255,255,0.03);
  padding-top: 18px;
  padding-bottom: 18px;
  box-shadow: 8px 0 20px rgba(0,0,0,0.4);
  overflow: visible;
  transition: width var(--Transition), transform var(--Transition);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}

@media (hover: hover) and (min-width: 720px) {
  .sidebar { width: var(--SidebarCollapsed); }
  .sidebar:hover { width: var(--SidebarExpanded); }
  .page { margin-left: var(--SidebarCollapsed); }
  .sidebar:hover ~ .page { margin-left: var(--SidebarExpanded); }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 8px;
}

.nav-btn {
  display: flex;
  gap: 14px;
  align-items: center;
  text-decoration: none;
  color: #fff;
  padding: 14px 12px 14px 5px;
  border-radius: 12px;
  margin: 6px 12px;
  transition: background var(--Transition), transform var(--Transition);
  overflow: hidden;
  white-space: nowrap;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  cursor: pointer;
  width: calc(100% - 24px);
  text-align: left;
  justify-content: flex-start;
}

.nav-btn .icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: -2px;
}

.nav-btn svg {
  width: 26px;
  height: 26px;
  opacity: 0.95;
}

.nav-btn .label {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--Transition), transform var(--Transition);
}

@media (hover: hover) and (min-width: 720px) {
  .sidebar:hover .nav-btn .label { opacity: 1; transform: translateX(0); }
  .sidebar .nav-btn:hover { background: var(--HoverBg); transform: translateX(2px); }
}

.nav-btn.active,
.nav-btn[aria-current="page"] {
  background: var(--ActiveBg) !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.nav-btn:focus,
.nav-btn:focus-visible,
.nav-btn:active {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

.lang-btn {
  justify-content: flex-start !important;
  padding-left: 10px !important;
  width: calc(100% - 24px) !important;
  margin: 6px 12px !important;
}

.lang-btn .icon {
  margin-left: -4px;
}

.lang-btn .label {
  opacity: 0 !important;
  transform: translateX(-8px) !important;
}

@media (hover: hover) and (min-width: 720px) {
  .sidebar:hover .lang-btn .label {
    opacity: 1 !important;
    transform: translateX(0) !important;
  }
}

.music-player {
  width: calc(100% - 20px);
  margin: 0 10px 20px 1px;
  padding: 0;
}

.music-player-content {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  gap: 10px;
  transition: all var(--Transition);
  padding: 0 10px;
}

.track-cover-wrapper {
  position: relative;
  width: 64px;
  height: 64px;
  min-width: 64px;
  flex-shrink: 0;
}

.track-cover {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.track-loader {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
}

.track-loader.hidden {
  display: none;
}

.track-loader .preloader-progress {
  width: 80%;
  height: 3px;
}

.loader-text {
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  font-family: "JetBrains Mono", monospace;
  text-align: center;
  line-height: 1.2;
}

.play-pause-btn {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.play-pause-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.play-pause-btn:active {
  transform: scale(0.95);
}

.play-pause-btn svg {
  width: 26px;
  height: 26px;
}

.play-pause-btn.playing .play-icon {
  display: none;
}

.play-pause-btn.playing .pause-icon {
  display: block !important;
}

.track-info-wrapper {
  width: 100%;
  overflow: hidden;
  transition: all var(--Transition);
}

.track-info-link {
  display: block;
  font-size: 11px;
  color: #fff;
  text-decoration: underline;
  opacity: 0;
  max-width: 0;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--Transition), max-width var(--Transition);
  font-family: "JetBrains Mono", monospace;
  margin-top: 4px;
}

@media (hover: hover) and (min-width: 720px) {
  .sidebar:hover .track-info-link {
    opacity: 1;
    max-width: 180px;
  }
}

@media (max-width: 720px) {
  .music-player { display: none; }

  body.menu-open .music-player { display: block; }

  body.menu-open .track-info-link {
    opacity: 1;
    max-width: 200px;
  }
}

.sidebar-close {
  display: none;
  position: fixed;
  z-index: 10020;
  right: 12px;
  top: 12px;
  background: rgba(0,0,0,0.55);
  border: none;
  padding: 10px;
  border-radius: 10px;
  color: #fff;
  backdrop-filter: blur(4px);
}

.sidebar-toggle {
  display: none;
  position: fixed;
  z-index: 70;
  left: 12px;
  top: 84px;
  background: rgba(0,0,0,0.55);
  border: none;
  padding: 10px;
  border-radius: 10px;
  color: #fff;
  backdrop-filter: blur(4px);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 250ms ease;
}

body.menu-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

body.menu-open .sidebar-toggle {
  display: none !important;
}

body.menu-open .sidebar {
  transform: translateX(0);
  z-index: 10010;
}

@media (max-width: 720px) {
  .sidebar {
    width: var(--SidebarExpanded);
    transform: translateX(-110%);
    padding-top: 40px;
    background: linear-gradient(180deg, var(--PanelBg), #070707);
    border-right: none;
    box-shadow: 0 6px 30px rgba(0,0,0,0.6);
  }

  .page { margin-left: 0; }
  .sidebar-close { display: block; }
  .sidebar-toggle { display: block; }
  .sidebar-nav .label { opacity: 1; transform: none; }

  .sidebar-nav {
    align-items: flex-start;
    padding-left: 16px;
  }

  .content-box {
    padding: 50px 24px 32px 24px;
    min-height: 400px;
  }

  .content-box h1 { font-size: 13px; }

  .content-box p {
    font-size: 16px;
    line-height: 1.7;
  }

  .contact-buttons {
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
  }

  .contact-btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
    padding: 14px 20px;
  }

  .contact-separator { display: none; }
}

@media (max-width: 420px) {
  .logo { width: 72px; height: 72px; }

  .header { padding: 14px; }

  .main { padding: 16px; }

  .content-box h1 { font-size: 12px; }

  .content-box {
    padding: 50px 20px 28px 20px;
    min-height: 360px;
    border-radius: 8px;
  }

  .content-box::before {
    height: 36px;
    border-radius: 8px 8px 0 0;
  }

  .content-box h1 { height: 36px; }

  .content-box::after {
    top: 11px;
    left: 12px;
    width: 10px;
    height: 10px;
    box-shadow:
      17px 0 0 #ffbd2e,
      34px 0 0 #28c840,
      0 0 0 0.5px rgba(0,0,0,0.1) inset;
  }

  .content-box p {
    font-size: 15px;
    line-height: 1.6;
  }

  .contact-btn {
    font-size: 14px;
    padding: 12px 18px;
  }

  .footer { padding: 8px 16px 10px; }

  .sidebar-toggle { top: 70px; }
}

#preloader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: var(--LoaderBg);
  transition: opacity 600ms ease, visibility 600ms;
  opacity: 1;
  visibility: visible;
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  width: min(360px, 80vw);
}

.preloader-progress {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset;
}

.preloader-progress .bar {
  width: 35%;
  height: 100%;
  background: #fff;
  border-radius: 999px;
  animation: ProgressMove 1.2s ease-in-out infinite;
}

@keyframes ProgressMove {
  0%   { transform: translateX(-120%); }
  50%  { transform: translateX(120%); }
  100% { transform: translateX(320%); }
}

.loading-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.loading-dots .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.18;
  transform: translateY(0);
  animation: DotBounce 1s infinite ease-in-out;
}

.loading-dots .dot:nth-child(1) { animation-delay: 0s; }
.loading-dots .dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dots .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes DotBounce {
  0%   { opacity: 0.18; transform: translateY(0); }
  40%  { opacity: 1;    transform: translateY(-8px); }
  80%  { opacity: 0.35; transform: translateY(0); }
  100% { opacity: 0.18; transform: translateY(0); }
}

.project .cube {
  width: 220px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0,0,0,0.08);
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
  transform-style: preserve-3d;
}

.project .cube img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 720px) {
  .project .cube { width: 140px; }
}