:root {
  --ink: #12243d;
  --muted: #60708a;
  --line: #e2e9f3;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --brand: #1756a8;
  --brand-strong: #0c3b7c;
  --brand-soft: #e9f1fd;
  --accent: #ffcb2e;
  --accent-ink: #362800;
  --green: #128455;
  --green-soft: #e8f8f0;
  --red: #cc3838;
  --red-soft: #fdeeee;
  --orange: #9a5208;
  --orange-soft: #fff4e3;
  --radius-lg: 26px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 26px 70px -38px rgba(13, 43, 86, 0.45);
  --shadow-soft: 0 14px 36px -24px rgba(13, 43, 86, 0.35);
  --font: "Segoe UI", "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(23, 86, 168, 0.08), transparent 28rem),
    radial-gradient(circle at 95% 10%, rgba(255, 203, 46, 0.12), transparent 24rem),
    var(--bg);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(226, 233, 243, 0.8);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  box-shadow: 0 10px 22px -12px rgba(12, 59, 124, 0.9);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.site-nav a {
  padding: 9px 16px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.18s ease, background 0.18s ease;
}

.site-nav a:hover {
  color: var(--ink);
  background: var(--brand-soft);
}

.site-nav a.is-active {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.site-nav a.nav-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line);
  background: #fff;
}

.site-nav a.nav-profile:hover {
  border-color: #c7d8ee;
}

.nav-profile__avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.nav-profile__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.05;
  min-width: 0;
}

.nav-profile__text small {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-profile__text strong {
  max-width: 110px;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  margin: 0;
}

@media (max-width: 620px) {
  .site-nav a.nav-profile {
    padding: 5px;
  }

  .nav-profile__text {
    display: none;
  }
}

main {
  padding-bottom: 64px;
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 26px;
  padding: 58px;
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 203, 46, 0.2), transparent 21rem),
    linear-gradient(135deg, #091c36 0%, #0d3163 52%, #15519b 100%);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -130px;
  z-index: -1;
  width: 380px;
  height: 380px;
  border: 56px solid rgba(255, 255, 255, 0.045);
  border-radius: 50%;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.55fr);
  align-items: center;
  gap: 40px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: currentColor;
}

.page-head .eyebrow {
  color: var(--brand);
}

.hero .eyebrow {
  color: var(--accent);
}

