:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-elevated: #101010;
  --panel: rgba(18, 18, 18, 0.92);
  --panel-strong: #171717;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(219, 49, 73, 0.58);
  --text: #f7f7f8;
  --text-muted: #9b9ba2;
  --primary: #db3149;
  --primary-strong: #bd1f39;
  --accent: #ff6379;
  --success: #34d399;
  --danger: #fb7185;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  --radius-lg: 1.5rem;
  --radius-md: 0.9rem;
  --content-width: 1140px;
  font-family: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 10% 10%, rgba(136, 20, 38, 0.18), transparent 34rem),
    radial-gradient(circle at 90% 76%, rgba(88, 10, 24, 0.12), transparent 30rem),
    linear-gradient(145deg, #080405 0%, #030303 52%, #0b0507 100%);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.site-header,
.app,
.project-portfolio {
  width: min(calc(100% - 2rem), var(--content-width));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--content-width);
  min-height: 70px;
  padding-inline: 24px;
}

.portfolio-brand {
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 1px;
}

.portfolio-brand strong {
  color: #d43f52;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav__link {
  position: relative;
  display: block;
  padding: 8px 14px;
  color: #ddd;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 6px;
  transition: color 0.3s ease;
}

.site-nav__link:hover {
  color: #fff;
}

.site-nav__link--active {
  color: #d43f52;
}

.site-nav__link--active::after {
  position: absolute;
  right: 14px;
  bottom: 2px;
  left: 14px;
  height: 2px;
  content: "";
  background: #d43f52;
  border-radius: 2px;
}

.app {
  display: grid;
  align-items: center;
  padding-block: clamp(2rem, 6vw, 5rem);
}

.screen {
  width: 100%;
}

.screen[hidden] {
  display: none;
}

.start-layout,
.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr);
  gap: 1.25rem;
  align-items: stretch;
}

