:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --accent-color: #3b82f6;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  user-select: none;
}
body {
  position: relative;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  text-align: center;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  align-items: stretch;
  background: var(--bg-light);
}

/* Title CSS */
.title {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  text-align: center;
  font-size: 2em;
  font-weight: 700;
  padding-block: 0.8em;
  color: var(--text-dark);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  letter-spacing: 2px;
  border-bottom: 3px solid #000000;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.title::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.1), transparent);
  transition: left 0.5s;
}
.title:hover::before {
  left: 100%;
}
.title:hover {
  color: var(--primary-color);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
  letter-spacing: 3px;
}

/* Navbar CSS */
.navbar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8em;
  font-size: 14px;
  min-height: auto;
  padding-block: 1em;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  border-bottom: 3px solid #000000;
  transition: all 0.5s cubic-bezier(0.645, 0.045, 0.355, 1);
  flex-shrink: 0;
}
.navbar a,
.navbar button {
  all: unset;
  cursor: pointer;
  color: var(--text-dark);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-light);
  border: 2px solid #000000;
  position: relative;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  font-size: 13px;
}
.navbar a:hover,
.navbar button:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border-color: #000000;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.4);
}
.navbar a:active,
.navbar button:active {
  transform: translateY(0);
}
.nav-button {
  display: inline-block;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
.navbar select {
  width: fit-content;
  min-width: 140px;
  outline: none;
  border: 2px solid #000000;
  border-radius: 8px;
  padding: 8px 18px;
  background: var(--bg-white);
  color: var(--text-dark) !important;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231e293b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 35px;
}
.navbar select option {
  background-color: var(--bg-white) !important;
  color: var(--text-dark) !important;
  padding: 12px 15px;
  font-weight: 500;
  font-size: 16px;
}
.navbar select option:checked {
  background-color: var(--primary-color) !important;
  color: #ffffff !important;
}
.navbar select:hover {
  border-color: #000000;
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.3);
  transform: translateY(-2px);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}
.navbar select:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
  border-color: #000000;
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.4);
}
.navbar > .icon {
  display: none;
}
#menu,
#random,
#start {
  cursor: pointer;
}

/* Center css */
.center {
  margin: 1rem auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  flex: 1;
  min-height: 0;
  max-height: 100%;
  width: 92%;
  max-width: 900px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  border: 3px solid #000000;
  padding: 1rem;
  animation: fadeIn 0.6s ease-in;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.center::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.05) 0%, transparent 70%);
  animation: rotate 20s linear infinite;
  pointer-events: none;
}
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.array {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex: 1;
  min-height: 0;
  padding: 1rem;
  flex-direction: row;
  gap: 4px;
  position: relative;
  z-index: 1;
}
.cell {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex: 1;
  min-width: 5px;
  margin: 0 1px;
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  border-radius: 6px 6px 0 0;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid #000000;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}
.cell::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
  border-radius: 6px 6px 0 0;
  pointer-events: none;
}
.cell.done {
  background: linear-gradient(180deg, var(--success-color) 0%, #059669 100%);
  border: 2px solid #000000;
  box-shadow: 0 5px 12px rgba(16, 185, 129, 0.4);
  animation: glow 1.5s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { box-shadow: 0 5px 12px rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 5px 20px rgba(16, 185, 129, 0.6); }
}
.cell.visited {
  background: linear-gradient(180deg, var(--accent-color) 0%, var(--primary-color) 100%);
  border: 2px solid #000000;
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.3);
}
.cell.current {
  background: linear-gradient(180deg, var(--warning-color) 0%, #d97706 100%);
  border: 2px solid #000000;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
  transform: scaleY(1.08) scaleX(1.05);
  z-index: 10;
  animation: pulse 0.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scaleY(1.08) scaleX(1.05); }
  50% { transform: scaleY(1.12) scaleX(1.08); }
}
.cell.min {
  background: linear-gradient(180deg, var(--danger-color) 0%, #dc2626 100%);
  border: 2px solid #000000;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
  transform: scaleY(1.03);
  z-index: 5;
}

/* Footer CSS */
.fa.fa-heart {
  color: var(--danger-color);
}
footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 0.8em 1em;
  background: var(--bg-white);
  border-top: 2px solid #000000;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}
.footer > p:nth-child(1) {
  margin-bottom: 0.5em;
  font-weight: 500;
  color: var(--text-dark);
}
.link {
  text-decoration: none;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 20px;
  margin: 0 15px;
  transition: all 0.2s ease;
  display: inline-block;
}
.link:hover {
  color: var(--primary-color);
  transform: translateY(-2px);
}

@media screen and (max-width: 600px) {
  .navbar {
    gap: 0.6em;
    padding: 0.8em;
  }
  .title {
    font-size: 2em;
    padding: 1em;
    letter-spacing: 1px;
  }
  .navbar *,
  .navbar a,
  .navbar button {
    font-size: 14px;
    padding: 10px 16px;
  }
  .navbar select {
    padding: 10px 35px 10px 16px;
  }
  .footer {
    font-size: 14px;
    padding: 1.5em 1em;
  }
  .link {
    font-size: 20px;
    margin: 0 10px;
  }
  #random {
    order: 4;
  }
  .start {
    order: 5;
  }
  .center {
    height: 450px;
    padding: 1.5rem;
  }
}
@media screen and (max-width: 550px) {
  .center {
    width: 95%;
    height: 350px;
  }
  .title {
    font-size: 1.6em;
    letter-spacing: 0.5px;
  }
}

