:root {
  /* UTC-inspired professional dark palette */
  --primary-color: #4F6DF5;
  --primary-hover: #6B85F7;
  --secondary-color: #3A56D4;
  --accent-color: #A7B1D8;
  
  /* Backgrounds */
  --bg-primary: #05060B;
  --bg-secondary: #0B0E1A;
  --bg-card: rgba(242, 245, 255, 0.04);
  --bg-terminal: #0D1117;
  --bg-terminal-header: #161B22;
  
  /* Typography */
  --text-primary: #F2F5FF;
  --text-secondary: #A7B1D8;
  --text-muted: #6B7293;
  --text-terminal: #E6EDF3;
  
  /* Borders */
  --border-color: rgba(242, 245, 255, 0.10);
  --terminal-border: rgba(242, 245, 255, 0.10);
  
  /* Solid colors instead of gradients */
  --gradient-1: #4F6DF5;
  --gradient-2: #6B85F7;
  
  /* Shadows – none */
  --shadow-glow: none;
  --shadow-card: none;
  
  /* Transitions & fonts unchanged */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

/* Remove all browser default focus outlines and hover highlights */
*,
*:focus,
*:focus-visible,
*:focus-within {
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

/* Remove tap highlight on mobile */
* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  tap-highlight-color: rgba(0, 0, 0, 0) !important;
}

*, *:before, *:after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-user-select: none;
  user-select: none;
}

::selection {
  background: var(--primary-color);
  color: #fff;
}

::-webkit-scrollbar {
  width: 0px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

/* Animated background – subtle grain */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  background: var(--bg-primary);
}

.animated-bg:before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 20% 80%, rgba(79, 109, 245, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(79, 109, 245, 0.06) 0%, transparent 50%),
              radial-gradient(circle at 40% 40%, rgba(107, 133, 247, 0.04) 0%, transparent 40%);
  animation: bgFloat 20s ease-in-out infinite;
}

.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary-color);
  border-radius: 50%;
  opacity: 0.3;
  animation: particleFloat 15s infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0) rotate(0); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

@keyframes particleFloat {
  0%, 100% { transform: translateY(100vh) rotate(0); opacity: 0; }
  10% { opacity: 0.2; }
  90% { opacity: 0.2; }
  100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

/* Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1rem 0;
  z-index: 1000;
  transition: var(--transition-smooth);
  background: transparent;
}

.nav.scrolled {
  background: transparent;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: none;
}

.nav__container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav__logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav__logo i {
  font-size: 1.8rem;
  color: var(--primary-color);
}

.nav__menu {
  display: flex;
  list-style: none;
  gap: 2.5rem;
}

.nav__link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 0.5rem 0;
  transition: var(--transition-smooth);
}

.nav__link:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: var(--transition-smooth);
}

.nav__link:hover,
.nav__link.active {
  color: var(--text-primary);
}

.nav__link:hover:after,
.nav__link.active:after {
  width: 100%;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.nav__toggle span {
  width: 25px;
  height: 2px;
  background: var(--text-primary);
  transition: var(--transition-smooth);
}

.nav__toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav__toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav__toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Page Header */
.page-header {
  padding: 8rem 2rem 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.page-header__subtitle {
  font-family: var(--font-mono);
  color: var(--primary-color);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 1rem;
}

.page-header__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.page-header__title .gradient-text {
  color: var(--primary-color);
}

.page-header__description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Terminal Section */
.terminal-section {
  padding: 2rem;
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
}

.terminal-wrapper {
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: none;
  transition: var(--transition-smooth);
}

.terminal-wrapper:hover {
  border-color: var(--primary-color);
  box-shadow: none;
}

.terminal-header {
  background: var(--bg-terminal-header);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--terminal-border);
}

.terminal-dots {
  display: flex;
  gap: 0.5rem;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
}

.terminal-dot:hover {
  transform: scale(1.2);
}

.terminal-dot.red {
  background: #ff5f56;
}
.terminal-dot.yellow {
  background: #ffbd2e;
}
.terminal-dot.green {
  background: #27c93f;
}

.terminal-title {
  flex: 1;
  text-align: center;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.terminal-container {
  display: flex;
  height: 600px;
  background: var(--bg-terminal);
  position: relative;
}

.terminal-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-terminal);
  transition: flex 0.5s ease;
}

.terminal-body.with-game {
  flex: 0.6;
}

.terminal-body::-webkit-scrollbar {
  width: 8px;
}

.terminal-body::-webkit-scrollbar-track {
  background: var(--bg-terminal);
}

.terminal-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

.welcome-message {
  color: var(--primary-color);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
  animation: fadeIn 1s ease-in;
}

.welcome-subtitle {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.command-line {
  display: flex;
  margin: 0.5rem 0;
  align-items: center;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  0% { opacity: 0; transform: translateX(-10px); }
  100% { opacity: 1; transform: translateX(0); }
}

.prompt {
  color: var(--secondary-color);
  margin-right: 0.5rem;
  font-weight: 600;
  white-space: nowrap;
}

.command-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: inherit;
  outline: none;
  caret-color: var(--accent-color);
  min-width: 50px;
}

