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

body {
  font-family: 'Space Grotesk', 'Arial Black', sans-serif;
  min-height: 100vh;
  background: #fef3e2;
  padding: 40px 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: #fffef9;
  border: 5px solid black;
  box-shadow: 12px 12px 0 black;
  padding: 40px;
}

h1 {
  text-align: center;
  color: black;
  font-size: 3.5rem;
  margin-bottom: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -2px;
}

.subtitle {
  text-align: center;
  color: black;
  margin-bottom: 40px;
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
}

.input-section {
  background: #e8f4f8;
  padding: 30px;
  border: 4px solid black;
  margin-bottom: 30px;
  box-shadow: 8px 8px 0 black;
}

.input-container {
  display: flex;
  gap: 15px;
  margin-bottom: 0;
}

input[type="text"] {
  flex-grow: 1;
  padding: 15px 20px;
  border: 4px solid black;
  font-size: 1.1rem;
  font-weight: 700;
  background: white;
  transition: all 0.1s ease;
}

input[type="text"]:focus {
  outline: none;
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 black;
}

button {
  padding: 15px 35px;
  border: 4px solid black;
  background: #c8e6c9;
  color: black;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 900;
  text-transform: uppercase;
  transition: all 0.1s ease;
  box-shadow: 4px 4px 0 black;
}

button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 black;
}

button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 black;
}

.visualization-section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 1.8rem;
  color: black;
  margin-bottom: 25px;
  font-weight: 900;
  text-transform: uppercase;
  padding-left: 20px;
  border-left: 8px solid #b8a4c9;
}

.visualization-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
}

.graph-wrapper {
  background: white;
  border: 5px solid black;
  overflow: hidden;
  box-shadow: 8px 8px 0 black;
  transition: all 0.1s ease;
}

.graph-wrapper:hover {
  transform: translate(-3px, -3px);
  box-shadow: 11px 11px 0 black;
}

.graph-header {
  background: #ffd4d4;
  color: black;
  padding: 15px 20px;
  font-weight: 900;
  font-size: 1.1rem;
  text-transform: uppercase;
  border-bottom: 5px solid black;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.graph-header.nfa-header {
  background: #ffd4d4;
}

.graph-header.dfa-header {
  background: #d4e7ff;
}

.graph-header.min-header {
  background: #fff4d4;
}

.graph {
  padding: 20px;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.download-btn {
  padding: 8px 12px;
  border: 3px solid black;
  background: #fff;
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 3px 3px 0 black;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

.download-btn:hover {
  transform: translate(-2px, -2px) rotate(-2deg);
  box-shadow: 5px 5px 0 black;
  background: #ffeef6;
}

.download-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 black;
}

.test-string-section {
  background: #f5e6ff;
  padding: 30px;
  border: 4px solid black;
  box-shadow: 8px 8px 0 black;
}

.test-string-container {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

#test-result {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 900;
  padding: 25px;
  border: 4px solid black;
  text-transform: uppercase;
  box-shadow: 6px 6px 0 black;
  transition: all 0.1s ease;
}

#test-result.accepted {
  background: #c8e6c9;
  color: black;
}

#test-result.rejected {
  background: #ffcdd2;
  color: black;
}

.empty-state {
  color: #666;
  text-align: center;
  padding: 40px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
}



@keyframes popIn {
  0% { transform: scale(0.6) rotate(-10deg); opacity: 0; }
  70% { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}



.char-bubbles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
}

.char-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 3px solid black;
  border-radius: 12px;
  background: #fff;
  box-shadow: 3px 3px 0 black;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.7) rotate(-6deg);
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.char-bubble.show {
  opacity: 1;
  transform: scale(1) rotate(0);
  animation: popIn 300ms ease-out;
}

.char-bubble.active {
  background: #fff7cc;
}

.char-bubble.pass {
  background: #c8e6c9;
}

.char-bubble.fail {
  background: #ffcdd2;
}



.shake {
  animation: shake 450ms cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

@media (max-width: 768px) {
  .container {
    padding: 20px;
    box-shadow: 8px 8px 0 black;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .visualization-container {
    grid-template-columns: 1fr;
  }
  
  .input-container,
  .test-string-container {
    flex-direction: column;
  }
  
  button {
    width: 100%;
  }
}

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

::-webkit-scrollbar-track {
  background: #fafafa;
  border: 2px solid black;
}

::-webkit-scrollbar-thumb {
  background: #b8a4c9;
  border: 2px solid black;
}

::-webkit-scrollbar-thumb:hover {
  background: #d4e7ff;
}