:root {
  --bg-color: #141415;
  --panel-bg: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f2f8;
  --text-secondary: #9ba0b4;
  --primary-color: #4c7cc5;
  --primary-hover: #467be5;
  --accent-blue: #2f6bcd;
  /* x */
  --accent-purple: #9e62db;
  /* y */
  --accent-pink: #851d21;
  /* z */
  --success: #077550;
  --error: #ef4444;
  --block-bg: rgba(255, 255, 255, 0.05);
  --block-border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(circle at 15% 50%, rgba(81, 125, 207, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(141, 49, 71, 0.12) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 2rem;
  gap: 2rem;
}

h1,
h2,
h3 {
  font-family: 'Outfit', sans-serif;
}

/* NAVBAR */
.navbar {
  width: 100%;
  max-width: 1400px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  box-sizing: border-box;
}

.nav-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  background: #FFFFFF;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
  padding: 0.5rem 1rem;
  border-radius: 8px;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--primary-color);
  background: rgba(76, 124, 197, 0.1);
  border: 1px solid rgba(76, 124, 197, 0.3);
}

.app-container {
  width: 100%;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.layout-split {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

@media (max-width: 900px) {
  .layout-split {
    flex-direction: column;
  }
}

.layout-sidebar {
  flex: 0 0 350px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.layout-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.header {
  text-align: center;
}

.header h1 {
  font-size: 2.7rem;
  font-weight: 700;
  background: #FFFFFF;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.2rem;
}

.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

select,
input[type="range"],
input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.helper-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.helper-text code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  color: #a5b4fc;
}

select,
input[type="range"] {
  cursor: pointer;
}

select:focus,
input[type="text"]:focus {
  border-color: var(--primary-color);
}

input[type="range"] {
  accent-color: var(--primary-color);
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.btn-action {
  background: rgba(192, 132, 252, 0.1);
  color: #e8b2ff;
  border: 1px solid rgba(192, 132, 252, 0.3);
}

.btn-action:hover:not(:disabled) {
  background: rgba(192, 132, 252, 0.2);
  transform: translateY(-2px);
}

.simulator {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
}

.status-indicator {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-badge {
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

.status-badge.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--success);
  color: #34d399;
}

.status-badge.error {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--error);
  color: #fca5a5;
  animation: pulse-error 2s infinite;
}

@keyframes pulse-error {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.string-info {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 0.95rem;
}

#stringLength {
  color: var(--text-primary);
}

.string-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.string-label {
  display: flex;
  gap: 2rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  opacity: 0.8;
}

.x-label {
  color: #93c5fd;
}

.y-label {
  color: #e8b2ff;
}

.z-label {
  color: #f9a8d4;
}

.string-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-content: center;
  padding: 1.5rem;
  min-height: 100px;
  width: 100%;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  border: 1px dashed var(--panel-border);
  user-select: none;
}

.char-block {
  width: 48px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-family: 'Outfit', monospace;
  font-weight: 700;
  background: var(--block-bg);
  border: 2px solid var(--block-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease, transform 0.1s;
  position: relative;
  color: var(--text-secondary);
}

.char-block:active {
  transform: scale(0.95);
}

.char-block:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.char-block.x-part {
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.1);
}

.char-block.x-part:hover {
  background: rgba(59, 130, 246, 0.2);
}

.char-block.y-part {
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px rgba(192, 132, 252, 0.3);
  background: rgba(192, 132, 252, 0.15);
  color: #e8b2ff;
  transform: translateY(-3px);
  z-index: 10;
}

.char-block.y-part:hover {
  background: rgba(192, 132, 252, 0.25);
}

.char-block.z-part {
  border-color: var(--accent-pink);
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.2);
  color: #f9a8d4;
  background: rgba(236, 72, 153, 0.1);
}

.char-block.z-part:hover {
  background: rgba(236, 72, 153, 0.2);
}

