@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap");

:root {
  --rc-green-950: #0c2e27;
  --rc-green-900: #123d32;
  --rc-green-800: #18503f;
  --rc-green-700: #21664f;
  --rc-green-600: #2d7a5e;
  --rc-green-100: #dff0e7;
  --rc-green-50: #eef7f2;
  --rc-gold-700: #9c742a;
  --rc-gold-600: #b98b34;
  --rc-gold-500: #d1a347;
  --rc-gold-300: #ead19a;
  --rc-gold-100: #f8edcf;
  --rc-cream: #fbfaf6;
  --rc-paper: #ffffff;
  --rc-ink: #1e2b27;
  --rc-muted: #65736e;
  --rc-line: #dfe7e2;
  --rc-danger: #c9443b;
  --rc-shadow: 0 20px 50px rgba(18, 61, 50, 0.09);
  --rc-shadow-soft: 0 10px 30px rgba(18, 61, 50, 0.07);
  --qse-x-color: rgba(220, 53, 69, 0.9);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--rc-cream);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 6%, rgba(223, 240, 231, .92), transparent 30rem),
    radial-gradient(circle at 94% 18%, rgba(248, 237, 207, .78), transparent 28rem),
    var(--rc-cream);
  color: var(--rc-ink);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, select { font: inherit; }
button, select, .qse-cell { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
select:focus-visible,
.qse-cell:focus-visible {
  outline: 3px solid rgba(209, 163, 71, .55);
  outline-offset: 3px;
}

.site-shell {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.game-site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(12, 46, 39, .97);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(14px);
}

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

.brand,
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.03));
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
}

.brand-copy {
  display: grid;
  gap: 2px;
  line-height: 1.1;
}

.brand-copy strong { font-size: 17px; letter-spacing: -.015em; }
.brand-copy small,
.header-kicker { color: rgba(255,255,255,.64); }
.brand-copy small { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.header-kicker { font-size: 13px; }

.game-page { padding: 48px 0 64px; }

.game-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 36px;
  padding: 34px 38px;
  border: 1px solid rgba(33,102,79,.12);
  border-radius: 28px;
  background: linear-gradient(120deg, rgba(223,240,231,.88), rgba(248,237,207,.72));
  box-shadow: var(--rc-shadow-soft);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--rc-green-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: var(--rc-gold-500);
  content: "";
}

.game-hero h1 {
  margin: 8px 0;
  color: var(--rc-green-950);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -.04em;
}

.game-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--rc-muted);
  font-size: 16px;
}

.hero-symbol {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(185,139,52,.2);
  border-radius: 30px;
  background: rgba(255,255,255,.76);
  color: #fff;
  box-shadow: var(--rc-shadow-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 46px;
  font-weight: 700;
}

.hero-symbol::before {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--rc-green-900);
  content: "?";
}

.hero-symbol { font-size: 0; }

.game-panel {
  display: grid;
  grid-template-columns: minmax(230px, 1.1fr) minmax(300px, 1.1fr) minmax(250px, .85fr);
  align-items: end;
  gap: 18px;
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--rc-line);
  border-radius: 22px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--rc-shadow-soft);
}

.control-group { min-width: 0; }
.actions-group {
  align-self: start;
  padding-top: 27px;
}
.control-label {
  display: block;
  margin-bottom: 7px;
  color: var(--rc-green-950);
  font-size: 13px;
  font-weight: 800;
}
.control-group small {
  display: block;
  margin-top: 6px;
  color: var(--rc-muted);
  font-size: 12px;
}

.level-dropdown-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #cad9d1;
  border-radius: 12px;
  background: #fff;
  color: var(--rc-ink);
  padding: 0 14px;
  text-align: left;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.level-dropdown-button:hover,
.level-dropdown-button:focus {
  border-color: var(--rc-green-600);
  box-shadow: 0 0 0 4px rgba(45,122,94,.09);
}

