:root {
  --background: #080d1a;
  --surface: #111827;
  --surface-light: #1f2937;
  --surface-border: rgba(255, 255, 255, 0.1);

  --text-primary: #ffffff;
  --text-secondary: #aeb8ca;
  --text-muted: #78859a;

  --brand-primary: #7c3aed;
  --brand-primary-light: #9f67ff;
  --brand-secondary: #16c7a2;

  --answer-red: #e73d4f;
  --answer-red-dark: #b91c35;

  --answer-blue: #287be0;
  --answer-blue-dark: #1d58aa;

  --answer-yellow: #f4b72b;
  --answer-yellow-dark: #c7840c;

  --answer-green: #24a860;
  --answer-green-dark: #14773f;

  --success: #20c879;
  --danger: #ff5d6c;
  --warning: #f4b72b;

  --radius-small: 12px;
  --radius-medium: 20px;
  --radius-large: 30px;

  --shadow-soft: 0 22px 70px rgba(0, 0, 0, 0.3);
  --shadow-button: 0 10px 0 rgba(0, 0, 0, 0.22);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--background);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text-primary);
  background:
    radial-gradient(
      circle at 10% 0%,
      rgba(124, 58, 237, 0.25),
      transparent 34%
    ),
    radial-gradient(
      circle at 90% 100%,
      rgba(22, 199, 162, 0.13),
      transparent 30%
    ),
    var(--background);
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(159, 103, 255, 0.75);
  outline-offset: 4px;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  padding:
    calc(12px + var(--safe-top))
    calc(18px + var(--safe-right))
    calc(12px + var(--safe-bottom))
    calc(18px + var(--safe-left));
}

/* =========================================================
   CABEÇALHO
   ========================================================= */

.topbar {
  z-index: 10;
  display: flex;
  width: min(100%, 1100px);
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 13px;
  font-size: 1.25rem;
  font-weight: 900;
  background:
    linear-gradient(
      145deg,
      var(--brand-primary-light),
      var(--brand-primary)
    );
  box-shadow:
    0 10px 30px rgba(124, 58, 237, 0.28);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-copy strong {
  font-size: 0.98rem;
  letter-spacing: 0.01em;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.connection-area {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  white-space: nowrap;
}

.connection-indicator {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 999px;
  background: var(--text-muted);
  box-shadow:
    0 0 0 4px rgba(120, 133, 154, 0.12);
}

.connection-indicator--online {
  background: var(--success);
  box-shadow:
    0 0 0 4px rgba(32, 200, 121, 0.13);
}

.connection-indicator--connecting {
  background: var(--warning);
  box-shadow:
    0 0 0 4px rgba(244, 183, 43, 0.13);
  animation: pulse 1s infinite;
}

.connection-indicator--offline {
  background: var(--text-muted);
  box-shadow:
    0 0 0 4px rgba(120, 133, 154, 0.12);
}

/* =========================================================
   CONTEÚDO E TELAS
   ========================================================= */

.main-content {
  display: flex;
  width: min(100%, 1100px);
  flex: 1;
  margin: 0 auto;
}

.view {
  display: none;
  width: 100%;
  animation: viewEnter 240ms ease-out;
}

.view--active {
  display: flex;
}

/* =========================================================
   LOBBY
   ========================================================= */

.lobby-view {
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  gap: clamp(30px, 7vw, 90px);
}

.hero {
  max-width: 540px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--brand-secondary);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.hero h1,
.waiting-card h1,
.feedback-card h1,
.leaderboard-header h1,
.end-card h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero p,
.waiting-card > p,
.feedback-card > p,
.leaderboard-header p,
.end-card > p {
  max-width: 550px;
  margin: 20px 0 0;
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.6;
}

.join-card,
.waiting-card,
.feedback-card,
.end-card {
  width: min(100%, 430px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-large);
  padding: clamp(24px, 5vw, 38px);
  background: rgba(17, 24, 39, 0.84);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.field-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  gap: 9px;
}

.field-group label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.linked-room-notice {
  display: flex;
  min-height: 64px;
  align-items: center;
  margin-bottom: 20px;
  border: 1px solid rgba(32, 200, 121, 0.3);
  border-radius: var(--radius-small);
  padding: 11px 14px;
  gap: 12px;
  background: rgba(32, 200, 121, 0.08);
}

.linked-room-notice > span {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 900;
  background: var(--success);
}

.linked-room-notice div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.linked-room-notice strong {
  font-size: 0.82rem;
}

.linked-room-notice small {
  color: var(--text-secondary);
}

.late-join-banner {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-small);
  border: 1px solid rgba(244, 183, 43, 0.35);
  background: rgba(244, 183, 43, 0.12);
  color: var(--text-primary);
  font-weight: 700;
}
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.linked-room-notice small span {
  color: var(--brand-secondary);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.text-input {
  width: 100%;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius-small);
  padding: 0 17px;
  color: var(--text-primary);
  caret-color: var(--brand-primary-light);
  background: rgba(255, 255, 255, 0.06);
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.text-input::placeholder {
  color: #667187;
}

.text-input:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.25);
}

