/* Styles for wolfram-rules-explorer.html */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: #e0e0e0;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  min-height: 100vh;
  padding: 0;
}

.container {
  width: 100vw;
  min-height: 100vh;
  margin: 0;
  background: rgba(26, 26, 26, 0.8);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.header {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #1a1a1a;
  padding: 2rem;
  text-align: center;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.8;
}

.main-content {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 0;
  min-height: calc(100vh - 120px);
}

.controls-panel {
  background: rgba(40, 40, 40, 0.9);
  padding: 2rem;
  border-right: 1px solid rgba(255, 215, 0, 0.2);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.canvas-area {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(20, 20, 20, 0.5);
  overflow: auto;
}

.section-title {
  color: #ffd700;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 1.5rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.section-title:first-of-type {
  margin-top: 0;
}

/* Simple utility text styles extracted from inline */
.muted-help {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1rem;
}

.control-inline-label {
  color: rgba(255, 215, 0, 0.8);
  font-size: 0.9rem;
}

/* Rule Definition Grid */
.rule-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 1rem 0;
}

.rule-cell {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  transition: all 0.3s ease;
}

.rule-cell:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.6);
}

.rule-pattern {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.8);
}

.rule-output {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 4px;
  margin: 0 auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: all 0.3s ease;
}

.rule-output.active {
  background: #ffd700;
  color: #1a1a1a;
}

.rule-output:hover {
  border-color: #ffd700;
  transform: scale(1.1);
}

/* Preset Rules */
.preset-rules {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 1rem 0;
}

.preset-rule {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.preset-rule:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.6);
}

.preset-rule.active {
  background: rgba(255, 215, 0, 0.2);
  border-color: #ffd700;
}

.preset-number {
  font-weight: bold;
  color: #ffd700;
  font-size: 1.1rem;
}

.preset-description {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* Saved Rules */
.saved-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1rem 0;
  min-height: 20px;
}

.saved-rules.empty::after {
  content: "没有收藏的规则";
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  font-style: italic;
}

.saved-rule {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.saved-rule:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.6);
  transform: translateY(-1px);
}

.saved-rule.active {
  background: rgba(255, 215, 0, 0.2);
  border-color: #ffd700;
}

.saved-rule-label {
  color: #ffd700;
  font-weight: 600;
}

.saved-rule-remove {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: bold;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.saved-rule-remove:hover {
  background: rgba(255, 100, 100, 0.8);
  color: white;
  transform: scale(1.1);
}

/* Control Buttons and Sliders */
.control-group {
  margin: 1rem 0;
}

.control-label {
  display: block;
  color: rgba(255, 215, 0, 0.8);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.control-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.btn {
  padding: 8px 16px;
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 215, 0, 0.8);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  flex: 1;
}

.btn:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.6);
}

.btn.primary {
  background: rgba(255, 215, 0, 0.2);
  color: #ffd700;
  border-color: #ffd700;
}

.btn.primary:hover {
  background: rgba(255, 215, 0, 0.3);
}

.slider {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffd700;
  cursor: pointer;
}

.slider-value {
  color: rgba(255, 215, 0, 0.8);
  font-weight: 500;
  min-width: 40px;
  text-align: center;
}

.btn-add-rule {
  padding: 8px 12px;
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 215, 0, 0.8);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  transition: all 0.3s ease;
  margin-left: 8px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-add-rule:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.6);
  transform: scale(1.1);
}

/* Canvas Styling */
#cellular-canvas {
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  background: #000;
  margin: 1rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.canvas-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0;
  padding: 12px 16px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 6px;
  font-size: 0.9rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.info-label {
  color: rgba(255, 215, 0, 0.8);
  font-size: 0.8rem;
}

.info-value {
  color: #ffd700;
  font-weight: bold;
}

/* Rule Analysis */
.rule-analysis {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 6px;
  padding: 12px;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.analysis-title {
  color: #ffd700;
  font-weight: 600;
  margin-bottom: 8px;
}

.analysis-text {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .main-content { grid-template-columns: 350px 1fr; }
}

@media (max-width: 1024px) {
  .main-content { grid-template-columns: 1fr; min-height: auto; }
  .controls-panel { max-height: none; border-right: none; border-bottom: 1px solid rgba(255, 215, 0, 0.2); padding: 1.5rem; }
  .canvas-area { padding: 1rem; }
  .rule-grid { grid-template-columns: repeat(8, 1fr); }
  .preset-rules { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .container { margin: 0; border-radius: 0; }
  .header { padding: 1.5rem; }
  .header h1 { font-size: 2rem; }
  .controls-panel, .canvas-area { padding: 1rem; }
  .rule-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .rule-output { width: 25px; height: 25px; }
  .preset-rules { grid-template-columns: repeat(2, 1fr); }
  .canvas-info { flex-direction: column; gap: 8px; }
  #cellular-canvas { max-width: 100%; height: auto; }
}

/* Loading Animation */
@keyframes pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
.generating { animation: pulse 1.5s infinite; }

