:root {
  --bg-a: #0f0d2c;
  --bg-b: #1d1752;
  --bg-c: #073a68;
  --surface: rgba(255, 255, 255, 0.1);
  --surface-strong: rgba(255, 255, 255, 0.16);
  --text: #f8f9ff;
  --muted: #ced6ff;
  --primary: #2de2e6;
  --primary-strong: #00b7ff;
  --accent: #ff9f1c;
  --success: #43d17f;
  --danger: #ff5f7e;
  --line: rgba(177, 202, 255, 0.34);
  --shadow: 0 16px 34px rgba(4, 8, 28, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: 10px;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(45, 226, 230, 0.25), transparent 34%),
    radial-gradient(circle at 88% 14%, rgba(255, 159, 28, 0.24), transparent 36%),
    radial-gradient(circle at 52% 88%, rgba(255, 95, 126, 0.18), transparent 30%),
    linear-gradient(145deg, var(--bg-a), var(--bg-b) 48%, var(--bg-c));
  overflow: hidden;
}

body.modal-open {
  overflow: hidden !important;
}

.game-shell {
  max-width: 1080px;
  margin: 0 auto;
  height: calc(100dvh - 20px);
  padding: 14px;
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(30, 26, 78, 0.78), rgba(9, 17, 53, 0.82));
  border: 1px solid rgba(160, 182, 255, 0.24);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
  overflow: hidden;
  position: relative;
}

.brand-logo {
  width: 180px;
  height: 180px;
  object-fit: contain;
}

.game-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  letter-spacing: 0.8px;
  text-shadow: 0 0 16px rgba(45, 226, 230, 0.32);
}

.game-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-strip {
  margin-top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px 14px;
}

.status-panel {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-card {
  min-width: 108px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(43, 45, 112, 0.68), rgba(26, 31, 87, 0.72));
  box-shadow: 0 8px 18px rgba(6, 10, 35, 0.35);
}

.stat-card span {
  color: #c8d3ff;
  font-size: 0.79rem;
  display: block;
  text-align: center;
}

.stat-card strong {
  margin-top: 2px;
  display: block;
  font-size: 1.22rem;
  color: #fff;
  text-align: center;
}

.actions {
  display: flex;
  gap: 6px;
  margin-top: 0;
}

.panel-actions {
  justify-content: center;
  margin-top: 10px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(4px);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

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

.btn-secondary {
  color: #dff8ff;
  background: linear-gradient(120deg, rgba(45, 226, 230, 0.34), rgba(0, 183, 255, 0.3));
  border: 1px solid rgba(125, 233, 255, 0.45);
  box-shadow: 0 6px 14px rgba(0, 183, 255, 0.2);
}

.btn-danger {
  color: #e6f6ff;
  background: linear-gradient(120deg, rgba(29, 113, 211, 0.34), rgba(0, 183, 255, 0.3));
  border: 1px solid rgba(120, 201, 255, 0.45);
  box-shadow: 0 6px 14px rgba(0, 145, 255, 0.2);
}

.sound-toggle {
  margin-top: 2px;
  min-width: 140px;
  align-self: flex-end;
}

.status-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.play-area {
  margin-top: 0;
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 12px;
  min-height: 0;
}

.panel {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(170deg, rgba(41, 40, 103, 0.66), rgba(20, 25, 73, 0.74));
  border: 1px solid var(--line);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1.12rem;
  text-align: center;
}

.destination-panel {
  margin-top: 0;
  padding-top: 14px;
}

.word-card {
  min-height: 0;
  flex: 1;
  border-radius: 16px;
  border: 2px dashed rgba(100, 209, 255, 0.7);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 159, 28, 0.26), transparent 34%),
    radial-gradient(circle at 82% 78%, rgba(45, 226, 230, 0.24), transparent 38%),
    linear-gradient(150deg, rgba(47, 52, 130, 0.88), rgba(23, 31, 90, 0.94));
  display: grid;
  place-items: center;
  text-align: center;
  font-size: clamp(2.2rem, 4.2vw, 3.1rem);
  font-weight: 900;
  letter-spacing: 0.6px;
  color: #fff;
  text-shadow: 0 0 12px rgba(45, 226, 230, 0.3);
  padding: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.word-card.dragging {
  transform: scale(1.03);
  border-color: #7de9ff;
  box-shadow: 0 0 0 3px rgba(45, 226, 230, 0.18), 0 14px 28px rgba(4, 8, 30, 0.5);
}