.text-input:focus {
  border-color: var(--brand-primary-light);
  background: rgba(255, 255, 255, 0.09);
}

.text-input:disabled {
  opacity: 0.6;
}

.text-input--pin {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-align: center;
}

.field-help,
.local-mode-hint {
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.form-error {
  min-height: 20px;
  margin: -4px 0 12px;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
}

/* =========================================================
   BOTÕES
   ========================================================= */

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-small);
  padding: 14px 19px;
  gap: 12px;
  cursor: pointer;
  font-weight: 900;
  text-align: center;
  transition:
    transform 120ms ease,
    filter 120ms ease,
    opacity 120ms ease;
}

.primary-button {
  width: 100%;
  border: 0;
  color: #ffffff;
  background:
    linear-gradient(
      135deg,
      var(--brand-primary-light),
      var(--brand-primary)
    );
  box-shadow:
    0 9px 28px rgba(124, 58, 237, 0.28);
}

.primary-button--link {
  margin-top: 28px;
  text-decoration: none;
}

.secondary-button {
  width: 100%;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: scale(0.98);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button-arrow {
  font-size: 1.25rem;
}

.local-mode-hint {
  margin: 18px 0 0;
  text-align: center;
}

/* =========================================================
   SALA DE ESPERA
   ========================================================= */

.waiting-view,
.feedback-view,
.end-view {
  align-items: center;
  justify-content: center;
  padding: 38px 0;
  text-align: center;
}

.waiting-card,
.feedback-card,
.end-card {
  width: min(100%, 560px);
}

.waiting-animation {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
  gap: 9px;
}

.waiting-animation span {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--brand-primary-light);
  animation:
    waitingBounce 1.1s infinite ease-in-out;
}

.waiting-animation span:nth-child(2) {
  animation-delay: 120ms;
}

.waiting-animation span:nth-child(3) {
  animation-delay: 240ms;
}

.player-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 30px 0 14px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.035);
}

.player-summary div {
  min-width: 0;
  padding: 19px 10px;
}

.player-summary div + div {
  border-left: 1px solid var(--surface-border);
}

.player-summary dt {
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-summary dd {
  overflow: hidden;
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   PERGUNTA
   ========================================================= */

.game-view {
  min-height: 0;
  flex-direction: column;
  padding: 20px 0;
}

.game-header {
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 20px;
}

.game-header__content {
  min-width: 0;
}

.question-counter {
  color: var(--brand-secondary);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.game-header h1 {
  margin: 6px 0 0;
  font-size: clamp(1.45rem, 4vw, 2.45rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.question-text {
  margin: 8px 0 0;
  color: var(--text-secondary);
}

.timer {
  position: relative;
  display: grid;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  place-items: center;
}

.timer-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring__background,
.timer-ring__progress {
  fill: none;
  stroke-width: 5px;
}

.timer-ring__background {
  stroke: rgba(255, 255, 255, 0.1);
}

.timer-ring__progress {
  stroke: var(--brand-secondary);
  stroke-linecap: round;
  stroke-dasharray: 138.23;
  stroke-dashoffset: 0;
  transition:
    stroke-dashoffset 200ms linear,
    stroke 180ms ease;
}

.timer--danger .timer-ring__progress {
  stroke: var(--danger);
}

.timer-value {
  z-index: 1;
  font-size: 1.1rem;
  font-weight: 900;
}

.answer-grid {
  display: grid;
  flex: 1;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  grid-template-rows:
    repeat(2, minmax(140px, 1fr));
  gap: clamp(12px, 2vw, 20px);
}

.answer-button {
  position: relative;
  display: flex;
  min-height: 150px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 0;
  border-radius: clamp(18px, 3vw, 28px);
  cursor: pointer;
  box-shadow: var(--shadow-button);
  transition:
    transform 120ms ease,
    filter 120ms ease,
    opacity 160ms ease,
    box-shadow 120ms ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.answer-button::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.18),
      transparent 44%,
      rgba(0, 0, 0, 0.12)
    );
  pointer-events: none;
}

.answer-button:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-3px);
}

.answer-button:active:not(:disabled) {
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.22);
  transform:
    translateY(5px) scale(0.99);
}

