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

:root {
  --bg-primary: #000000;
  --bg-card: #080808;
  --bg-input: #0f0f0f;
  --text-primary: #ffffff;
  --text-secondary: #666666;
  --text-muted: #333333;
  --accent: #ffffff;
  --accent-soft: #f5f5f5;
  --border: #1a1a1a;
  --shadow: rgba(255, 255, 255, 0.05);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

.title {
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0;
}

.cipher-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3rem;
  margin-bottom: 3rem;
}

.mode-selector {
  margin-bottom: 2.5rem;
}

.mode-label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.mode-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  width: fit-content;
}

.mode-toggle input[type="radio"] {
  display: none;
}

.mode-option {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  margin: 0;
}

.mode-toggle input[type="radio"]:checked + .mode-option {
  background: var(--accent);
  color: var(--bg-primary);
}

.mode-option:hover:not(
    .mode-toggle input[type="radio"]:checked + .mode-option
  ) {
  background: var(--bg-card);
  color: var(--text-primary);
}

.input-group {
  margin-bottom: 2rem;
}

.input-group:last-child {
  margin-bottom: 0;
}

.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.file-btn {
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--bg-input);
}

.notifications-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notification {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.error {
  border-color: #ff4757;
  color: #ff4757;
}

.notification.success {
  border-color: var(--accent);
  color: var(--accent);
}

.notification.warning {
  border-color: #ffa502;
  color: #ffa502;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: normal;
}

input,
textarea {
  width: 100%;
  padding: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas,
    "Courier New", monospace;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

textarea {
  min-height: 100px;
  line-height: 1.5;
}

textarea:read-only {
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: default;
}

textarea:read-only:focus {
  border-color: var(--border);
  box-shadow: none;
}

input[type="number"] {
  font-family: inherit;
}

.controls {
  display: flex;
  gap: 1rem;
  margin: 3rem 0;
  justify-content: flex-start;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
}

.btn:hover {
  border-color: var(--accent);
  background: var(--bg-input);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

.btn.clear {
  color: var(--text-secondary);
  border-color: var(--text-muted);
}

.btn.clear:hover {
  color: var(--text-primary);
  border-color: var(--border);
}

.output-section {
  margin-top: 2rem;
}

.avalanche-section {
  margin-top: 1rem;
  text-align: center;
}

.processing {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .container {
    padding: 2rem 1rem;
  }

  .title {
    font-size: 2rem;
  }

  .cipher-section {
    padding: 2rem;
  }

  .controls {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .notifications-container {
    top: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .notification {
    max-width: none;
  }

  .input-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

*,
*::before,
*::after {
  animation: none !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease,
    background-color 0.2s ease, opacity 0.2s ease !important;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--border);
}

.subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  font-weight: 400;
}

.back-button-container {
  margin-bottom: 2rem;
}

.research-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.results-section {
  margin-top: 3rem;
}

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

.results-panel {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
}

.results-panel h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.round-results {
  max-height: 300px;
  overflow-y: auto;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas,
    "Courier New", monospace;
  font-size: 0.875rem;
}

.round-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.round-item:last-child {
  border-bottom: none;
}

.round-number {
  font-weight: 500;
  color: var(--text-primary);
}

.changed-bits {
  color: #6c5ce7;
  font-weight: 500;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.summary-panel {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
}

.summary-panel h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

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

.summary-stats .stat-item {
  background: var(--bg-card);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
}

.summary-stats .stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.summary-stats .stat-value {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas,
    "Courier New", monospace;
}

@media (max-width: 768px) {
  .research-controls {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .summary-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