.word-card.correct-flash {
  border-color: var(--success);
  background: linear-gradient(160deg, rgba(22, 97, 66, 0.95), rgba(10, 61, 39, 0.95));
}

.word-card.wrong-flash {
  border-color: var(--danger);
  background: linear-gradient(160deg, rgba(121, 29, 56, 0.93), rgba(83, 19, 40, 0.95));
  animation: wrongImpact 520ms cubic-bezier(0.18, 0.95, 0.24, 1);
}

.word-counter {
  margin: 8px 0 0;
  color: var(--muted);
  text-align: center;
}

.class-boxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  height: 100%;
  min-height: 0;
}

.class-box {
  border: 2px solid rgba(164, 189, 255, 0.48);
  border-radius: 13px;
  min-height: 0;
  padding: 12px 10px;
  background: linear-gradient(145deg, rgba(56, 59, 133, 0.86), rgba(33, 37, 100, 0.9));
  color: #edf2ff;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.class-box:hover,
.class-box:focus-visible {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 226, 230, 0.15);
  outline: none;
}

.class-box.drag-over {
  border-color: var(--accent);
  background: linear-gradient(145deg, rgba(115, 72, 15, 0.9), rgba(84, 49, 10, 0.93));
  box-shadow: 0 0 0 3px rgba(255, 159, 28, 0.24);
}

.class-box.correct-light-blink {
  animation: correctLightBlink 760ms ease-in-out 3;
}

.feedback {
  min-height: 34px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 1.08rem;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  will-change: transform, opacity;
}

.feedback.success {
  color: #9affcf;
  background: rgba(67, 209, 127, 0.14);
  border-color: rgba(67, 209, 127, 0.42);
  font-size: 1.34rem;
  letter-spacing: 0.2px;
  transform: scale(1.45);
  transform-origin: center center;
}