.dropdown-menu.levels-menu {
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  border-color: var(--rc-line);
  border-radius: 12px;
  box-shadow: var(--rc-shadow-soft);
}

.dropdown-item { padding: 9px 14px; }
.dropdown-item:active,
.dropdown-item:hover { background: var(--rc-green-50); color: var(--rc-green-950); }

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

.game-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 750;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

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

.game-button-primary {
  background: var(--rc-green-700);
  color: #fff;
  box-shadow: 0 8px 20px rgba(33,102,79,.18);
}
.game-button-primary:hover { background: var(--rc-green-800); color: #fff; }

.game-button-secondary {
  border-color: var(--rc-gold-300);
  background: var(--rc-gold-100);
  color: #6f511b;
}
.game-button-secondary:hover { background: #f3e3b9; color: #6f511b; }

.game-button-ghost {
  border-color: #d7dfdb;
  background: #fff;
  color: var(--rc-muted);
}
.game-button-ghost:hover { border-color: #b9c7c0; color: var(--rc-green-900); }

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

.stat-card {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 11px 14px;
  border: 1px solid var(--rc-line);
  border-radius: 14px;
  background: var(--rc-green-50);
}

.stat-card span {
  color: var(--rc-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.stat-card strong {
  color: var(--rc-green-950);
  font-size: 22px;
  line-height: 1.15;
}

.stat-card-help strong { font-size: 13px; }

.play-area {
  margin-top: 22px;
  padding: 24px;
  border: 1px solid var(--rc-line);
  border-radius: 24px;
  background: rgba(255,255,255,.95);
  box-shadow: var(--rc-shadow);
}

.play-area-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.play-area-header h2 {
  margin: 7px 0 0;
  color: var(--rc-green-950);
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.05;
  letter-spacing: -.03em;
}

.play-area-header p {
  max-width: 430px;
  margin: 0;
  color: var(--rc-muted);
  font-size: 13px;
  text-align: right;
}

.qse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 760px);
  margin-inline: auto;
}

.qse-cell {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid #dbe6e0;
  border-radius: 18px;
  background: linear-gradient(145deg, #f6faf7, #f8f2e2);
  box-shadow: 0 8px 22px rgba(18,61,50,.07);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.qse-cell.clickable:hover {
  transform: translateY(-2px);
  border-color: var(--rc-gold-300);
  box-shadow: 0 12px 28px rgba(18,61,50,.12);
}

.qse-cell-inner {
  position: relative;
  width: 100%;
  padding-top: 100%;
}

.qse-cell-inner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 120ms ease, filter 150ms ease;
}

.qse-cell.center {
  border: 2px solid var(--rc-gold-300);
  background: var(--rc-gold-100);
  box-shadow: 0 0 0 4px rgba(209,163,71,.12), 0 12px 28px rgba(18,61,50,.11);
}

.qse-cell.center::after {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(12,46,39,.88);
  color: #fff;
  content: "PISTA";
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

.qse-cell.clickable { cursor: pointer; }
.qse-cell.click-anim img { transform: scale(.97); filter: brightness(.96); }

.qse-cell.wrong::after {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(45deg, transparent 43%, var(--qse-x-color) 45%, var(--qse-x-color) 55%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, var(--qse-x-color) 45%, var(--qse-x-color) 55%, transparent 57%);
  content: "";
  opacity: 0;
  animation: qse-x 250ms ease forwards;
}

@keyframes qse-x { from { opacity: 0; } to { opacity: 1; } }

.qse-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6,29,24,.78);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 200ms ease;
}

.qse-overlay.show { opacity: 1; }
.qse-overlay.d-none { display: none !important; }

.overlay-card {
  width: min(92vw, 520px);
  padding: 26px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 24px;
  background: var(--rc-paper);
  box-shadow: 0 28px 80px rgba(0,0,0,.26);
  text-align: center;
}

.overlay-eyebrow { margin-bottom: 14px; }
.overlay-card img {
  display: block;
  width: min(100%, 360px);
  max-height: 54vh;
  object-fit: contain;
  margin-inline: auto;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(18,61,50,.12);
}

.qse-final-score {
  margin-top: 16px;
  color: var(--rc-green-950);
  font-size: 22px;
  font-weight: 800;
}

.qse-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.alert-warning {
  border: 1px solid var(--rc-gold-300);
  border-radius: 12px;
  background: var(--rc-gold-100);
  color: #6f511b;
}

.game-site-footer {
  margin-top: auto;
  background: var(--rc-green-950);
  color: rgba(255,255,255,.72);
}

.footer-inner {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  font-size: 12px;
}

.footer-brand strong { display: block; color: #fff; font-size: 14px; }
.footer-brand span:not(.brand-mark) { display: block; margin-top: 2px; font-size: 11px; }
.brand-mark-footer { width: 38px; height: 38px; flex-basis: 38px; font-size: 15px; }

@media (max-width: 900px) {
  .game-panel { grid-template-columns: 1fr 1fr; }
  .stats { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .site-shell { width: min(100% - 28px, 1180px); }
  .header-inner { min-height: 70px; }
  .header-kicker { display: none; }
  .game-page { padding: 28px 0 42px; }
  .game-hero { grid-template-columns: 1fr; gap: 0; padding: 28px 26px; border-radius: 24px; }
  .game-hero h1 { font-size: 42px; }
  .hero-symbol { display: none; }
  .game-panel { grid-template-columns: 1fr; padding: 20px; }
  .actions-group { padding-top: 0; }
  .stats { grid-column: auto; }
  .button-row { display: grid; grid-template-columns: 1fr; }
  .game-button { width: 100%; }
  .play-area { padding: 18px 14px; }
  .play-area-header { display: block; }
  .play-area-header p { margin-top: 10px; text-align: left; }
  .qse-grid { gap: 7px; }
  .qse-cell { border-radius: 12px; }
  .qse-cell.center::after { left: 6px; bottom: 6px; padding: 3px 6px; font-size: 8px; }
  .footer-inner { min-height: 132px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 16px; }
}

@media (max-width: 390px) {
  .site-shell { width: min(100% - 20px, 1180px); }
  .brand-copy strong { font-size: 16px; }
  .game-hero { padding: 24px 20px; }
  .game-hero h1 { font-size: 36px; }
  .stats { grid-template-columns: 1fr; }
  .play-area { padding-inline: 10px; }
  .qse-grid { gap: 5px; }
}

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

/* Modo de jogo em janela dedicada */
@keyframes close-button-pulse {
  0%, 100% {
    box-shadow: 0 8px 20px rgba(201, 54, 45, .22), 0 0 0 0 rgba(201, 54, 45, .22);
  }
  50% {
    box-shadow: 0 10px 24px rgba(201, 54, 45, .30), 0 0 0 6px rgba(201, 54, 45, .10);
  }
}

html.dedicated-game-window,
body.dedicated-game-window {
  min-height: 100%;
}
body.dedicated-game-window {
  min-height: 100dvh;
}
body.dedicated-game-window .game-site-header,
body.dedicated-game-window .game-site-footer {
  display: none !important;
}
body.dedicated-game-window .game-page {
  min-height: 100dvh;
  padding-top: 18px;
  padding-bottom: 28px;
}
body.dedicated-game-window .site-shell {
  width: min(1440px, calc(100% - 24px));
}
body.dedicated-game-window .game-hero {
  display: none !important;
}
body.dedicated-game-window .game-panel {
  margin-top: 0;
}
body.dedicated-game-window #closeBtn,
body.dedicated-game-window #btnFechar {
  border-color: #c9362d !important;
  background: #c9362d !important;
  color: #fff !important;
  animation: close-button-pulse 1.8s ease-in-out infinite;
}
body.dedicated-game-window #closeBtn:hover,
body.dedicated-game-window #btnFechar:hover {
  border-color: #a92d26 !important;
  background: #a92d26 !important;
  color: #fff !important;
}
