:root {
  --navy: #07152d;
  --navy-2: #0c2347;
  --blue: #1689ff;
  --cyan: #4dd9ff;
  --lime: #b9ff38;
  --yellow: #ffd33d;
  --red: #ff5f67;
  --white: #f8fbff;
  --muted: #9eb2cf;
  --panel: rgba(12, 35, 71, 0.84);
  --line: rgba(255, 255, 255, 0.11);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--navy);
  scroll-behavior: smooth;
}

body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 10%, rgba(22, 137, 255, 0.22), transparent 26rem),
    radial-gradient(circle at 90% 30%, rgba(185, 255, 56, 0.09), transparent 22rem),
    linear-gradient(145deg, #061226, #091b38 62%, #07152d);
  color: var(--white);
  font-family: Inter, ui-rounded, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app,
.app-shell,
.screen,
.topbar {
  max-width: 100%;
}

.app-shell > *,
.screen > * {
  min-width: 0;
  max-width: 100%;
}

.protected-photo {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

.road-lines {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.road-lines::before,
.road-lines::after {
  position: absolute;
  width: 55vw;
  height: 140vh;
  border: 1px solid rgba(255, 255, 255, 0.035);
  border-radius: 50%;
  content: "";
  transform: rotate(24deg);
}

.road-lines::before {
  top: -50vh;
  right: -33vw;
  box-shadow:
    0 0 0 90px rgba(255, 255, 255, 0.012),
    0 0 0 180px rgba(255, 255, 255, 0.009);
}

.road-lines::after {
  bottom: -90vh;
  left: -38vw;
  border-color: rgba(185, 255, 56, 0.06);
  box-shadow: 0 0 0 110px rgba(185, 255, 56, 0.012);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 30px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 12px 14px 12px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(5, 18, 39, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--lime);
  border-radius: 14px;
  background: rgba(185, 255, 56, 0.08);
  box-shadow: 0 0 28px rgba(185, 255, 56, 0.12);
  font-size: 22px;
}

.brand-photo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 2px solid var(--lime);
  border-radius: 50%;
  object-fit: cover;
  object-position: 20% 28%;
  box-shadow: 0 0 28px rgba(185, 255, 56, 0.15);
}

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

.brand-text strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand-text span {
  color: var(--lime);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-text small {
  margin-top: 2px;
  color: #c8d6e9;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

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

.icon-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.icon-button:hover,
.ghost-button:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.screen {
  padding: 44px 0;
  animation: enter 360ms ease both;
}

.welcome-grid {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 44px;
  align-items: center;
  min-height: calc(100vh - 170px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before {
  display: block;
  width: 24px;
  height: 2px;
  border-radius: 99px;
  background: var(--lime);
  content: "";
}

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

.welcome-copy h1,
.screen-title h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-size: clamp(48px, 7vw, 84px);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.welcome-copy h1 span,
.accent {
  color: var(--lime);
}

.lead {
  max-width: 650px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button,
.answer-button {
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.primary-button {
  background: var(--lime);
  box-shadow: 0 18px 45px rgba(185, 255, 56, 0.13);
  color: #13220a;
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.primary-button:hover,
.secondary-button:hover,
.answer-button:hover {
  transform: translateY(-2px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.welcome-visual {
  position: relative;
  min-height: 500px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 35%, rgba(22, 137, 255, 0.24), transparent 40%),
    rgba(7, 21, 45, 0.8);
  box-shadow: var(--shadow);
}

.inspector-showcase {
  isolation: isolate;
  min-height: 500px;
  padding: 0;
  background: #07152d;
}

.inspector-showcase::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(3, 12, 27, 0.92) 100%);
  content: "";
}

.inspector-hero-photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 37%;
}

.inspector-overlay {
  position: absolute;
  z-index: 2;
  right: 28px;
  bottom: 26px;
  left: 28px;
}

.inspector-overlay small {
  display: block;
  margin-bottom: 6px;
  color: var(--lime);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.inspector-overlay strong {
  display: block;
  margin-bottom: 5px;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: -0.04em;
}

.inspector-overlay p {
  margin: 0;
  color: #d7e3f4;
}

.road-scene {
  position: absolute;
  inset: 0;
}

.road {
  position: absolute;
  right: -15%;
  bottom: -35%;
  width: 130%;
  height: 80%;
  border-radius: 50% 50% 0 0;
  background: #1a2c46;
  transform: rotate(-12deg);
}

.road::before {
  position: absolute;
  top: 47%;
  left: 7%;
  width: 86%;
  height: 7px;
  background: repeating-linear-gradient(90deg, var(--yellow) 0 52px, transparent 52px 98px);
  content: "";
}

.traffic-light {
  position: absolute;
  z-index: 2;
  top: 58px;
  right: 62px;
  display: grid;
  gap: 8px;
  width: 72px;
  padding: 14px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  background: #061126;
  box-shadow: var(--shadow);
}

.traffic-light i {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  opacity: 0.38;
}

.traffic-light i:nth-child(1) {
  background: var(--red);
}

.traffic-light i:nth-child(2) {
  background: var(--yellow);
}

.traffic-light i:nth-child(3) {
  opacity: 1;
  background: #48e67b;
  box-shadow: 0 0 30px rgba(72, 230, 123, 0.72);
}

.vialito {
  position: relative;
  width: min(245px, 58vw);
  animation: mascot-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 22px 24px rgba(0, 0, 0, 0.35));
}

.welcome-visual .vialito {
  position: absolute;
  z-index: 2;
  right: 105px;
  bottom: 34px;
  width: 215px;
}

.vialito svg {
  display: block;
  width: 100%;
}

.vialito-bubble {
  position: absolute;
  top: 8px;
  left: 76%;
  min-width: 128px;
  padding: 9px 12px;
  border: 2px solid var(--cyan);
  border-radius: 16px 16px 16px 4px;
  background: #fff;
  color: #07152d;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  animation: bubble-pop 0.55s ease both;
}

.vialito-small {
  flex: 0 0 105px;
  width: 105px;
}

.vialito-small .vialito-bubble {
  display: none;
}

.vialito-correct {
  animation: mascot-celebrate 0.7s ease both;
}

.vialito-moto {
  width: min(280px, 78vw);
}

.semaforito {
  position: absolute;
  z-index: 2;
  top: 48px;
  left: 42px;
  width: 86px;
  animation: mascot-float 2.8s ease-in-out infinite reverse;
}

.semaforito-face {
  position: relative;
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 12px 14px 18px;
  border: 4px solid #4dd9ff;
  border-radius: 23px;
  background: #061126;
  box-shadow: var(--shadow);
}

.semaforito .light {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  opacity: 0.45;
}

.semaforito .red { background: #ff5f67; }
.semaforito .amber { background: #ffd43b; }
.semaforito .green {
  background: #48e67b;
  animation: green-blink 2.4s ease-in-out infinite;
}

.semaforito-eyes {
  position: absolute;
  top: 47px;
  color: #07152d;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 7px;
}

.semaforito-smile {
  position: absolute;
  top: 66px;
  color: #07152d;
  font-size: 20px;
  font-weight: 900;
}

.semaforito-arm {
  position: absolute;
  top: 74px;
  color: #dbe5f3;
  font-size: 35px;
}

.semaforito-arm.left { left: -22px; transform: rotate(25deg); }
.semaforito-arm.right { right: -22px; transform: scaleX(-1) rotate(25deg); }

.scene-card {
  position: absolute;
  z-index: 3;
  bottom: 34px;
  left: 34px;
  max-width: 330px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(6, 17, 38, 0.86);
  backdrop-filter: blur(16px);
}

.scene-card strong {
  display: block;
  margin-bottom: 7px;
  color: var(--lime);
  font-size: 22px;
}

.scene-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.form-panel,
.content-panel,
.result-panel {
  width: min(720px, 100%);
  margin: 44px auto 0;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.form-panel h2,
.content-panel h2,
.result-panel h2 {
  margin-bottom: 10px;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.subtle {
  color: var(--muted);
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.field label {
  color: #c6d4e8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.field input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.055);
  color: var(--white);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(22, 137, 255, 0.12);
}

.age-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.age-card {
  position: relative;
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.age-card:hover,
.age-card.selected {
  border-color: rgba(185, 255, 56, 0.62);
  background: rgba(185, 255, 56, 0.07);
  transform: translateY(-2px);
}

.age-card .emoji {
  display: block;
  margin-bottom: 18px;
  font-size: 34px;
}

.age-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 18px;
}

.age-card span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.full-width {
  width: 100%;
  margin-top: 22px;
}

.dashboard-head,
.lesson-head {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-end;
}

.dashboard-head h1,
.lesson-head h1 {
  margin-bottom: 10px;
  font-size: clamp(38px, 6vw, 66px);
  letter-spacing: -0.05em;
}

.stat-row {
  display: flex;
  gap: 10px;
}

.stat {
  min-width: 112px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.stat strong {
  display: block;
  margin-bottom: 2px;
  font-size: 22px;
}

.stat span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-wrap {
  margin: 30px 0 34px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--lime));
  box-shadow: 0 0 20px rgba(185, 255, 56, 0.18);
  transition: width 450ms ease;
}

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

.module-card {
  position: relative;
  display: flex;
  min-height: 0;
  aspect-ratio: 1.2 / 1;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
  border: 2px solid hsl(var(--module-hue) 90% 70% / 0.42);
  border-radius: 26px;
  background:
    radial-gradient(circle at 88% 8%, hsl(var(--module-hue) 96% 68% / 0.5), transparent 34%),
    linear-gradient(145deg, hsl(var(--module-hue) 90% 47% / 0.82), #081b3a 72%);
  box-shadow: 0 20px 42px hsl(var(--module-hue) 95% 35% / 0.18);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.module-card:hover {
  border-color: hsl(var(--module-hue) 98% 78% / 0.85);
  transform: translateY(-5px);
}

.module-card.complete {
  border-color: rgba(185, 255, 56, 0.28);
}

.module-number {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.82);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.module-icon {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  font-size: 48px;
  z-index: 2;
}

.module-illustration {
  position: relative;
  display: grid;
  flex: 1;
  place-items: center;
  min-height: 120px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04)),
    hsl(var(--module-hue) 85% 54% / 0.16);
}

.module-illustration i {
  position: absolute;
  bottom: 18%;
  width: 42%;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(-13deg);
}

.module-illustration i:nth-of-type(2) {
  bottom: 31%;
  left: -4%;
}

.module-illustration i:nth-of-type(3) {
  right: -7%;
  bottom: 7%;
}

.module-card h3 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.module-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  line-height: 1.55;
}

.complete-badge {
  color: var(--lime);
}

.lesson-layout {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 22px;
  align-items: stretch;
  margin-top: 28px;
}

.lesson-visual,
.lesson-content {
  min-height: 430px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
}

.lesson-visual {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, rgba(22, 137, 255, 0.18), transparent 42%),
    var(--panel);
}

.big-icon {
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  border: 2px solid rgba(77, 217, 255, 0.28);
  border-radius: 50%;
  background: rgba(77, 217, 255, 0.05);
  box-shadow:
    0 0 0 28px rgba(77, 217, 255, 0.025),
    0 0 80px rgba(22, 137, 255, 0.14);
  font-size: 82px;
}

.lesson-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lesson-content h2 {
  font-size: 38px;
}

.lesson-content p {
  color: #b0c0d7;
  font-size: 16px;
  line-height: 1.75;
}

.tip {
  margin: 18px 0 24px;
  padding: 17px 18px;
  border-left: 3px solid var(--lime);
  border-radius: 0 14px 14px 0;
  background: rgba(185, 255, 56, 0.055);
  color: #dbe9c7;
  line-height: 1.55;
}

.quiz-shell {
  width: min(840px, 100%);
  margin: 42px auto 0;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.question-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.question-card h2 {
  margin-bottom: 28px;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.traffic-sign-visual {
  display: grid;
  place-items: center;
  width: min(300px, 100%);
  margin: 0 auto 22px;
  padding: 12px;
  border: 1px solid rgba(77, 217, 255, 0.2);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 35%, rgba(77, 217, 255, 0.12), transparent 55%),
    rgba(255, 255, 255, 0.035);
  color: #dbe5f3;
}

.traffic-sign-visual svg {
  width: 100%;
  max-height: 230px;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.28));
}

.traffic-sign-visual.official-sign {
  padding: 16px;
  background: #fff;
}

.traffic-sign-visual.official-sign img {
  display: block;
  width: min(260px, 100%);
  height: auto;
  object-fit: contain;
}

.traffic-light-game {
  width: min(620px, 100%);
  margin: 0 auto 24px;
  overflow: hidden;
  border: 1px solid rgba(77, 217, 255, 0.3);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.traffic-light-game svg {
  display: block;
  width: 100%;
  height: auto;
}

.traffic-light-game .game-car {
  transform-box: fill-box;
  transform-origin: center;
}

.traffic-light-game.game-go .game-car {
  animation: traffic-car-go 2.4s ease-in-out infinite;
}

.traffic-light-game.game-slow .game-car {
  animation: traffic-car-slow 1.7s ease-in-out infinite;
}

.traffic-light-game.game-stop .game-car {
  animation: traffic-car-idle 1.2s ease-in-out infinite;
}

@keyframes traffic-car-go {
  0% { transform: translateX(-38px); }
  45% { transform: translateX(55px); }
  100% { transform: translateX(210px); }
}

@keyframes traffic-car-slow {
  0%, 100% { transform: translateX(-10px); }
  55% { transform: translateX(38px); }
}

@keyframes traffic-car-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.answers {
  display: grid;
  gap: 12px;
}

.answer-button {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
}

.answer-button:hover {
  border-color: rgba(77, 217, 255, 0.4);
  background: rgba(77, 217, 255, 0.07);
}

.answer-letter {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.075);
  color: var(--cyan);
  font-size: 12px;
}

.feedback {
  margin-top: 18px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: #dbe5f3;
  line-height: 1.55;
}

.feedback-with-mascot {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
}

.feedback-with-mascot .feedback {
  flex: 1;
  margin-top: 0;
}

@keyframes mascot-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes mascot-celebrate {
  0% { transform: scale(0.88) rotate(-5deg); }
  55% { transform: scale(1.08) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes bubble-pop {
  from { opacity: 0; transform: scale(0.75) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes green-blink {
  0%, 100% { opacity: 0.5; box-shadow: none; }
  50% { opacity: 1; box-shadow: 0 0 24px rgba(72, 230, 123, 0.85); }
}

.feedback.good {
  border-color: rgba(185, 255, 56, 0.28);
  background: rgba(185, 255, 56, 0.07);
}

.feedback.bad {
  border-color: rgba(255, 95, 103, 0.28);
  background: rgba(255, 95, 103, 0.06);
}

.answer-button.is-correct {
  border-color: rgba(185, 255, 56, 0.9);
  background: rgba(185, 255, 56, 0.16);
  box-shadow: 0 0 0 2px rgba(185, 255, 56, 0.08);
}

.answer-button.is-wrong {
  border-color: rgba(255, 95, 103, 0.85);
  background: rgba(255, 95, 103, 0.13);
}

.feedback-action-sheet {
  margin-top: 16px;
}

.result-panel {
  text-align: center;
}

.result-icon {
  display: grid;
  place-items: center;
  width: 126px;
  height: 126px;
  margin: 0 auto 22px;
  border: 2px solid rgba(185, 255, 56, 0.4);
  border-radius: 50%;
  background: rgba(185, 255, 56, 0.08);
  box-shadow: 0 0 60px rgba(185, 255, 56, 0.12);
  font-size: 54px;
}

.stars {
  margin: 15px 0 20px;
  color: var(--yellow);
  font-size: 34px;
  letter-spacing: 5px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0;
}

.admin-actions {
  margin-bottom: 18px;
}

.admin-stat {
  min-height: 130px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}

.admin-stat strong {
  display: block;
  margin-bottom: 8px;
  font-size: 34px;
}

.admin-stat span {
  color: var(--muted);
  font-size: 12px;
}

.table-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
}

.table-head,
.table-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 16px;
  padding: 17px 22px;
}

.table-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.table-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row span:nth-child(2),
.table-row span:nth-child(3) {
  color: #b7c5d9;
}

.empty-state {
  padding: 38px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: min(400px, calc(100% - 40px));
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #10274b;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (max-width: 900px) {
  .welcome-grid,
  .lesson-layout {
    grid-template-columns: 1fr;
  }

  .welcome-grid {
    padding-top: 28px;
  }

  .welcome-visual {
    min-height: 420px;
  }

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

  .dashboard-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 600px) {
  html,
  body,
  #app {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .app-shell,
  .app-shell * {
    min-width: 0;
  }

  .app-shell {
    width: calc(100vw - 16px);
    max-width: 100%;
    margin-inline: 8px;
    padding-top: 10px;
  }

  .topbar {
    width: 100%;
    gap: 8px;
    padding: 10px;
    min-height: 60px;
    border-radius: 16px;
  }

  .brand {
    max-width: calc(100% - 48px);
  }

  .brand-text {
    overflow: hidden;
  }

  .brand-text strong,
  .brand-text small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-badge {
    width: 38px;
    height: 38px;
  }

  .brand-photo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .brand-text small {
    max-width: 165px;
    font-size: 8px;
  }

  .ghost-button .button-label {
    display: none;
  }

  .screen {
    width: 100%;
    padding: 30px 0;
  }

  img,
  svg,
  canvas,
  video,
  iframe {
    max-width: 100%;
  }

  .welcome-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-height: auto;
  }

  .welcome-copy h1,
  .screen-title h1 {
    font-size: clamp(38px, 13vw, 58px);
    overflow-wrap: anywhere;
  }

  .lead {
    font-size: 16px;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button {
    width: 100%;
  }

  .welcome-visual {
    width: 100%;
    max-width: 100%;
    min-height: 370px;
    border-radius: 24px;
  }

  .inspector-hero-photo {
    object-position: 46% 30%;
  }

  .inspector-overlay {
    right: 20px;
    bottom: 20px;
    left: 20px;
  }

  .traffic-light {
    top: 35px;
    right: 35px;
  }

  .welcome-visual .vialito {
    right: 18px;
    bottom: 64px;
    width: 155px;
  }

  .welcome-visual .vialito-bubble {
    top: -8px;
    left: 39%;
    min-width: 112px;
  }

  .semaforito {
    top: 28px;
    left: 28px;
    transform: scale(0.82);
    transform-origin: top left;
  }

  .feedback-with-mascot {
    align-items: flex-start;
  }

  .feedback-with-mascot .vialito-small {
    flex-basis: 74px;
    width: 74px;
  }

  .scene-card {
    right: 20px;
    bottom: 20px;
    left: 20px;
  }

  .form-panel,
  .content-panel,
  .result-panel,
  .question-card {
    width: 100%;
    max-width: 100%;
    padding: 24px 18px;
    border-radius: 21px;
  }

  .question-options,
  .feedback,
  .feedback-with-mascot,
  .module-card,
  .lesson-layout,
  .lesson-visual,
  .lesson-content,
  .table-card {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .answer-button,
  .primary-button,
  .secondary-button,
  .ghost-button {
    max-width: 100%;
    white-space: normal;
  }

  .age-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .module-card {
    aspect-ratio: 1 / 1;
    min-height: 0;
    padding: 11px;
    border-radius: 19px;
  }

  .module-number {
    font-size: 7px;
    letter-spacing: 0.06em;
  }

  .module-illustration {
    min-height: 0;
    margin: 8px 0;
    border-radius: 15px;
  }

  .module-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    font-size: 34px;
  }

  .module-card h3 {
    font-size: clamp(13px, 4vw, 17px);
    line-height: 1.08;
  }

  .module-card p {
    display: none;
  }

  .stat-row {
    width: 100%;
  }

  .stat {
    flex: 1;
    min-width: 0;
  }

  .lesson-visual,
  .lesson-content {
    min-height: 330px;
    padding: 24px;
  }

  .big-icon {
    width: 150px;
    height: 150px;
    font-size: 64px;
  }

  .table-head,
  .table-row {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  }

  .table-head span:nth-child(3),
  .table-row span:nth-child(3) {
    display: none;
  }

  body.student-entry-active,
  body.quiz-active {
    height: 100dvh;
    overflow: hidden;
  }

  .student-entry-screen {
    display: grid;
    height: calc(100dvh - 70px);
    padding: 8px 0;
    place-items: center;
    overflow: hidden;
  }

  .student-entry-screen .form-panel {
    max-height: calc(100dvh - 86px);
    margin: 0;
    padding: 18px;
    overflow: hidden;
  }

  .student-entry-screen .eyebrow {
    margin-bottom: 8px;
  }

  .student-entry-screen .form-panel h2 {
    margin: 0 0 5px;
    font-size: 27px;
  }

  .student-entry-screen .subtle {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.35;
  }

  .student-entry-screen .field {
    margin-bottom: 10px;
  }

  .student-entry-screen input {
    min-height: 46px;
  }

  .quiz-screen {
    height: calc(100dvh - 70px);
    padding: 7px 0;
    overflow: hidden;
  }

  .quiz-shell {
    display: flex;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    flex-direction: column;
  }

  .quiz-meta {
    margin-bottom: 5px;
    font-size: 9px;
  }

  .quiz-shell > .progress-bar {
    height: 6px;
  }

  .question-card {
    display: flex;
    min-height: 0;
    margin-top: 7px !important;
    padding: 9px 11px;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
  }

  .traffic-sign-visual {
    width: min(150px, 42vw);
    max-height: 150px;
    margin: 0 auto 6px;
    padding: 5px;
    border-radius: 13px;
  }

  .traffic-sign-visual.official-sign {
    padding: 6px;
  }

  .traffic-sign-visual.official-sign img,
  .traffic-sign-visual svg {
    width: auto;
    max-width: 100%;
    max-height: 136px;
  }

  .traffic-light-game {
    width: min(280px, 78vw);
    max-height: 145px;
    margin: 0 auto 6px;
  }

  .question-card h2 {
    margin: 0 0 7px;
    font-size: clamp(18px, 5.8vw, 25px);
    line-height: 1.08;
  }

  .answers {
    gap: 6px;
  }

  .answer-button {
    grid-template-columns: 29px 1fr;
    min-height: 45px;
    padding: 5px 9px;
    gap: 8px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.15;
  }

  .answer-letter {
    width: 27px;
    height: 27px;
    border-radius: 8px;
    font-size: 10px;
  }

  .feedback-action-sheet {
    position: fixed;
    z-index: 20;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    margin: 0;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    background: rgba(5, 18, 39, 0.97);
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(18px);
  }

  .feedback-action-sheet .feedback-with-mascot {
    margin: 0 0 8px;
  }

  .feedback-action-sheet .vialito-small {
    display: none;
  }

  .feedback-action-sheet .feedback {
    margin: 0;
    padding: 9px 11px;
    font-size: 12px;
    line-height: 1.28;
  }

  .feedback-action-sheet .feedback strong {
    display: block;
    margin-bottom: 2px;
  }

  .feedback-action-sheet .primary-button {
    min-height: 44px;
  }
}

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