.answer-button:disabled {
  cursor: default;
  opacity: 0.34;
  transform: none;
}

.answer-button--selected {
  opacity: 1 !important;
  box-shadow:
    0 0 0 5px #ffffff,
    0 12px 0 rgba(0, 0, 0, 0.22);
  transform: scale(0.975);
}

.answer-button--red {
  background:
    linear-gradient(
      145deg,
      var(--answer-red),
      var(--answer-red-dark)
    );
}

.answer-button--blue {
  background:
    linear-gradient(
      145deg,
      var(--answer-blue),
      var(--answer-blue-dark)
    );
}

.answer-button--yellow {
  background:
    linear-gradient(
      145deg,
      var(--answer-yellow),
      var(--answer-yellow-dark)
    );
}

.answer-button--green {
  background:
    linear-gradient(
      145deg,
      var(--answer-green),
      var(--answer-green-dark)
    );
}

.answer-shape {
  z-index: 1;
  width: clamp(48px, 8vw, 74px);
  height: clamp(48px, 8vw, 74px);
  background: rgba(255, 255, 255, 0.96);
  filter:
    drop-shadow(
      0 7px 10px rgba(0, 0, 0, 0.18)
    );
}

.answer-shape--triangle {
  width: 0;
  height: 0;
  border-right:
    clamp(28px, 4vw, 42px)
    solid transparent;
  border-bottom:
    clamp(50px, 7vw, 74px)
    solid rgba(255, 255, 255, 0.96);
  border-left:
    clamp(28px, 4vw, 42px)
    solid transparent;
  background: transparent;
}

.answer-shape--diamond {
  transform: rotate(45deg) scale(0.82);
}

.answer-shape--circle {
  border-radius: 50%;
}

.answer-shape--square {
  border-radius: 5px;
}

.answer-letter {
  position: absolute;
  right: 17px;
  bottom: 12px;
  z-index: 1;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  font-weight: 900;
}

.answer-message {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

/* =========================================================
   FEEDBACK DA RESPOSTA
   ========================================================= */

.feedback-card {
  transition:
    border-color 220ms ease,
    background-color 220ms ease;
}

.feedback-card--correct {
  border-color: rgba(32, 200, 121, 0.4);
  background:
    linear-gradient(
      180deg,
      rgba(32, 200, 121, 0.06),
      rgba(17, 24, 39, 0.84) 42%
    );
}

.feedback-card--incorrect {
  border-color: rgba(255, 93, 108, 0.4);
  background:
    linear-gradient(
      180deg,
      rgba(255, 93, 108, 0.06),
      rgba(17, 24, 39, 0.84) 42%
    );
}

.feedback-icon {
  display: grid;
  width: 92px;
  height: 92px;
  margin: 0 auto 26px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 2.8rem;
  font-weight: 900;
  background: var(--success);
  box-shadow:
    0 18px 50px rgba(32, 200, 121, 0.25);
  animation:
    feedbackIconEnter 400ms
    cubic-bezier(0.2, 0.8, 0.2, 1);
}

.feedback-card--incorrect .feedback-icon {
  background: var(--danger);
  box-shadow:
    0 18px 50px rgba(255, 93, 108, 0.22);
}

.score-earned,
.total-score {
  margin-top: 25px;
}

.score-earned {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-medium);
  padding: 18px 20px;
  gap: 20px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.score-earned strong {
  color: var(--brand-secondary);
  font-size: 1.6rem;
}

.feedback-card--incorrect .score-earned strong {
  color: var(--text-secondary);
}

.total-score {
  color: var(--text-secondary);
}

.total-score strong {
  color: var(--text-primary);
}

.next-question-message {
  color: var(--text-muted) !important;
  font-size: 0.82rem !important;
}

/* =========================================================
   RANKING
   ========================================================= */

.leaderboard-view {
  flex-direction: column;
  justify-content: center;
  padding: 38px 0;
}

.leaderboard-header {
  margin-bottom: 25px;
  text-align: center;
}

.leaderboard-header h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.leaderboard-header p {
  margin-right: auto;
  margin-left: auto;
}

.leaderboard-list {
  display: flex;
  width: min(100%, 700px);
  flex-direction: column;
  margin: 0 auto;
  padding: 0;
  gap: 11px;
  list-style: none;
  counter-reset: leaderboard;
}

.leaderboard-item {
  display: grid;
  grid-template-columns:
    48px minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 15px 18px;
  gap: 14px;
  background: rgba(17, 24, 39, 0.84);
  animation:
    leaderboardEnter 350ms both;
}

.leaderboard-item:first-child {
  border-color: rgba(244, 183, 43, 0.35);
  background:
    linear-gradient(
      90deg,
      rgba(244, 183, 43, 0.1),
      rgba(17, 24, 39, 0.84)
    );
}

.leaderboard-item--current {
  border-color: rgba(159, 103, 255, 0.7);
  background: rgba(124, 58, 237, 0.18);
  box-shadow:
    0 0 0 1px rgba(159, 103, 255, 0.15),
    0 15px 45px rgba(124, 58, 237, 0.12);
}

.leaderboard-position {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.08);
}

