@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-info: #267a85;
  --rc-shadow: 0 20px 50px rgba(18, 61, 50, 0.09);
  --rc-shadow-soft: 0 10px 30px rgba(18, 61, 50, 0.07);
}

* { 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, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, select { font: inherit; }
button, select, .qf-word, .qf-slot { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
select:focus-visible,
.qf-word:focus-visible,
.qf-slot: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: var(--rc-green-900);
  box-shadow: var(--rc-shadow-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.12em;
}

.game-panel {
  display: grid;
  grid-template-columns: minmax(250px, 1.2fr) minmax(390px, 1.4fr) 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; }
.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;
  align-items: center;
  gap: 8px;
}

.game-actions { padding-bottom: 1px; }

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

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

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

.game-button-info {
  background: #e8f4f3;
  border-color: #c5dfdc;
  color: #165761;
}
.game-button-info:hover { background: #d9ecea; color: #124a53; }

.game-button-secondary {
  background: var(--rc-gold-100);
  border-color: var(--rc-gold-300);
  color: #765215;
}
.game-button-secondary:hover { background: #f4e3b8; color: #68470f; }

.game-button-ghost {
  background: #fff;
  border-color: #d7e1dc;
  color: #586862;
}
.game-button-ghost:hover { border-color: #bdcbc4; color: var(--rc-green-950); }

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

.stat-card {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid #dbe8e1;
  border-radius: 14px;
  background: var(--rc-green-50);
}
.stat-card span {
  color: var(--rc-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.stat-card strong {
  color: var(--rc-green-950);
  font-size: 20px;
  line-height: 1.1;
}

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

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

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

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

.game-card {
  border: 1px solid var(--rc-line);
  border-radius: 18px;
  background: #fff;
  padding: 20px;
}

.game-card + .game-card { margin-top: 14px; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-heading strong {
  color: var(--rc-green-950);
  font-size: 15px;
}
.section-heading span {
  color: var(--rc-muted);
  font-size: 12px;
  text-align: right;
}

.qf-build,
.qf-pool-words {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  min-height: 56px;
}

.qf-build { align-items: stretch; }
.qf-pool-words { align-items: center; }

.qf-slot {
  min-width: 64px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 2px dashed #bfd0c7;
  border-radius: 12px;
  background: #f8fbf9;
  color: var(--rc-green-950);
  font-size: 14px;
  font-weight: 650;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease, transform .14s ease;
}

.qf-slot.over,
.qf-slot.selected {
  border-color: var(--rc-gold-500);
  background: #fffaf0;
  box-shadow: 0 0 0 3px rgba(209,163,71,.12);
}

.qf-slot.ok {
  border-style: solid;
  border-color: #4f9b78;
  background: #e7f4ec;
  color: #174d39;
}

.qf-slot.bad {
  border-style: solid;
  border-color: #df776f;
  background: #fff0ee;
  color: #87372f;
}

.qf-word {
  user-select: none;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid #d6c17f;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff5d7, #f8e8b6);
  color: #604718;
  font-size: 14px;
  font-weight: 750;
  cursor: grab;
  box-shadow: 0 4px 10px rgba(156,116,42,.09);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

.qf-word:hover {
  transform: translateY(-1px);
  border-color: var(--rc-gold-500);
  box-shadow: 0 7px 16px rgba(156,116,42,.14);
}
.qf-word:active { cursor: grabbing; }
.qf-word.selected {
  border-color: var(--rc-green-600);
  background: var(--rc-green-100);
  color: var(--rc-green-950);
  box-shadow: 0 0 0 3px rgba(45,122,94,.12);
}

.qf-build,
.qf-pool-words { touch-action: manipulation; }

.qf-original { display: none; }

.qf-result {
  background: linear-gradient(120deg, #f4fbf7, #fff9e9);
  border-color: #d8e6de;
}
.qf-result h3 {
  margin: 7px 0 18px;
  color: var(--rc-green-950);
  font-size: 24px;
}
.qf-result p {
  margin: 16px 0 0;
  color: var(--rc-ink);
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.result-grid > div {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid #dbe8e1;
  border-radius: 13px;
  background: rgba(255,255,255,.72);
}
.result-grid span {
  color: var(--rc-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.result-grid strong { color: var(--rc-green-950); }

.btn-blink {
  animation: rcPulse 1.1s ease-in-out infinite;
}
@keyframes rcPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(209,163,71,.1); }
  50% { box-shadow: 0 0 0 5px rgba(209,163,71,.18); }
}

.game-site-footer {
  padding: 28px 0;
  background: var(--rc-green-950);
  color: rgba(255,255,255,.72);
}

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

.footer-brand strong {
  display: block;
  color: #fff;
  font-size: 13px;
}
.footer-brand span:last-child {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,.6);
  font-size: 10px;
}
.brand-mark-footer {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  font-size: 14px;
}

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

@media (max-width: 720px) {
  .site-shell { width: min(100% - 28px, 1180px); }
  .header-inner { min-height: 72px; }
  .header-kicker { display: none; }
  .game-page { padding: 28px 0 42px; }
  .game-hero {
    grid-template-columns: 1fr;
    padding: 28px;
    border-radius: 24px;
  }
  .hero-symbol { display: none; }
  .game-hero h1 { font-size: clamp(34px, 10vw, 46px); }
  .game-hero p { font-size: 15px; }
  .game-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 20px;
  }
  .game-actions { padding: 0; }
  .button-row { width: 100%; }
  .game-button { flex: 1 1 46%; }
  .stats { grid-column: auto; }
  .play-area { padding: 20px; }
  .play-area-header {
    display: block;
  }
  .play-area-header p {
    margin-top: 10px;
    text-align: left;
  }
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .section-heading span { text-align: left; }
  .qf-slot {
    min-width: 54px;
    min-height: 44px;
    padding: 6px 10px;
    font-size: 13px;
  }
  .qf-word {
    min-height: 40px;
    padding: 7px 13px;
    font-size: 13px;
  }
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .site-shell { width: calc(100% - 22px); }
  .brand-mark { width: 40px; height: 40px; flex-basis: 40px; }
  .brand-copy strong { font-size: 16px; }
  .game-hero { padding: 24px 22px; }
  .game-panel,
  .play-area { border-radius: 20px; }
  .game-panel { padding: 17px; }
  .play-area { padding: 17px; }
  .game-button { flex: 1 1 100%; }
  .stats { grid-template-columns: 1fr 1fr; }
  .game-card { padding: 16px; }
  .qf-build,
  .qf-pool-words { gap: 7px; }
  .qf-slot { min-width: 48px; }
  .result-grid { grid-template-columns: 1fr; }
}

/* 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;
}