.output {
  margin: 0.25rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.output.error { color: #ff5555; }
.output.success { color: #50fa7b; }
.output.info { color: #f1fa8c; }
.output.accent { color: var(--primary-color); }

.cmd-keyword { color: var(--primary-color); font-weight: 600; }
.cmd-string { color: #50fa7b; }
.cmd-comment { color: var(--text-muted); }

/* Game Panel */
.game-panel {
  width: 0;
  opacity: 0;
  background: var(--bg-secondary);
  border-left: 2px solid var(--border-color);
  transition: all 0.5s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.game-panel.active {
  width: 40%;
  opacity: 1;
  border-left-color: var(--primary-color);
}

.game-content {
  padding: 1.5rem;
  height: 100%;
  overflow-y: auto;
}

.game-title {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

/* Number Game */
.number-game-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.game-info {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.attempts-display {
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 1rem;
  font-weight: 600;
}

.game-terminal {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 1rem;
}

.game-input-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.game-input {
  flex: 1;
  background: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
}

.game-input:focus {
  border-color: var(--primary-color);
}

.game-btn {
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.game-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: none;
}

.game-btn.secondary {
  background: transparent;
  border: 1px solid var(--border-color);
}

.game-btn.secondary:hover {
  border-color: var(--primary-color);
  background: var(--bg-card);
}

/* Snake */
#snakeCanvas {
  display: block;
  margin: 0 auto 1rem;
  border: 2px solid var(--primary-color);
  border-radius: 8px;
}

.snake-score {
  color: var(--primary-color);
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Tic-Tac-Toe */
.tictactoe-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 0 auto 1rem;
}

.tictactoe-cell {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.1);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tictactoe-cell:hover:not(.taken) {
  background: rgba(0, 0, 0, 0.864);
  transform: scale(1.05);
}

.tictactoe-cell.taken {
  cursor: not-allowed;
}

.tictactoe-cell.x {
  color: var(--primary-color);
}
.tictactoe-cell.o {
  color: var(--secondary-color);
}

.game-status {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

/* Footer */
.footer {
  background: var(--bg-primary);
  padding: 4rem 2rem 1rem;
  margin-top: 4rem;
  position: relative;
  z-index: 1;
}

.footer__container {
  max-width: 1400px;
  margin: 0 auto;
}

.footer__top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer__brand {
  max-width: 300px;
}

.footer__logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer__description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.footer__social {
  display: flex;
  gap: 0.75rem;
}

.footer__social-link {
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: var(--transition-smooth);
  border: 1px solid var(--border-color);
}

.footer__social-link:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  transform: translateY(-3px);
}

.footer__column-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.footer__links {
  list-style: none;
}

.footer__link {
  margin-bottom: 0.75rem;
}

.footer__link a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer__link a:hover {
  color: var(--primary-color);
  padding-left: 5px;
}

.footer__contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.footer__contact-item i {
  color: var(--primary-color);
  width: 20px;
}

.footer__bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer__copyright {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer__copyright span {
  color: var(--primary-color);
}

.footer__back-to-top {
  width: 45px;
  height: 45px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

.footer__back-to-top:hover {
  transform: translateY(-5px);
  background: #05060B;
  border: 1px solid #fff;
  box-shadow: none;
}

/* Responsive */
@media (max-width: 1024px) {
  .terminal-container {
    height: 500px;
  }
  .game-panel.active {
    width: 50%;
  }
  .footer__top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 1150px) {
  .nav__menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 350px;
    height: 100vh;
    background: rgba(5, 6, 11, 0.98);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    transition: var(--transition-smooth);
    border-left: 1px solid var(--border-color);
    box-shadow: none;
  }
  .nav__menu.active {
    right: 0;
  }
  .nav__link {
    font-size: 1.2rem;
  }
  .nav__toggle {
    display: flex;
  }
  .terminal-container {
    flex-direction: column;
    height: auto;
    min-height: 400px;
  }
  .terminal-body {
    min-height: 300px;
  }
  .terminal-body.with-game {
    flex: 1;
    height: 300px;
  }
  .game-panel.active {
    width: 100%;
    height: 400px;
    border-left: none;
    border-top: 2px solid var(--primary-color);
  }
  .tictactoe-board {
    max-width: 250px;
  }
  .tictactoe-cell {
    font-size: 2rem;
  }
  #snakeCanvas {
    max-width: 100%;
    height: auto;
  }
  .footer__top {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .footer__brand {
    max-width: 100%;
  }
  .footer__social {
    justify-content: center;
  }
  .footer__bottom {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .page-header {
    padding: 7rem 1rem 1rem;
  }
  .terminal-section {
    padding: 1rem;
  }
  .terminal-header {
    padding: 0.75rem 1rem;
  }
  .terminal-title {
    font-size: 0.75rem;
  }
  .terminal-body {
    font-size: 12px;
    padding: 1rem;
  }
  .game-title {
    font-size: 1.2rem;
  }
}

/* Loader */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s, visibility 0.5s;
}
.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader {
  width: 50px;
  height: 50px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Scroll reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}
.scroll-reveal.active {
  opacity: 1;
  transform: translateY(0);
}

#currentYear {
  color: inherit;
  font-weight: inherit;
}