:root {
  --bg: #0f172a;
  --bg-alt: #111827;
  --card: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --ok: #10b981;
  --bad: #ef4444;
  --warn: #f59e0b;
  --input: #111827;
  --border: #334155;
  --btn: #2563eb;
  --btn-hover: #1d4ed8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

body {
  background: linear-gradient(145deg, var(--bg), var(--bg-alt));
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
}

.hidden {
  display: none !important;
}

.card {
  width: 100%;
  max-width: 460px;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.login-card {
  margin: 10vh auto 0;
}

h1 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

label {
  display: block;
  margin-bottom: 6px;
  margin-top: 8px;
  font-size: 0.92rem;
  color: #d1d5db;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 6px;
}

input:focus {
  border-color: #60a5fa;
  outline: none;
}

button,
.button {
  width: 100%;
  background: var(--btn);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 12px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s ease;
  text-align: center;
}

button:hover,
.button:hover {
  background: var(--btn-hover);
}

.button.secondary {
  background: #374151;
}

.button.secondary:hover {
  background: #4b5563;
}

.button.warn {
  background: #b45309;
}

.button.warn:hover {
  background: #92400e;
}

.msg {
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--warn);
  min-height: 20px;
}

.admin-users {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.admin-users summary {
  cursor: pointer;
  color: #bfdbfe;
  font-weight: 700;
}

.admin-help {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.admin-form {
  margin-top: 10px;
}

.users-list {
  list-style: none;
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.users-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.users-list button {
  width: auto;
  min-width: 88px;
  padding: 8px 10px;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.app-header p {
  color: var(--muted);
  margin-top: 6px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.app-header .button {
  width: auto;
  min-width: 140px;
}

#adminPanelBtn {
  min-width: 48px;
  width: 48px;
  padding: 10px 0;
  font-size: 18px;
}

.view {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.panel-switcher {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.simulacro-section {
  margin-top: 16px;
}

.simulacro-section h4 {
  margin: 0 0 4px;
}

.simulacro-section > p {
  margin: 0 0 12px;
  color: var(--muted);
}

.card-tag {
  display: inline-block;
  margin: 0 0 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.tag-exam {
  background: #14532d;
  color: #dcfce7;
}

.tag-thematic {
  background: #0c4a6e;
  color: #e0f2fe;
}

.tag-pending {
  background: #78350f;
  color: #fef3c7;
}

.panel-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #0f172a;
}

.panel-card h3 {
  margin-bottom: 8px;
}

.panel-card p {
  color: var(--muted);
  min-height: 42px;
  margin-bottom: 10px;
}

.panel-card .button {
  margin-top: 6px;
}

.exam-head {
  margin-bottom: 16px;
}

.exam-head p {
  color: var(--muted);
  margin-top: 8px;
}

.question-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: #0f172a;
}

.question-card.correct {
  border-color: var(--ok);
  background: rgba(16, 185, 129, 0.08);
}

.question-card.incorrect {
  border-color: var(--bad);
  background: rgba(239, 68, 68, 0.08);
}

.question-card.unanswered {
  border-color: var(--warn);
  background: rgba(245, 158, 11, 0.08);
}

.question-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.options-group {
  display: grid;
  gap: 8px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #d1d5db;
}

.option-item input {
  margin-top: 2px;
}

.result-chip {
  display: inline-block;
  margin-top: 10px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.result-chip.ok {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}

.result-chip.bad {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

.result-chip.pending {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

.feedback {
  margin-top: 10px;
  border-top: 1px dashed #475569;
  padding-top: 10px;
  color: #cbd5e1;
  line-height: 1.45;
}

.feedback p {
  margin-bottom: 8px;
}

.feedback a {
  color: #93c5fd;
}

.quote-btn {
  min-width: 170px;
}

.manual-quote {
  margin: 8px 0 10px;
  padding: 10px 12px;
  border-left: 3px solid #60a5fa;
  background: rgba(59, 130, 246, 0.08);
  color: #dbeafe;
  border-radius: 6px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.actions .button {
  width: auto;
}

.actions-bottom {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px dashed #334155;
}

.score {
  font-weight: 700;
  margin-bottom: 12px;
}

.score.live {
  color: #93c5fd;
  font-weight: 600;
}

.icon-btn {
  min-width: 48px;
  max-width: 56px;
  font-size: 1.1rem;
  padding: 9px 0;
}

@media (max-width: 700px) {
  body {
    padding: 12px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .app-header .button {
    width: 100%;
  }

  #adminPanelBtn {
    width: 100%;
  }
}
