/* style.css — Hauptlayout, Typografie, Farben */

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

:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --primary: #4a6cf7;
  --primary-light: #e8ecff;
  --success: #22c55e;
  --success-light: #dcfce7;
  --error: #ef4444;
  --error-light: #fee2e2;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

#app {
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ======== START SCREEN ======== */

#start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}
#start-screen[hidden] { display: none; }

#start-screen h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  max-width: 500px;
}

/* Language picker */
.lang-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

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

.lang-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.lang-btn {
  padding: 0.45rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  transition: all 0.2s;
}

.lang-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.lang-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.mode-buttons {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 2.5rem;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  transition: all 0.2s;
  min-width: 220px;
}

.mode-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(74, 108, 247, 0.15);
  transform: translateY(-2px);
}

.mode-btn .icon {
  font-size: 1.8rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.mode-btn .label {
  font-size: 1.15rem;
  font-weight: 600;
}

.mode-btn .description {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ======== TUTORIAL SCREEN ======== */

#tutorial-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.tutorial-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

#back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-light);
  transition: all 0.2s;
}

#back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.progress-area {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
}

#step-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  max-width: 300px;
}

#progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0;
}

/* Main content area */
.tutorial-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

/* Tree panel (top, centered) */
#tree-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

#tree-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 300px;
}

/* Explorer toggle */
#explorer-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  width: fit-content;
  transition: all 0.2s;
}

#explorer-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Explorer panel */
#explorer-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.5rem;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

#explorer-panel.open {
  max-height: 300px;
}

.explorer-content {
  padding: 0.75rem;
}

.explorer-breadcrumb {
  font-size: 0.8rem;
  color: var(--text-light);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.bc-item {
  cursor: pointer;
  color: var(--primary);
}

.bc-item:hover {
  text-decoration: underline;
}

.bc-sep {
  color: var(--text-light);
}

.exp-item {
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.exp-item.folder {
  cursor: pointer;
}

.exp-item:hover {
  background: var(--border);
}

/* Content panel (below tree) */
#content-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 2rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

#step-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

#step-content {
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

#step-content p {
  margin-bottom: 0.75rem;
}

#step-content code {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

/* Task area */
.task-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.task-box.challenge {
  border-left: 3px solid var(--primary);
}

.task-text {
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.task-text code {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

.task-hint {
  font-size: 0.85rem;
  color: var(--text-light);
}

.challenge-progress {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

#path-input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

#path-input:focus {
  border-color: var(--primary);
}

#check-btn {
  padding: 0.6rem 1.2rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}

#check-btn:hover:not(:disabled) {
  background: #3b5ce5;
}

#check-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Feedback */
.feedback {
  min-height: 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  transition: all 0.3s;
}

.feedback.success {
  background: var(--success-light);
  color: #166534;
  padding: 0.75rem 1rem;
  border: 1px solid var(--success);
}

.feedback.error {
  background: var(--error-light);
  color: #991b1b;
  padding: 0.75rem 1rem;
  border: 1px solid var(--error);
}

.feedback code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.85em;
}

/* Navigation buttons */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.nav-btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  background: var(--card);
  color: var(--text);
  transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#next-btn {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

#next-btn:hover:not(:disabled) {
  background: #3b5ce5;
  color: white;
}

#next-btn:disabled {
  background: var(--border);
  border-color: var(--border);
  color: var(--text-light);
}

/* Completion screen */
.completion-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-primary {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #3b5ce5;
}

.btn-secondary {
  padding: 0.75rem 1.5rem;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

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

/* Multiclick task */
.multiclick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.mc-option {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.95rem;
  background: var(--card);
  color: var(--text);
  transition: all 0.2s;
}

.mc-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.mc-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.mc-option.correct {
  border-color: var(--success);
  background: var(--success-light);
  color: #166534;
}

.mc-option.wrong {
  border-color: var(--error);
  background: var(--error-light);
  color: #991b1b;
}

/* ======== Responsive ======== */
@media (max-width: 900px) {
  #tree-panel {
    padding: 0.75rem;
  }

  #content-panel {
    padding: 1rem;
  }

  #start-screen h1 {
    font-size: 2rem;
  }

  .mode-btn {
    min-width: 180px;
    padding: 1.5rem 2rem;
  }
}
