:root {
  --bg-body: #f5f6fa;
  --bg-card: #ffffff;
  --border-subtle: #e0e4ef;
  --text-main: #1f2430;
  --text-muted: #6c7387;
  --accent: #2f80ed;
  --accent-soft: rgba(47, 128, 237, 0.12);
  --accent-strong: #1b5fc4;
  --danger: #e53935;
  --danger-soft: rgba(229, 57, 53, 0.1);
  --success: #27ae60;
  --success-soft: rgba(39, 174, 96, 0.1);
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.07);
  --radius-xl: 18px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --transition-fast: 0.18s ease-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top left, #ecf3ff 0, #f5f6fa 45%, #f5f6fa 100%);
  color: var(--text-main);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(18px);
  background: linear-gradient(
      to bottom,
      rgba(248, 249, 253, 0.92),
      rgba(248, 249, 253, 0.94)
  );
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 600;
  font-size: 16px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* Layout */

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

.screen {
  display: none;
}

.screen.active {
  display: block !important;
}

.screen-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.screen-title {
  font-size: 22px;
  font-weight: 600;
}

.screen-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Typo */

h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.lead {
  margin-top: 0;
  margin-bottom: 18px;
  color: var(--text-muted);
  max-width: 640px;
}

/* Cards */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(15, 23, 42, 0.03);
}

.card + .card {
  margin-top: 18px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

/* Module tiles */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.module-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 16px 16px 18px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast), background var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 46px rgba(15, 23, 42, 0.11);
  border-color: rgba(47, 128, 237, 0.35);
  background: linear-gradient(
    145deg,
    rgba(47, 128, 237, 0.03),
    rgba(47, 128, 237, 0.01)
  );
}

.module-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.module-title {
  font-size: 16px;
  font-weight: 600;
}

.module-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Progress */

.progress-wrapper {
  margin-bottom: 14px;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.28);
  overflow: hidden;
}

.progress-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  width: 0;
  background: linear-gradient(90deg, #42a5f5, #2f80ed, #2563eb);
  transition: width 0.18s ease-out;
}

.progress-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Question view */

.question-text {
  font-weight: 500;
  margin-bottom: 10px;
}

.statement-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.statement-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: #f9fafb;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.statement-row.correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.statement-row.incorrect {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.statement-label {
  flex: 1;
  font-size: 14px;
}

.statement-options {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.statement-options label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.statement-feedback {
  font-size: 12px;
  color: var(--text-muted);
}

/* Form / Inputs */

.field-label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.field-input,
select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  font: inherit;
  background: #f9fafb;
}

.field-input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(47, 128, 237, 0.3);
}

/* Buttons */

button {
  font-family: inherit;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
    box-shadow var(--transition-fast), transform var(--transition-fast),
    border-color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.primary-btn {
  background: linear-gradient(135deg, #2f80ed, #2563eb);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.35);
}

.primary-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}

.primary-btn:disabled {
  background: #9ca3af;
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-btn {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.secondary-btn:hover {
  background: rgba(47, 128, 237, 0.18);
}

.ghost-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.ghost-btn:hover {
  background: rgba(148, 163, 184, 0.12);
}

button.small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Actions */

.actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.actions.stack {
  flex-direction: column;
  align-items: stretch;
}

.actions.right {
  justify-content: flex-end;
}

/* Result view */

.result-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.result-score {
  font-size: 32px;
  font-weight: 700;
}

.result-details {
  font-size: 14px;
  color: var(--text-muted);
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
}

.result-item {
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  background: #f9fafb;
}

.result-item-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}

.result-item-header .status {
  font-weight: 600;
}

.result-item-header .status.ok {
  color: var(--success);
}

.result-item-header .status.fail {
  color: var(--danger);
}

.result-statements {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.result-statement.ok {
  color: var(--success);
}

.result-statement.fail {
  color: var(--danger);
}

/* Admin */

.admin-question-list {
  max-height: 320px;
  overflow-y: auto;
  font-size: 13px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  background: #f9fafb;
}

.admin-question {
  padding: 6px 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.admin-question:last-child {
  border-bottom: none;
}

.admin-question-title {
  font-weight: 500;
}

.admin-question-statements {
  color: var(--text-muted);
}

#adminToggleBtn {
  display: none !important;
}

.json-textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  font-size: 12px;
  background: #f9fafb;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Footer */

.app-footer {
  padding: 12px 16px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Helpers */

.hidden {
  display: none !important;
}

/* Responsive */

@media (max-width: 640px) {
  .app-main {
    padding-inline: 12px;
  }

  .screen-header {
    flex-direction: column;
    align-items: stretch;
  }

  .result-summary {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Ellenőrzés előtti kijelölés: ugyanaz a vibe, mint a modulkártya hover */
.statement-row.selected {
  border-color: rgba(47, 128, 237, 0.35);
  background: linear-gradient(
    145deg,
    rgba(47, 128, 237, 0.03),
    rgba(47, 128, 237, 0.01)
  );
}

/* Helyes válasz felirat a sor végén (csak ellenőrzés után jelenik meg) */
.correct-answer-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
}

/* helper */
.hidden {
  display: none !important;
}

/* Jelölhető sor */
.statement-row.selectable {
  cursor: pointer;
  transition: all 0.15s ease;
}

/* JELÖLÉS – határozott, kék, kontrasztos */
.statement-row.selected {
  border: 2px solid #2f80ed;
  background: #e3efff;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.25);
}

/* Szöveg szín kontrasztnövelés */
.statement-row.selected .statement-label {
  color: #1a3d7c;
  font-weight: 600;
}

#testScreen .primary-btn {
  width: 100%;
  display: block;
  text-align: center;
}
