/* The JS toggles visibility purely via the `hidden` attribute; make sure no
   rule below can out-specificity the UA `[hidden] { display: none }` rule. */
[hidden] { display: none !important; }

:root {
  --color-bg: #f3f6fb;
  --color-card: #ffffff;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-border: #dce3ee;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  margin: 0;
  padding: 1.5rem 1rem 3rem;
  max-width: 56rem;
  margin-inline: auto;
  line-height: 1.5;
}

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

h1 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--color-primary-dark);
}

h2 {
  text-align: center;
  margin-top: 0;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

button:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

button:active {
  transform: translateY(1px);
}

/* Reset button: secondary, deliberately understated, top-right of the header. */
#reset-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  background: transparent;
  color: var(--color-muted);
  border-color: var(--color-border);
}

#reset-btn:hover {
  background: var(--color-border);
  color: var(--color-text);
}

/* Mode select screen */
#mode-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
}

button[data-mode] {
  width: 100%;
  max-width: 320px;
  padding: 0.9rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
}

button[data-mode]:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

#resume-message {
  color: var(--color-muted);
  margin: 0.5rem 0 0;
  text-align: center;
}

#resume-btn {
  width: 100%;
  max-width: 320px;
  padding: 0.7rem 1.5rem;
  background: var(--color-card);
  color: var(--color-primary-dark);
  border-color: var(--color-primary);
}

#resume-btn:hover {
  background: #eaf1fd;
}

/* Quiz screen */
#quiz {
  text-align: center;
}

#prompt {
  font-size: 1.6rem;
  font-weight: 600;
  margin: 1rem 0 0.75rem;
}

#score {
  display: inline-block;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font-size: 0.95rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

#score-value {
  font-weight: 600;
  color: var(--color-text);
}

#diagram-wrap {
  position: relative;
  display: inline-block;
  margin-top: 0.5rem;
}

#diagram-image {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(30, 41, 59, 0.12);
}

#diagram-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.hotspot { fill: transparent; stroke: transparent; cursor: pointer; transition: fill 0.2s, filter 0.2s; }
.hotspot.correct { fill: rgba(34, 197, 94, 0.55); filter: drop-shadow(0 0 14px #22c55e); }
.hotspot.incorrect { fill: rgba(239, 68, 68, 0.55); filter: drop-shadow(0 0 14px #ef4444); }

#diagram-error {
  color: #dc2626;
  font-weight: 600;
  margin-top: 1rem;
}

/* Summary screen: a distinct card so it reads as "different step" from mode-select */
#summary {
  text-align: center;
  background: #eaf1fd;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
}

#summary-text {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

#summary button {
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  margin: 0.35rem;
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

#summary button:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

#new-mode-btn {
  background: var(--color-card);
  color: var(--color-primary-dark);
}

#new-mode-btn:hover {
  background: #dbe7fb;
}