.panel {
  padding: clamp(1.35rem, 3vw, 2rem);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel--main {
  position: relative;
  overflow: hidden;
}

.panel--main::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 7rem;
  height: 0.22rem;
  content: "";
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.intro-kicker {
  display: flex;
  min-height: 2.6rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.intro-kicker .eyebrow {
  margin-bottom: 0;
}

.aws-badge {
  display: grid;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  background: #242f3e;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 0.75rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}

.aws-badge img {
  display: block;
  width: 100%;
  height: 100%;
}

.eyebrow,
.question-label {
  margin: 0 0 0.65rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  letter-spacing: -0.035em;
}

.intro-panel h1,
.result-panel h1 {
  max-width: 13ch;
  margin-bottom: 1rem;
  font-size: clamp(2.35rem, 5.5vw, 4.7rem);
  line-height: 0.99;
}

.lead {
  max-width: 56ch;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  color: var(--text-muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
}

.start-form label {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
  font-weight: 720;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
}

input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.78rem 1rem;
  color: var(--text);
  font-size: 1rem;
  background: rgba(7, 7, 7, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input::placeholder {
  color: #708197;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(219, 49, 73, 0.14);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-error {
  min-height: 1.25rem;
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
}

.field-error {
  color: var(--danger);
}

.button {
  display: inline-flex;
  min-height: 3.25rem;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.25rem;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: transform 150ms ease, background 150ms ease, opacity 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:focus-visible,
.answer-button:focus-visible,
.portfolio-brand:focus-visible,
.site-nav__link:focus-visible {
  outline: 3px solid rgba(219, 49, 73, 0.62);
  outline-offset: 3px;
}

.button--primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--primary-strong));
  box-shadow: 0 10px 26px rgba(189, 31, 57, 0.22);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 2.2rem;
}

.fact {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.fact strong,
.fact span {
  display: block;
}

.fact strong {
  margin-bottom: 0.25rem;
  font-size: 1.35rem;
}

.fact span {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.55rem;
}

.ranking-badge {
  padding: 0.35rem 0.55rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 760;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.ranking-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: ranking;
}

.ranking-item {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-height: 3.35rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid transparent;
  border-radius: 0.8rem;
  counter-increment: ranking;
}

.ranking-item::before {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 850;
  content: counter(ranking, decimal-leading-zero);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.55rem;
}

.ranking-item:first-child {
  border-color: rgba(219, 49, 73, 0.34);
}

.ranking-item:first-child::before {
  color: #ffffff;
  background: var(--primary);
}

.ranking-name {
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-score {
  color: var(--primary);
  font-size: 0.87rem;
  font-weight: 800;
}

.ranking-empty {
  padding: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.quiz-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.quiz-alias,
.answered-counter {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.progress-track {
  height: 0.42rem;
  margin-bottom: 1.1rem;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.14);
  border-radius: 999px;
}

.progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: inherit;
  transition: width 260ms ease;
}

.question-panel {
  max-width: 900px;
  min-height: 33rem;
  margin-inline: auto;
}

.question-title {
  max-width: 30ch;
  margin-bottom: 2rem;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  line-height: 1.14;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.answer-button {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
  min-height: 4.25rem;
  padding: 0.8rem 1rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background: rgba(7, 7, 7, 0.68);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.answer-button:hover:not(:disabled) {
  background: rgba(46, 16, 21, 0.72);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.answer-button:disabled {
  cursor: default;
}

.answer-letter {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.55rem;
}

.answer-button.is-correct {
  background: rgba(52, 211, 153, 0.09);
  border-color: rgba(52, 211, 153, 0.62);
}

.answer-button.is-correct .answer-letter {
  color: #03261b;
  background: var(--success);
}

.answer-button.is-incorrect {
  background: rgba(251, 113, 133, 0.08);
  border-color: rgba(251, 113, 133, 0.55);
}

.answer-button.is-incorrect .answer-letter {
  color: #31040d;
  background: var(--danger);
}

.question-footer {
  display: flex;
  min-height: 5.5rem;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
}

.answer-feedback {
  max-width: 54ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.answer-feedback.is-correct {
  color: var(--success);
}

.answer-feedback.is-incorrect {
  color: var(--danger);
}

.score-block {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-block: 2.2rem 1rem;
}

.score-value {
  font-size: clamp(4rem, 10vw, 7rem);
  font-weight: 900;
  line-height: 0.85;
  letter-spacing: -0.07em;
}

.score-value--low {
  color: var(--danger);
}

.score-value--medium {
  color: #ff9900;
}

.score-value--high {
  color: var(--success);
}

.score-unit {
  color: var(--text-muted);
  font-weight: 720;
}

.result-summary {
  margin-bottom: 2rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.project-portfolio {
  padding-block: clamp(4rem, 8vw, 7rem);
  border-top: 1px solid var(--border);
}

.project-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.project-heading h2 {
  margin-bottom: 0.8rem;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1;
}

.project-lead {
  max-width: 65ch;
  margin-bottom: 0;
  color: var(--text-muted);
  line-height: 1.65;
}

.project-status {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  color: #c7c7cb;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.project-status > span {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(219, 49, 73, 0.12);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.project-card {
  min-height: 14rem;
  padding: clamp(1.3rem, 3vw, 2rem);
  background: linear-gradient(145deg, rgba(23, 23, 23, 0.94), rgba(12, 12, 12, 0.94));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.project-card--wide {
  grid-column: 1 / -1;
  min-height: 11rem;
}

.project-number {
  display: block;
  margin-bottom: 2.2rem;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.project-card h3 {
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
  letter-spacing: -0.025em;
}

.project-card p {
  max-width: 62ch;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.content-placeholder {
  display: grid;
  grid-template-columns: 1fr 1.45fr 0.75fr;
  gap: 0.45rem;
  height: 3.2rem;
  margin-top: 1.4rem;
}

.content-placeholder span {
  display: block;
  background: rgba(219, 49, 73, 0.07);
  border: 1px solid rgba(219, 49, 73, 0.22);
  border-radius: 0.55rem;
}

.phase-placeholder {
  display: flex;
  align-items: center;
  margin-top: 1.55rem;
}

.phase-placeholder span {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
}

.phase-placeholder i {
  width: 100%;
  height: 1px;
  background: var(--border);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 780px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 1.1rem;
  }

  .site-nav {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav__link {
    padding-block: 1.1rem 1.35rem;
  }

  .site-nav__link--active::after {
    bottom: 0.75rem;
  }

  .start-layout,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .ranking-panel {
    order: 2;
  }

  .answers {
    grid-template-columns: 1fr;
  }

  .question-panel {
    min-height: auto;
  }

  .project-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .site-header,
  .app,
  .project-portfolio {
    width: min(calc(100% - 1.2rem), var(--content-width));
  }

  .header-note {
    display: none;
  }

  .app {
    padding-block: 1.4rem 2.5rem;
  }

  .panel {
    padding: 1.2rem;
    border-radius: 1.15rem;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .facts {
    grid-template-columns: 1fr;
  }

  .fact {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: 0.6rem;
    align-items: baseline;
  }

  .quiz-topbar {
    align-items: flex-start;
  }

  .question-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .question-footer .button,
  .result-panel .button {
    width: 100%;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-card--wide {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