.leaderboard-name {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  color: var(--brand-secondary);
  font-weight: 900;
  white-space: nowrap;
}

.leaderboard-waiting {
  margin: 24px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

/* =========================================================
   RESULTADO FINAL
   ========================================================= */

.trophy {
  margin-bottom: 20px;
  font-size: 5rem;
  filter:
    drop-shadow(
      0 14px 30px rgba(244, 183, 43, 0.2)
    );
  animation:
    trophyEnter 650ms
    cubic-bezier(0.2, 0.9, 0.2, 1);
}

.final-result {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 30px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.025);
}

.final-result div {
  display: flex;
  flex-direction: column;
  padding: 22px 12px;
  gap: 8px;
}

.final-result div + div {
  border-left: 1px solid var(--surface-border);
}

.final-result span {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.final-result strong {
  font-size: 1.7rem;
}

/* =========================================================
   RODAPÉ
   ========================================================= */

.footer {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-align: center;
}

/* =========================================================
   TOAST
   ========================================================= */

.toast {
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--safe-bottom));
  z-index: 100;
  max-width: min(
    380px,
    calc(100vw - 40px)
  );
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 14px 17px;
  color: var(--text-primary);
  background: rgba(17, 24, 39, 0.96);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.noscript-message {
  padding: 20px;
  color: #ffffff;
  background: #b91c35;
  font-weight: 800;
  text-align: center;
}

/* =========================================================
   ANIMAÇÕES
   ========================================================= */

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes waitingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-10px);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