.hero h1 {
  max-width: 700px;
  margin: 0;
  font-size: clamp(2.2rem, 4.4vw, 3.65rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.hero p {
  max-width: 620px;
  margin: 20px 0 0;
  color: #c9d8ec;
  font-size: 1.06rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-stat {
  min-width: 118px;
  padding: 13px 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
}

.hero-stat strong {
  display: block;
  color: #fff;
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.hero-stat span {
  color: #a9bed8;
  font-size: 0.8rem;
  font-weight: 600;
}

.hero-visual {
  position: relative;
  justify-self: center;
  width: 230px;
  height: 260px;
}

.traffic-sign {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: 0 24px 45px -20px rgba(0, 0, 0, 0.55);
}

.sign-speed {
  top: 6px;
  right: 14px;
  width: 168px;
  height: 168px;
  border: 13px solid #f4f6f9;
  color: var(--ink);
  background: #fff;
  transform: rotate(5deg);
}

.sign-speed strong {
  font-size: 3.2rem;
  line-height: 1;
  letter-spacing: -0.07em;
}

.sign-speed small {
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sign-warning {
  bottom: 0;
  left: 0;
  width: 104px;
  height: 104px;
  border: 9px solid #f4f6f9;
  border-radius: 22px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 2.7rem;
  font-weight: 900;
  transform: rotate(-8deg);
}

.sign-stripe {
  position: absolute;
  right: 12px;
  bottom: 22px;
  width: 92px;
  height: 16px;
  border-radius: 9px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.85) 0 14px, transparent 14px 24px);
  transform: rotate(-14deg);
  opacity: 0.8;
}

.start-card {
  position: relative;
  z-index: 2;
  width: min(1000px, calc(100% - 64px));
  margin: -34px auto 0;
  padding: 30px 32px 28px;
  border: 1px solid rgba(226, 233, 243, 0.9);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.start-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.icon-badge {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.icon-badge svg {
  width: 24px;
  height: 24px;
}

.start-heading h2 {
  margin: 0;
  font-size: 1.22rem;
  letter-spacing: -0.02em;
}

.start-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 14px;
}

.filters .field--full {
  grid-column: 1 / -1;
}

.preset-picker__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 14px;
}

.preset-picker__footer small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.preset-link {
  color: var(--brand-strong);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.preset-link:hover {
  color: var(--brand);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field select,
.field input {
  width: 100%;
  height: 48px;
  padding: 0 42px 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background-color: #fbfcfe;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input {
  padding-right: 14px;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2360708a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.field select:focus,
.field input:focus {
  outline: none;
  border-color: var(--brand);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(23, 86, 168, 0.12);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.check-field input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}

.filters .form-check {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 22px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 3px solid rgba(255, 203, 46, 0.7);
  outline-offset: 2px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--brand-strong));
  box-shadow: 0 13px 26px -16px rgba(12, 59, 124, 0.9);
}

.btn-primary:hover {
  box-shadow: 0 17px 30px -14px rgba(12, 59, 124, 0.85);
}

.btn-accent {
  color: var(--accent-ink);
  background: var(--accent);
}

.btn-ghost {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.btn-ghost:hover {
  border-color: #c7d4e6;
  background: #f9fbfe;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.form-error,
.inline-error {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid #f3c6c6;
  border-radius: 10px;
  color: #8e2020;
  background: var(--red-soft);
  font-size: 0.9rem;
}

.section {
  margin-top: 52px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.section-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.section-head a {
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 700;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.subject-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  min-height: 166px;
  padding: 22px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.subject-card:hover {
  transform: translateY(-3px);
  border-color: #c7d8ee;
  box-shadow: var(--shadow-soft);
}

.subject-card__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.subject-card:nth-child(2) .subject-card__icon {
  color: #795600;
  background: #fff4d6;
}

.subject-card:nth-child(3) .subject-card__icon {
  color: var(--green);
  background: var(--green-soft);
}

.subject-card:nth-child(4) .subject-card__icon {
  color: var(--orange);
  background: var(--orange-soft);
}

.subject-card__icon svg {
  width: 23px;
  height: 23px;
}

.subject-card strong {
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.subject-card small {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.subject-card__arrow {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 18px;
  height: 18px;
  color: #93a5bd;
  transition: transform 0.18s ease, color 0.18s ease;
}

.subject-card:hover .subject-card__arrow {
  color: var(--brand);
  transform: translate(2px, -2px);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.step {
  display: flex;
  gap: 15px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
}

.step__number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-size: 0.9rem;
  font-weight: 800;
}

.step h3 {
  margin: 1px 0 5px;
  font-size: 1rem;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.announcements-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.announcement-card {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(140deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.announcement-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.announcement-card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.announcement-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.announcement-card img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  margin-bottom: 12px;
  border-radius: 10px;
}

.announcement-card--link {
  text-decoration: none;
  color: inherit;
}

.announcement-card--link:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.announcement-card--link:hover h3 {
  color: var(--brand);
}

.announcement-card--google {
  display: grid;
  place-items: center;
  min-height: 120px;
  background: #fbfcfe;
}

.announcement-card--google ins {
  width: 100%;
}

/* Prova DETRAN */
.detran-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(230px, 0.55fr);
  align-items: center;
  gap: 24px;
  padding: 28px 30px;
  border: 1px solid #ecdba6;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 203, 46, 0.2), transparent 19rem),
    linear-gradient(135deg, #fffdf8, #fff7df);
  box-shadow: var(--shadow-soft);
}

.detran-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(145deg, #14243d, #0b1930);
  box-shadow: 0 18px 35px -20px rgba(10, 25, 48, 0.8);
}

.detran-mark strong {
  color: var(--accent);
  font-size: 0.86rem;
  letter-spacing: 0.1em;
}

.detran-mark span {
  margin-top: 2px;
  color: #b9c7da;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detran-content .eyebrow {
  margin-bottom: 6px;
  color: var(--orange);
}

.detran-content h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.035em;
}

.detran-content p {
  max-width: 580px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.detran-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.detran-chip {
  padding: 4px 10px;
  border: 1px solid #f0e1b5;
  border-radius: 999px;
  color: #745300;
  background: #fff8e6;
  font-size: 0.72rem;
  font-weight: 700;
}

.detran-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.detran-form .btn {
  width: 100%;
}

.detran-error,
.detran-details {
  grid-column: 1 / -1;
}

.detran-details {
  padding-top: 14px;
  border-top: 1px solid #f0e4c4;
}

.detran-details summary {
  color: #745300;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.detran-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.detran-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.detran-table th,
.detran-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1e7cf;
  text-align: left;
  white-space: nowrap;
}

.detran-table th {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detran-table th:last-child,
.detran-table td:last-child {
  text-align: right;
}

.detran-table tbody tr:last-child td {
  border-bottom: 1px solid #e9dab2;
}

.detran-table tfoot td {
  border-bottom: 0;
  color: var(--ink);
  font-weight: 800;
}

.detran-order-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

/* Histórico de provas */
.history-panel {
  margin-top: 30px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f9fc;
  text-align: left;
}

.history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-head .eyebrow {
  margin-bottom: 3px;
  color: var(--brand);
}

.history-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.025em;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 16px 0;
}

.history-stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.history-stat strong {
  display: block;
  font-size: 1.3rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.history-stat span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.history-list {
  display: grid;
  gap: 7px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.history-row.is-current {
  border-color: #b8d0ef;
  background: #f5f9ff;
}

.history-row__date {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.history-current {
  display: inline-block;
  margin-top: 2px;
  color: var(--brand);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.history-row__score {
  font-size: 1rem;
  font-weight: 800;
}

.history-score--good {
  color: var(--green);
}

.history-score--warn {
  color: var(--orange);
}

.history-score--bad {
  color: var(--red);
}

.history-row__detail {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.performance-panel {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f9fc;
  text-align: left;
}

.performance-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.performance-head .eyebrow {
  margin-bottom: 3px;
  color: var(--brand);
}

.performance-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.025em;
}

.performance-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.performance-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.performance-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.performance-item__head strong {
  font-weight: 700;
}

.performance-percentage {
  font-weight: 800;
  white-space: nowrap;
}

.performance-percentage.is-good {
  color: var(--green);
}

.performance-percentage.is-warn {
  color: var(--orange);
}

.performance-percentage.is-bad {
  color: var(--red);
}

.performance-bar {
  height: 7px;
  margin: 8px 0 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef6;
}

.performance-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.performance-bar span.is-warn {
  background: var(--orange);
}

.performance-bar span.is-bad {
  background: var(--red);
}

.performance-item small {
  color: var(--muted);
  font-size: 0.72rem;
}

.performance-panel:not([hidden]) + .result-actions {
  margin-top: 18px;
}

/* Quiz */
.quiz-shell {
  width: min(860px, 100%);
  margin: 30px auto 0;
}

.quiz-topbar {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.btn-quit {
  min-height: 38px;
  padding: 0 14px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
}

.btn-quit:hover {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ecf5;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #3f8bea);
  transition: width 0.35s ease;
}

.quiz-status {
  display: flex;
  align-items: center;
  gap: 14px;
}

.quiz-counter {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.quiz-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-strong);
  background: #fff;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.quiz-timer svg {
  width: 15px;
  height: 15px;
}

.quiz-timer__label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quiz-timer strong {
  font-size: 0.88rem;
  font-weight: 800;
}

.question-card {
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: riseIn 0.3s ease both;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #4c5c73;
  background: #eef2f8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge--easy {
  color: #0b6b42;
  background: var(--green-soft);
}

.badge--medium {
  color: #8b5a05;
  background: var(--orange-soft);
}

.badge--hard {
  color: #9a2626;
  background: var(--red-soft);
}

.badge--brand {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.question-statement {
  margin: 0 0 22px;
  font-size: clamp(1.25rem, 2.3vw, 1.58rem);
  line-height: 1.42;
  letter-spacing: -0.025em;
}

.plates {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 22px;
}

.plates:empty {
  display: none;
}

.plate {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafd;
}

.plate img {
  max-height: 142px;
  min-height: 76px;
  margin-inline: auto;
  object-fit: contain;
}

.plate figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.plate figcaption span {
  display: block;
  color: #8797ad;
  font-weight: 500;
}

.plate-fallback {
  display: grid;
  place-items: center;
  min-width: 110px;
  min-height: 86px;
  padding: 14px;
  border-radius: 8px;
  color: var(--brand-strong);
  background: #eaf1fa;
  font-weight: 800;
}

.options {
  display: grid;
  gap: 11px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 15px 17px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  font-size: 0.97rem;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.option:hover:not(:disabled) {
  border-color: #a9c4e8;
  background: #f9fbff;
  transform: translateX(2px);
}

.option:focus-visible {
  outline: 3px solid rgba(23, 86, 168, 0.22);
  outline-offset: 2px;
}

.option:disabled {
  cursor: default;
}

.option.is-selected {
  border-color: #8db5e8;
  background: var(--brand-soft);
}

.option.is-selected .option__letter {
  color: #fff;
  background: var(--brand);
}

.option__letter {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--muted);
  background: #eef2f8;
  font-size: 0.78rem;
  font-weight: 800;
}

.option__text {
  padding-top: 3px;
}

.option.is-correct {
  border-color: #5abf8f;
  background: var(--green-soft);
}

.option.is-correct .option__letter {
  color: #fff;
  background: var(--green);
}

.option.is-wrong {
  border-color: #eb9b9b;
  background: var(--red-soft);
}

.option.is-wrong .option__letter {
  color: #fff;
  background: var(--red);
}

.feedback {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: 12px;
  background: var(--green-soft);
  animation: riseIn 0.25s ease both;
}

.feedback.is-error {
  background: var(--red-soft);
}

.feedback.is-success {
  border-color: #bfe9d5;
  border-left-color: var(--green);
}

.feedback.is-error {
  border-color: #f2caca;
  border-left-color: var(--red);
}

.feedback h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.feedback p {
  margin: 0;
  color: #42536a;
  font-size: 0.92rem;
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

/* Result */
.result-view {
  width: min(820px, 100%);
  margin: 34px auto 0;
}

.result-card {
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  animation: riseIn 0.35s ease both;
}

.result-kicker {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.score-ring {
  --score: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 174px;
  aspect-ratio: 1;
  margin: 24px auto;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--score) * 1%), #e9eef6 0);
}

.score-ring.is-low {
  background: conic-gradient(var(--orange) calc(var(--score) * 1%), #e9eef6 0);
}

.score-ring.is-bad {
  background: conic-gradient(var(--red) calc(var(--score) * 1%), #e9eef6 0);
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: #fff;
}

.score-ring > div {
  position: relative;
  text-align: center;
}

.score-ring strong {
  display: block;
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: -0.06em;
}

.score-ring span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-card h2 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.035em;
}

.result-subtitle {
  max-width: 520px;
  margin: 8px auto 0;
  color: var(--muted);
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 30px 0;
}

.result-meta div {
  padding: 16px;
  border-radius: 14px;
  background: #f7f9fc;
}

.result-meta strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.2;
}

.result-meta span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.review {
  margin-top: 32px;
  text-align: left;
}

.review > summary {
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfd;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.review > summary::-webkit-details-marker {
  display: none;
}

.review > summary::after {
  content: "+";
  float: right;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.review[open] > summary::after {
  content: "\2212";
}

.review-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.review-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  background: #fff;
}

.review-item.is-wrong {
  border-left-color: var(--red);
}

.review-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.review-item p {
  margin: 4px 0;
  font-size: 0.9rem;
}

.review-item p strong {
  font-weight: 700;
}

.review-item .muted {
  color: var(--muted);
}

/* Loading */
.loading-panel {
  display: grid;
  place-items: center;
  min-height: 280px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--muted);
  box-shadow: var(--shadow-soft);
}

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid #dfe8f3;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Bank of questions */
.page-head {
  padding: 48px 0 26px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  letter-spacing: -0.045em;
}

.page-head p {
  max-width: 650px;
  margin: 10px 0 0;
  color: var(--muted);
}

.bank-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(140px, 1fr));
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.bank-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 2px 14px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.bank-list {
  display: grid;
  gap: 13px;
}

.bank-item {
  display: grid;
  gap: 12px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  animation: riseIn 0.25s ease both;
}

.bank-item:hover {
  border-color: #c8d8ec;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.bank-item__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bank-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.bank-item h2 {
  margin: 0;
  font-size: 1.03rem;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.bank-item__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bank-item__plates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.bank-item__plates img {
  max-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
  padding: 3px;
}

.btn-small {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 0.84rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}

.page-btn {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) {
  border-color: #b9cde7;
  background: #f7faff;
}

.page-btn.is-active {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--muted);
  font-weight: 700;
}

.empty-state {
  padding: 56px 24px;
  border: 1px dashed #c9d6e7;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

/* Dialog */
dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 35px 90px -20px rgba(0, 0, 0, 0.45);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(7, 20, 39, 0.58);
  backdrop-filter: blur(3px);
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.dialog-head h2 {
  margin: 0;
  font-size: 1rem;
}

.dialog-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
}

.dialog-close:hover {
  color: var(--ink);
  background: #f7f9fc;
}

.dialog-body {
  overflow-y: auto;
  max-height: calc(88vh - 78px);
  padding: 26px;
}

.detail-statement {
  margin: 14px 0 18px;
  font-size: 1.2rem;
  line-height: 1.48;
  letter-spacing: -0.02em;
}

.detail-options {
  display: grid;
  gap: 8px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.detail-option {
  display: flex;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 0.92rem;
}

.detail-option.is-correct {
  border-color: #a9ddc5;
  background: var(--green-soft);
}

.detail-option__letter {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--muted);
  background: #eef2f8;
  font-size: 0.72rem;
  font-weight: 800;
}

.detail-option.is-correct .detail-option__letter {
  color: #fff;
  background: var(--green);
}

.detail-explanation {
  padding: 16px 18px;
  border-left: 4px solid var(--brand);
  border-radius: 11px;
  background: var(--brand-soft);
}

.detail-explanation h3 {
  margin: 0 0 5px;
  font-size: 0.88rem;
}

.detail-explanation p {
  margin: 0;
  color: #3e536f;
  font-size: 0.9rem;
}

.correct-tag {
  margin-left: auto;
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.skeleton {
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef2f8 25%, #f7f9fc 37%, #eef2f8 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 0 30px;
  color: var(--muted);
  font-size: 0.82rem;
}

.footer-inner p {
  margin: 0;
}

.view {
  animation: fadeIn 0.25s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

@media (max-width: 960px) {
  .hero {
    padding: 42px;
  }

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

  .hero-visual {
    display: none;
  }

  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters .btn {
    grid-column: 1 / -1;
  }

  .bank-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .announcements-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .container {
    width: min(100% - 28px, 1120px);
  }

  .header-inner {
    min-height: 68px;
  }

  .brand-text small {
    display: none;
  }

  .site-nav a {
    padding: 8px 10px;
    font-size: 0.84rem;
  }

  .hero {
    margin-top: 16px;
    padding: 30px 24px 58px;
    border-radius: 22px;
  }

  .hero p {
    font-size: 0.97rem;
  }

  .hero-stat {
    min-width: 96px;
    padding: 10px 13px;
  }

  .start-card {
    width: calc(100% - 24px);
    margin-top: -32px;
    padding: 22px;
  }

  .filters,
  .bank-filters {
    grid-template-columns: 1fr;
  }

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

  .subject-card {
    min-height: 128px;
  }

  .question-card,
  .result-card {
    padding: 24px 20px;
    border-radius: 20px;
  }

  .quiz-shell,
  .result-view {
    margin-top: 18px;
  }

  .quiz-topbar {
    grid-template-columns: auto 1fr;
    gap: 10px;
  }

  .quiz-status {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
  }

  .progress-track {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .result-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-card h2 {
    font-size: 1.5rem;
  }

  .page-head {
    padding-top: 32px;
  }

  .bank-item {
    padding: 18px;
  }

  .dialog-body {
    padding: 20px;
  }
}

@media (max-width: 900px) {
  .detran-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .detran-form {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: end;
  }

  .detran-form .field {
    flex: 1;
  }

  .detran-form .btn {
    flex: 0 0 auto;
    width: auto;
  }
}

@media (max-width: 600px) {
  .detran-card {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 22px;
  }

  .detran-mark {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }

  .detran-form {
    flex-direction: column;
    align-items: stretch;
  }

  .detran-form .btn {
    width: 100%;
  }

  .history-panel {
    padding: 18px;
  }

  .performance-panel {
    padding: 18px;
  }

  .performance-head h2 {
    font-size: 1.1rem;
  }

  .history-stats {
    grid-template-columns: 1fr;
  }

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

  .history-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }

  .history-row__detail {
    grid-column: 1 / -1;
    white-space: normal;
  }
}

@media (max-width: 460px) {
  .brand-text {
    display: none;
  }

  .site-nav a {
    padding: 8px 8px;
    font-size: 0.8rem;
  }
}

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

.bank-filters__actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.page-btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.detail-page {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.subject-grid > form {
  display: flex;
  min-width: 0;
}

.subject-grid > form .subject-card {
  width: 100%;
}
.detran-hint {
  margin: 0;
  color: #745300;
  font-size: 0.86rem;
  line-height: 1.45;
}
.subject-card {
  text-decoration: none;
}

.auth-required-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f9fbfd;
}

.auth-required-card > div:nth-child(2) {
  flex: 1 1 240px;
  min-width: 0;
}

.auth-required-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.auth-required-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.auth-required-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}