.char-block.y-pumped {
  border-style: dashed;
  opacity: 0.9;
  animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pop-in {
  0% {
    transform: scale(0.5) translateY(10px);
    opacity: 0;
  }

  100% {
    transform: scale(1) translateY(-3px);
    opacity: 0.9;
  }
}

.instruction-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.info {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.info h2 {
  font-size: 1.3rem;
  color: var(--text-primary);
  font-weight: 600;
}

.logic-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  padding: 1.2rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-value {
  font-size: 1.8rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: white;
}

.target-lang {
  color: #a5b4fc;
}

/* Scrollbar styling for block container */
.string-blocks::-webkit-scrollbar {
  height: 8px;
}

.string-blocks::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.string-blocks::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Formal Definition / Theorem Box Styling */
.theorem-box {
  margin: 0;
  width: 100%;
  text-align: left;
  padding: 1.25rem 1.5rem;
  background: rgba(0, 0, 0, 0.15);
  border-left: 4px solid var(--primary-color);
  border-radius: 8px 16px 16px 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theorem-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.theorem-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.theorem-conditions {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theorem-conditions li {
  font-size: 0.95rem;
  color: var(--text-secondary);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  transition: all 0.3s ease;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
}

.theorem-conditions li span {
  color: var(--primary-color);
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}

.theorem-conditions strong {
  color: #e2e8f0;
  font-family: 'Outfit', monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

/* Interactive Feedback Styles */
.theorem-conditions li.condition-pass {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.theorem-conditions li.condition-pass span {
  color: #a7f3d0;
}

.theorem-conditions li.condition-pass strong {
  color: #34d399;
  background: rgba(16, 185, 129, 0.2);
}

.theorem-conditions li.condition-fail {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.theorem-conditions li.condition-fail span {
  color: #fecaca;
}

.theorem-conditions li.condition-fail strong {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.2);
}

/* Proof Box Styles */
.proof-panel {
  margin-top: 0;
  border-left: 4px solid #a5b4fc;
}

.proof-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.proof-text-active {
  color: var(--text-primary);
}

.proof-var {
  font-family: 'Outfit', monospace;
  font-weight: 700;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.proof-string {
  font-family: monospace;
  color: #93c5fd;
  word-break: break-word;
}

/* DFA SVG Styles */
.dfa-visualization {
  margin-top: 1rem;
  width: 100%;
}

.dfa-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--panel-border);
}

.dfa-node, .dfa-edge {
  transition: all 0.3s ease;
}

.dfa-node.active-x {
  fill: #1e3a8a;
  stroke: #93c5fd;
  filter: drop-shadow(0 0 8px rgba(147, 197, 253, 0.8));
}

.dfa-edge.active-x {
  stroke: #93c5fd;
}

.dfa-node.active-y {
  fill: #4c1d95;
  stroke: #e8b2ff;
  filter: drop-shadow(0 0 12px rgba(232, 178, 255, 0.9));
  transform-box: fill-box;
  transform-origin: center;
  animation: node-pulse-y 0.5s ease-in-out forwards;
}

.dfa-edge.active-y {
  stroke: #e8b2ff;
}

.dfa-node.active-z {
  fill: #831843;
  stroke: #f9a8d4;
  filter: drop-shadow(0 0 8px rgba(249, 168, 212, 0.8));
}

.dfa-edge.active-z {
  stroke: #f9a8d4;
}

@keyframes node-pulse-y {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* HOME PAGE STYLES */
.hero-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4rem;
  padding-top: 2rem;
  flex: 1;
}

.hero-header {
  text-align: center;
  max-width: 800px;
}

.hero-header h1 {
  font-size: 3.5rem;
  font-weight: 700;
  background: #FFFFFF;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.35rem;
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.hero-btn {
  font-size: 1.1rem;
  padding: 1rem 2rem;
  text-decoration: none;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  width: 100%;
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem;
  transition: transform 0.3s ease, background 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.08);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.feature-card h3 {
  font-size: 1.4rem;
  color: #e2e8f0;
}

.feature-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 1rem;
}

/* THEORY PAGE STYLES */
.theory-container {
  align-items: center;
  flex: 1;
}

.theory-content {
  width: 100%;
  max-width: 900px;
  padding: 3rem;
  margin: 0 auto;
}

.theory-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: #e2e8f0;
}

.theory-section {
  margin-bottom: 3rem;
}

.theory-section h2 {
  font-size: 1.6rem;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--panel-border);
}

.theory-body-text {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.proof-steps {
  list-style-position: inside;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.2);
  padding: 1.5rem 2rem;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
}

.proof-steps li {
  margin-left: 0;
}

.proof-steps strong {
  color: #e2e8f0;
}