@keyframes leaderboardEnter {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes feedbackIconEnter {
  0% {
    opacity: 0;
    transform: scale(0.45) rotate(-16deg);
  }

  65% {
    transform: scale(1.12) rotate(4deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes trophyEnter {
  0% {
    opacity: 0;
    transform:
      translateY(-25px)
      scale(0.65)
      rotate(-10deg);
  }

  65% {
    transform:
      translateY(5px)
      scale(1.1)
      rotate(5deg);
  }

  100% {
    opacity: 1;
    transform:
      translateY(0)
      scale(1)
      rotate(0);
  }
}

/* =========================================================
   TABLETS
   ========================================================= */

@media (max-width: 780px) {
  .app-shell {
    padding-right:
      calc(12px + var(--safe-right));
    padding-left:
      calc(12px + var(--safe-left));
  }

  .brand-copy small {
    display: none;
  }

  .connection-area {
    font-size: 0.7rem;
  }

  .lobby-view {
    flex-direction: column;
    justify-content: center;
    padding: 30px 0;
  }

  .hero {
    text-align: center;
  }

  .hero h1 {
    font-size:
      clamp(2.6rem, 13vw, 4rem);
  }

  .hero p {
    margin-top: 14px;
  }

  .join-card {
    width: min(100%, 480px);
  }

  .game-header {
    min-height: 84px;
    margin-bottom: 12px;
  }

  .question-text {
    display: none;
  }

  .answer-grid {
    gap: 11px;
  }

  .answer-button {
    min-height: 130px;
    border-radius: 20px;
  }

  .footer {
    min-height: 28px;
  }
}

/* =========================================================
   CELULARES
   ========================================================= */

@media (max-width: 480px) {
  .topbar {
    min-height: 50px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 1.05rem;
  }

  .brand-copy strong {
    font-size: 0.86rem;
  }

  .connection-area span:last-child {
    display: none;
  }

  .join-card,
  .waiting-card,
  .feedback-card,
  .end-card {
    padding: 23px 18px;
    border-radius: 23px;
  }

  .text-input--pin {
    font-size: 1.35rem;
  }

  .player-summary {
    grid-template-columns: 1fr;
  }

  .player-summary div + div {
    border-top:
      1px solid var(--surface-border);
    border-left: 0;
  }

  .player-summary div {
    padding: 13px 10px;
  }

  .game-view {
    padding: 10px 0 8px;
  }

  .game-header {
    min-height: 74px;
  }

  .game-header h1 {
    font-size: 1.25rem;
  }

  .timer {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
  }

  .answer-grid {
    grid-template-rows:
      repeat(2, minmax(115px, 1fr));
  }

  .answer-button {
    min-height: 115px;
  }

  .answer-message {
    margin-top: 13px;
  }

  .score-earned {
    padding: 15px;
  }

  .score-earned strong {
    font-size: 1.35rem;
  }

  .leaderboard-item {
    grid-template-columns:
      42px minmax(0, 1fr) auto;
    padding: 12px;
    gap: 9px;
  }

  .leaderboard-position {
    width: 34px;
    height: 34px;
  }

  .leaderboard-name,
  .leaderboard-score {
    font-size: 0.8rem;
  }

  .final-result {
    grid-template-columns: 1fr;
  }

  .final-result div + div {
    border-top:
      1px solid var(--surface-border);
    border-left: 0;
  }

  .toast {
    right: 12px;
    bottom:
      calc(12px + var(--safe-bottom));
    max-width: calc(100vw - 24px);
  }
}

/* =========================================================
   CELULARES MUITO PEQUENOS
   ========================================================= */

@media (max-width: 360px) {
  .app-shell {
    padding-right:
      calc(9px + var(--safe-right));
    padding-left:
      calc(9px + var(--safe-left));
  }

  .answer-grid {
    gap: 8px;
  }

  .answer-button {
    min-height: 105px;
    border-radius: 16px;
  }

  .answer-shape {
    width: 42px;
    height: 42px;
  }

  .answer-shape--triangle {
    width: 0;
    height: 0;
    border-right-width: 24px;
    border-bottom-width: 43px;
    border-left-width: 24px;
  }

  .answer-letter {
    right: 11px;
    bottom: 9px;
  }
}

/* =========================================================
   MODO PAISAGEM EM TELAS BAIXAS
   ========================================================= */

@media (max-height: 700px) and (orientation: landscape) {
  .topbar,
  .footer {
    display: none;
  }

  .app-shell {
    padding-top:
      calc(8px + var(--safe-top));
    padding-bottom:
      calc(8px + var(--safe-bottom));
  }

  .game-view {
    padding: 0;
  }

  .game-header {
    min-height: 58px;
    margin-bottom: 8px;
  }

  .game-header h1 {
    font-size:
      clamp(1.1rem, 3vw, 1.7rem);
  }

  .question-text {
    display: none;
  }

  .timer {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .answer-grid {
    grid-template-rows:
      repeat(2, minmax(90px, 1fr));
  }

  .answer-button {
    min-height: 90px;
  }

  .answer-shape {
    width: 44px;
    height: 44px;
  }

  .answer-shape--triangle {
    width: 0;
    height: 0;
    border-right-width: 25px;
    border-bottom-width: 45px;
    border-left-width: 25px;
  }

  .answer-message {
    margin: 8px 0 0;
  }

  .waiting-view,
  .feedback-view,
  .end-view {
    padding: 8px 0;
  }

  .waiting-card,
  .feedback-card,
  .end-card {
    padding: 20px;
  }

  .feedback-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 15px;
    font-size: 2rem;
  }

  .trophy {
    margin-bottom: 8px;
    font-size: 3rem;
  }
}

/* =========================================================
   DISPOSITIVOS SEM HOVER
   ========================================================= */

@media (hover: none) {
  .answer-button:hover:not(:disabled) {
    filter: none;
    transform: none;
  }

  .primary-button:hover:not(:disabled),
  .secondary-button:hover:not(:disabled) {
    filter: none;
  }
}

/* =========================================================
   MOVIMENTO REDUZIDO
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* =========================================================
   ALTO CONTRASTE
   ========================================================= */

@media (prefers-contrast: more) {
  :root {
    --surface-border:
      rgba(255, 255, 255, 0.3);
    --text-secondary: #d7deea;
    --text-muted: #aeb8ca;
  }

  .text-input,
  .join-card,
  .waiting-card,
  .feedback-card,
  .end-card,
  .leaderboard-item {
    border-width: 2px;
  }

  .answer-button--selected {
    box-shadow:
      0 0 0 7px #ffffff,
      0 12px 0 rgba(0, 0, 0, 0.3);
  }
}