.feedback.success.feedback-pop {
  animation: feedbackPopSuccess 620ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.feedback.error {
  color: #ffc5d2;
  background: rgba(255, 95, 126, 0.14);
  border-color: rgba(255, 95, 126, 0.45);
  text-shadow: 0 0 12px rgba(255, 95, 126, 0.45);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  line-height: 1.15;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.feedback.neutral {
  color: #a8f3ff;
  background: rgba(45, 226, 230, 0.14);
  border-color: rgba(45, 226, 230, 0.42);
}

.feedback.feedback-pop {
  animation: feedbackPop 620ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.feedback.feedback-error-shake {
  animation: feedbackErrorShake 760ms cubic-bezier(0.18, 0.95, 0.24, 1);
}

@keyframes feedbackPop {
  0% {
    transform: translateY(8px) scale(0.96);
    opacity: 0.3;
  }
  40% {
    transform: translateY(-2px) scale(1.02);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes feedbackPopSuccess {
  0% {
    transform: translateY(10px) scale(1.08);
    opacity: 0.25;
  }
  40% {
    transform: translateY(-3px) scale(1.52);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1.45);
    opacity: 1;
  }
}

@keyframes feedbackErrorShake {
  0% { transform: translateX(0) scale(0.92) rotate(0deg); opacity: 0.2; }
  14% { transform: translateX(-18px) scale(1.06) rotate(-1deg); opacity: 1; }
  28% { transform: translateX(15px) scale(1.03) rotate(1deg); }
  42% { transform: translateX(-12px) scale(1.02) rotate(-0.8deg); }
  58% { transform: translateX(9px) scale(1.01) rotate(0.6deg); }
  74% { transform: translateX(-6px) rotate(-0.4deg); }
  100% { transform: translateX(0) scale(1) rotate(0deg); opacity: 1; }
}

.result-screen {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 25%, rgba(255, 159, 28, 0.22), transparent 36%),
    radial-gradient(circle at 85% 20%, rgba(45, 226, 230, 0.22), transparent 36%),
    rgba(2, 8, 30, 0.82);
  backdrop-filter: blur(7px);
}

.result-modal-card {
  width: min(620px, 100%);
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(136, 213, 255, 0.44);
  background:
    radial-gradient(circle at 22% 20%, rgba(255, 170, 79, 0.24), transparent 34%),
    radial-gradient(circle at 76% 82%, rgba(45, 226, 230, 0.2), transparent 40%),
    linear-gradient(162deg, rgba(21, 33, 101, 0.95), rgba(13, 24, 78, 0.97));
  box-shadow: 0 30px 70px rgba(4, 9, 32, 0.58);
  padding: 26px 24px 24px;
  text-align: center;
}

.result-modal-card .result-next-btn,
.result-modal-card .result-restart-link {
  margin-left: auto;
  margin-right: auto;
}

.result-modal-card h2,
.result-modal-card p,
.result-modal-card .result-next-btn {
  position: relative;
  z-index: 2;
}

.result-screen h2 {
  margin: 38px 0 10px;
  font-size: clamp(1.8rem, 4.8vw, 2.35rem);
  text-shadow: 0 0 18px rgba(45, 226, 230, 0.26);
}

.result-screen p {
  margin: 14px 0 0;
  color: #eaf0ff;
  font-size: clamp(1.04rem, 2.6vw, 1.18rem);
  line-height: 1.5;
}

.result-metric {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.result-metric.hit {
  color: #e9fff1;
  background: linear-gradient(120deg, rgba(44, 190, 108, 0.84), rgba(26, 143, 78, 0.9));
  border: 1px solid rgba(187, 255, 215, 0.45);
}

.result-metric.miss {
  color: #fff1f4;
  background: linear-gradient(120deg, rgba(224, 70, 95, 0.84), rgba(168, 33, 59, 0.9));
  border: 1px solid rgba(255, 192, 203, 0.42);
}

.result-separator {
  margin: 0 8px;
  color: rgba(230, 242, 255, 0.85);
  font-weight: 700;
}

.result-tip {
  margin-top: 16px;
  color: #ffd89c;
  font-weight: 700;
}

.result-insights {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.result-insight {
  margin: 0;
  font-size: clamp(0.96rem, 2.4vw, 1.08rem);
  color: #e7f2ff;
}

.insight-class {
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.insight-class.strength {
  color: #effff3;
  background: linear-gradient(120deg, rgba(49, 178, 108, 0.9), rgba(27, 132, 77, 0.92));
}

.insight-class.focus {
  color: #fff3f5;
  background: linear-gradient(120deg, rgba(220, 74, 95, 0.88), rgba(163, 40, 63, 0.92));
}

.insight-value {
  color: #d9e7ff;
  font-weight: 700;
}

.result-next-btn {
  margin-top: 24px;
  width: min(340px, 100%);
  min-height: 58px;
  font-size: clamp(1.05rem, 3vw, 1.22rem);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  background: linear-gradient(120deg, rgba(173, 255, 47, 0.95), rgba(122, 244, 78, 0.94));
  border: 1px solid rgba(226, 255, 173, 0.92);
  color: #08380d;
  box-shadow:
    0 10px 24px rgba(142, 245, 63, 0.38),
    0 0 0 2px rgba(240, 255, 208, 0.22) inset;
}

.result-next-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  filter: saturate(1.1);
}

.result-restart-link {
  display: block;
  width: fit-content;
  margin: 10px auto 0;
  border: none;
  background: transparent;
  color: #cde8ff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  opacity: 0.9;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.result-restart-link:hover,
.result-restart-link:focus-visible {
  color: #ffffff;
  opacity: 1;
}

.result-deco {
  position: absolute;
  pointer-events: none;
  user-select: none;
  opacity: 0.92;
}

.result-logo-tag {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(159, 227, 255, 0.5);
  background: linear-gradient(120deg, rgba(15, 35, 98, 0.72), rgba(17, 49, 121, 0.68));
  box-shadow: 0 8px 20px rgba(3, 15, 52, 0.35);
}

.result-deco-logo {
  width: clamp(78px, 18vw, 120px);
  position: static;
  transform: none;
  filter: drop-shadow(0 10px 18px rgba(7, 13, 44, 0.45));
}

.result-deco-book {
  width: clamp(130px, 30vw, 220px);
  right: 0;
  top: 50%;
  transform: rotate(-8deg);
  translate: 0 -50%;
  opacity: 0.34;
  z-index: 1;
  filter: drop-shadow(0 8px 14px rgba(7, 13, 44, 0.36));
}

.hidden {
  display: none;
}

.intro-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 30%, rgba(45, 226, 230, 0.16), transparent 36%),
    rgba(3, 7, 25, 0.82);
  backdrop-filter: blur(6px);
}

.intro-modal.hidden {
  display: none;
}

.intro-modal-card {
  width: min(560px, 100%);
  border-radius: 20px;
  border: 1px solid rgba(146, 176, 255, 0.38);
  background: linear-gradient(165deg, rgba(28, 36, 98, 0.95), rgba(14, 22, 66, 0.96));
  box-shadow: 0 24px 60px rgba(5, 8, 28, 0.58);
  padding: 20px 20px 18px;
  text-align: center;
}

.intro-modal-logo {
  width: clamp(95px, 22vw, 140px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0, 183, 255, 0.28));
}

.intro-modal-card h2 {
  margin: 8px 0 10px;
  font-size: clamp(1.35rem, 3.4vw, 1.85rem);
}

.intro-modal-card p {
  margin: 0;
  color: #d5deff;
  line-height: 1.42;
  font-size: clamp(1.06rem, 2.85vw, 1.22rem);
}

.intro-start-btn {
  margin-top: 16px;
  min-height: 48px;
  min-width: 180px;
  padding: 10px 16px;
  font-size: 1rem;
}

.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
  contain: layout paint style;
  isolation: isolate;
}

.side-copy {
  position: fixed;
  right: 10px;
  bottom: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: rgba(207, 222, 255, 0.5);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  z-index: 5;
}

.wiz-side {
  position: fixed;
  left: 0;
  bottom: 0;
  width: clamp(240px, 27vw, 400px);
  height: auto;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0.9;
}

.logo-base-right {
  position: fixed;
  right: 10px;
  top: 8px;
  width: clamp(105px, 12.5vw, 170px);
  height: auto;
  opacity: 0.9;
  pointer-events: none;
  user-select: none;
  z-index: 35;
}

.livro-right-top {
  position: fixed;
  right: 10px;
  top: 44px;
  width: clamp(155px, 18.5vw, 260px);
  height: auto;
  opacity: 0.9;
  pointer-events: none;
  user-select: none;
  z-index: 34;
}

.fx-particle {
  position: absolute;
  left: 0;
  top: 0;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  transform: translate(var(--x), var(--y));
  opacity: 1;
}

.fx-particle.success {
  background: linear-gradient(130deg, #2de2e6, #ff9f1c 50%, #43d17f);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
  animation: successBurst 950ms cubic-bezier(0.12, 0.9, 0.22, 1) forwards;
}

.fx-piece {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  opacity: 0;
  pointer-events: none;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.fx-piece.paper {
  border-radius: 2px;
}

.fx-piece.streamer {
  border-radius: 999px;
  transform-origin: 50% 8%;
  box-shadow:
    0 3px 9px rgba(0, 0, 0, 0.26),
    inset 0 0 1px rgba(255, 255, 255, 0.55);
}

.fx-particle.error {
  background: radial-gradient(circle, #ffd166, #ff5f7e 58%, #ff8a00);
  border-radius: 50%;
  width: 8px;
  height: 8px;
  animation: errorBurst 700ms cubic-bezier(0.12, 0.9, 0.22, 1) forwards;
}

@keyframes successBurst {
  to {
    transform: translate(calc(var(--x) + var(--dx)), calc(var(--y) + var(--dy))) rotate(var(--rot));
    opacity: 0;
  }
}

@keyframes errorBurst {
  to {
    transform: translate(calc(var(--x) + var(--dx)), calc(var(--y) + var(--dy))) scale(0.5);
    opacity: 0;
  }
}

@keyframes wrongImpact {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.03) rotate(-0.5deg); }
  50% { transform: scale(0.98) rotate(0.4deg); }
  75% { transform: scale(1.02) rotate(-0.3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes correctLightBlink {
  0% {
    border-color: rgba(164, 189, 255, 0.48);
    background: linear-gradient(145deg, rgba(56, 59, 133, 0.86), rgba(33, 37, 100, 0.9));
    box-shadow: 0 0 0 0 rgba(67, 209, 127, 0);
    filter: brightness(1);
  }
  20% {
    border-color: #b6ffda;
    background: linear-gradient(145deg, rgba(72, 181, 123, 0.98), rgba(30, 124, 82, 0.98));
    box-shadow: 0 0 0 3px rgba(67, 209, 127, 0.45), 0 0 30px rgba(67, 209, 127, 0.9);
    filter: brightness(1.45);
  }
  45% {
    border-color: rgba(164, 189, 255, 0.48);
    background: linear-gradient(145deg, rgba(56, 59, 133, 0.86), rgba(33, 37, 100, 0.9));
    box-shadow: 0 0 0 0 rgba(67, 209, 127, 0);
    filter: brightness(1);
  }
  70% {
    border-color: #dcffef;
    background: linear-gradient(145deg, rgba(87, 211, 147, 0.98), rgba(33, 146, 94, 0.98));
    box-shadow: 0 0 0 4px rgba(67, 209, 127, 0.42), 0 0 36px rgba(67, 209, 127, 0.95);
    filter: brightness(1.58);
  }
  100% {
    border-color: rgba(164, 189, 255, 0.48);
    background: linear-gradient(145deg, rgba(56, 59, 133, 0.86), rgba(33, 37, 100, 0.9));
    box-shadow: 0 0 0 0 rgba(67, 209, 127, 0);
    filter: brightness(1);
  }
}

@media (max-width: 900px) {
  body {
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    overflow: auto;
  }

  .game-shell {
    height: auto;
    min-height: calc(100dvh - 24px);
    width: 100%;
    max-width: none;
    margin: 0;
    gap: 12px;
    overflow: visible;
  }

  .top-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .status-panel {
    align-items: stretch;
  }

  .stats {
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 10px;
  }

  .stat-card {
    min-width: 0;
  }

  .sound-toggle {
    align-self: stretch;
    min-width: 0;
  }

  .play-area {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .panel {
    padding: 12px;
  }

  .word-card {
    min-height: 190px;
  }

  .class-box {
    min-height: 52px;
    padding: 12px;
    font-size: 1rem;
  }

  .btn {
    min-height: 46px;
    padding: 10px 12px;
    font-size: 0.95rem;
    touch-action: manipulation;
  }

  .feedback.success {
    transform: scale(1.08);
    font-size: clamp(1.05rem, 3.2vw, 1.2rem);
  }

  .side-copy {
    right: 6px;
    font-size: 0.62rem;
    bottom: 6px;
  }

  .logo-base-right {
    width: clamp(82px, 20vw, 126px);
    right: 6px;
    top: 6px;
    opacity: 0.78;
  }

  .livro-right-top {
    width: clamp(110px, 27vw, 170px);
    right: 6px;
    top: 34px;
    opacity: 0.72;
  }

  .wiz-side {
    width: clamp(150px, 33vw, 230px);
    opacity: 0.64;
  }
}

@media (max-width: 560px) {
  body {
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .game-shell {
    height: auto;
    min-height: calc(100dvh - 20px);
    padding: 12px;
    border-radius: 14px;
    gap: 10px;
  }

  .game-header h1 {
    font-size: clamp(1.4rem, 6.2vw, 1.8rem);
  }

  .game-header p {
    font-size: 0.9rem;
  }

  .stats {
    gap: 8px;
  }

  .stat-card {
    padding: 8px 10px;
  }

  .stat-card strong {
    font-size: 1.1rem;
  }

  .actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .btn {
    min-height: 48px;
    font-size: 0.92rem;
  }

  .panel h2 {
    margin-bottom: 10px;
    font-size: 1rem;
  }

  .word-card {
    min-height: 150px;
    font-size: clamp(1.8rem, 8vw, 2.5rem);
  }

  .word-counter {
    margin-top: 6px;
    font-size: 0.92rem;
  }

  .class-boxes {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .class-box {
    min-height: 50px;
    font-size: 0.98rem;
  }

  .brand-logo {
    width: 170px;
    height: 170px;
  }

  .feedback {
    font-size: 0.98rem;
    padding: 7px 8px;
  }

  .feedback.error {
    font-size: clamp(0.98rem, 4.2vw, 1.15rem);
  }

  .feedback.success {
    transform: scale(1.03);
    font-size: clamp(1rem, 4vw, 1.14rem);
  }

  .result-screen {
    padding: 12px;
  }

  .result-modal-card {
    border-radius: 18px;
    padding: 18px 14px 16px;
  }

  .result-next-btn {
    width: 100%;
    min-height: 52px;
  }

  .result-deco-logo {
    width: clamp(74px, 24vw, 108px);
  }

  .result-deco-book {
    right: 0;
    top: 50%;
  }

  .side-copy {
    display: none;
  }

  .wiz-side {
    width: clamp(110px, 34vw, 170px);
    opacity: 0.45;
  }

  .logo-base-right,
  .livro-right-top {
    opacity: 0.55;
  }

  .intro-modal {
    padding: 12px;
  }

  .intro-modal-card {
    border-radius: 16px;
    padding: 16px 14px 14px;
  }

  .intro-start-btn {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 400px) {
  .game-shell {
    padding: 10px;
    border-radius: 12px;
  }

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

  .btn {
    min-height: 46px;
  }

  .word-card {
    min-height: 124px;
    font-size: clamp(1.5rem, 9vw, 2rem);
  }

  .class-box {
    font-size: 0.93rem;
    min-height: 48px;
  }

  .feedback {
    min-height: 30px;
  }

  .logo-base-right,
  .livro-right-top {
    display: none;
  }

}
