/* Default page background; exam page sets --exam-bg from B.png */
:root {
  --exam-bg: #f5f5f5;
}

/* Chrome-like neutral background */
.chrome-bg {
  margin: 0;
  min-height: 100vh;
  background: #f5f5f5;
  color: #202124;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  font-size: 15px;
}

.centered {
  max-width: 360px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.centered h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.error {
  color: #b3261e;
  margin-bottom: 0.75rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.1);
}

.card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
}

.card input {
  padding: 0.5rem 0.6rem;
  border: 1px solid #dadce0;
  border-radius: 4px;
}

.card button,
.topbar button,
.exam-nav button,
.btn-primary,
.btn-secondary {
  cursor: pointer;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  border: 1px solid #dadce0;
  background: #fff;
  font-size: 0.875rem;
}

.card button,
.btn-primary {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

/* .topbar button alone wins over .btn-primary and forces white bg + .btn-primary's white text → invisible label */
.topbar button.btn-primary {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid #dadce0;
}

.topbar h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.main-pad {
  padding: 1rem 1.25rem;
  max-width: 720px;
}

.results-section-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.results-section-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

a.btn-retry {
  display: inline-block;
  padding: 0.22rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #1a73e8;
  text-decoration: none;
  border: 1px solid #1a73e8;
  border-radius: 3px;
  background: #fff;
  max-width: 100%;
  line-height: 1.25;
}

a.btn-retry:hover {
  background: #e8f0fe;
}

.config-retry-note {
  margin: 0 0 1rem;
  line-height: 1.45;
}

.review-main {
  max-width: 980px;
}

.review-actions {
  margin-bottom: 0.75rem;
}

a.ask-ai-btn,
button.ask-ai-btn {
  text-decoration: none;
  display: inline-block;
}

form.ask-ai-form {
  display: inline;
  margin: 0;
}

.review-topbar {
  gap: 0.75rem;
}

.review-topbar h1 {
  flex: 1;
  text-align: center;
}

.review-options-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  justify-content: flex-start;
  padding-bottom: 0.25rem;
}

.review-option-img {
  flex: 0 0 auto;
  display: block;
  max-width: none;
}

@media (max-width: 880px) {
  .review-topbar {
    flex-wrap: wrap;
  }

  .review-topbar h1 {
    order: 3;
    width: 100%;
    text-align: left;
  }
}

.answer-toggle {
  font: inherit;
  font-size: inherit;
  color: #1a73e8;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-decoration: underline;
}

.answer-toggle:hover {
  color: #1558b0;
}

.answer-toggle:focus-visible {
  outline: 1px solid #1a73e8;
  outline-offset: 1px;
  border-radius: 2px;
}

.result-bad-with-retry {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
}

.retry-one-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.btn-retry-inline {
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.08rem 0.32rem;
  color: #1a73e8;
  background: #fff;
  border: 1px solid #1a73e8;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.25;
}

.btn-retry-inline:hover {
  background: #e8f0fe;
}

.btn-retry-inline:focus-visible {
  outline: 1px solid #1a73e8;
  outline-offset: 1px;
}

.btn-retry-inline-bad {
  color: #c5221f;
  border-color: #c5221f;
}

.btn-retry-inline-bad:hover {
  background: #fce8e6;
}

.btn-retry-inline-bad:focus-visible {
  outline-color: #c5221f;
}

.intro {
  margin: 0 0 1.25rem;
  line-height: 1.45;
}

.section {
  margin-bottom: 2rem;
}

.section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.muted {
  color: #5f6368;
  font-size: 0.875rem;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  margin: 0.35rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}

.delete-attempt-form {
  display: inline;
  margin: 0;
}

.btn-delete {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.8125rem;
  color: #c5221f;
  cursor: pointer;
  text-decoration: underline;
}

.btn-delete:hover {
  color: #a50e0e;
}

.link-list a {
  color: #1a73e8;
  text-decoration: none;
}

.link-list a:hover {
  text-decoration: underline;
}

code {
  font-size: 0.85em;
}

/* Exam layout — images share one scale factor (JS) so the page fits the browser width */
.exam-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Exam uses --exam-bg (sampled from B.png) when body.exam-page-bg is set */
body.exam-page-bg.chrome-bg {
  background: var(--exam-bg);
}

body.exam-page-bg .exam-shell {
  background: var(--exam-bg);
}

.exam-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border-bottom: 1px solid #dadce0;
}

body.exam-page-bg .exam-top {
  background: var(--exam-bg);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.exam-top-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.timer {
  min-width: 6.75rem;
  text-align: center;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  background: #f5f5f5;
}

body.exam-page-bg .timer:not(.timer-expired) {
  background: var(--exam-bg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.timer-expired {
  background: #f28b82;
  color: #202124;
}

.btn-secondary {
  background: #fff;
}

.btn-primary {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

.exam-main {
  flex: 1;
  padding: 0.75rem;
  margin: 0 auto;
  width: 80%;
  max-width: 80%;
  min-width: 0;
  box-sizing: border-box;
}

.problem-wrap {
  text-align: center;
  margin-bottom: 0.75rem;
}

.problem-img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: auto;
  height: auto;
  max-width: 100%;
  border: 1px solid #dadce0;
  border-radius: 4px;
  background: #fff;
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-content: flex-start;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1rem;
  box-sizing: border-box;
}

.opt-btn {
  flex-shrink: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.opt-btn img {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
}

.opt-btn.selected {
  border-color: #1a73e8;
  box-shadow: 0 0 0 1px #1a73e8;
}

.exam-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.results-result-cell {
  text-align: left;
  white-space: nowrap;
}


.results-time-high {
  color: #c5221f;
  font-weight: 600;
}

.results-time-warn {
  color: #f9ab00;
  font-weight: 600;
}

button.result-toggle {
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  vertical-align: baseline;
  -webkit-appearance: none;
  appearance: none;
  font-variant-emoji: text;
}

button.result-toggle.result-ok {
  color: #81c784;
}

button.result-toggle.result-bad {
  color: #ef9a9a;
}

button.result-toggle:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
  border-radius: 2px;
}

.result-mark {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  font-variant-emoji: text;
}

.result-ok {
  color: #81c784;
}

.result-ok-recovered {
  color: #fb8c00;
}

.result-bad {
  color: #ef9a9a;
}

span.result-mark.result-ok,
span.result-mark.result-ok-recovered,
span.result-mark.result-bad {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a.results-problem-btn {
  box-sizing: border-box;
  width: 3em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35em 0;
  border: 1px solid #dadce0;
  border-radius: 4px;
  background: #fff;
  color: #1a73e8;
  font-size: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
}

a.results-problem-btn:hover {
  background: #f8f9fa;
  border-color: #bdc1c6;
}

a.results-problem-btn:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.results-table {
  border-collapse: collapse;
  width: 100%;
  max-width: 520px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
}

.results-table th,
.results-table td {
  border-bottom: 1px solid #e8eaed;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.results-table th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 0.85rem;
}
