:root {
  --torre-ink: #231826;
  --torre-muted: #5d5062;
  --torre-gold: #ffc83d;
  --torre-mint: #9cf2d1;
  --torre-coral: #ff6f61;
  --torre-blue: #37c7ff;
  --torre-card: #ffffff;
  --torre-shadow: 0 18px 44px rgba(35, 24, 38, 0.18);
}

* {
  box-sizing: border-box;
}

body.pug-torre-page,
body.pug-torre-embed {
  margin: 0;
  color: var(--torre-ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 200, 61, 0.62), transparent 24%),
    radial-gradient(circle at 88% 16%, rgba(180, 155, 255, 0.4), transparent 28%),
    linear-gradient(140deg, rgba(207, 231, 255, 0.6), rgba(255, 217, 236, 0.5)),
    #f7fbff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body.pug-torre-embed {
  background: transparent;
}

a {
  color: inherit;
}

.torre-page-main,
.torre-site-header,
.torre-site-footer {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.torre-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 0 10px;
  flex-wrap: wrap;
}

.torre-brand,
.torre-nav a,
.torre-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 900;
}

.torre-brand {
  padding: 10px 16px;
  color: #ffffff;
  background: var(--torre-ink);
  box-shadow: 0 4px 0 rgba(35, 24, 38, 0.24);
}

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

.torre-nav a {
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(35, 24, 38, 0.1);
  font-size: 0.92rem;
}

.torre-page-hero {
  display: grid;
  gap: 16px;
  padding: 16px 0 10px;
}

.torre-kicker {
  margin: 0 0 8px;
  color: #a3529c;
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.torre-page-hero h1,
.torre-content-section h2 {
  margin: 0;
  line-height: 1.05;
}

.torre-page-hero h1 {
  max-width: 820px;
  font-size: clamp(2.1rem, 9vw, 4.2rem);
}

.torre-summary {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--torre-muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.torre-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.torre-button {
  padding: 11px 20px;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
}

.torre-button.primary {
  color: #3a2410;
  background: linear-gradient(180deg, #ffd76a, var(--torre-gold));
  box-shadow: 0 5px 0 #d9a41e;
}

.torre-button.secondary {
  color: var(--torre-ink);
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(35, 24, 38, 0.16);
}

.torre-button.dark {
  color: #ffffff;
  background: var(--torre-ink);
  box-shadow: 0 5px 0 rgba(35, 24, 38, 0.35);
}

.torre-button.is-disabled {
  opacity: 0.55;
  pointer-events: auto;
  cursor: progress;
}

.torre-game-shell {
  padding: 10px 0 18px;
}

.torre-game {
  position: relative;
  border-radius: 26px;
  background: var(--torre-card);
  box-shadow: var(--torre-shadow);
  overflow: hidden;
}

.torre-topbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 16px;
  background: linear-gradient(120deg, #fdf3ff, #eef7ff);
  border-bottom: 1px solid rgba(35, 24, 38, 0.08);
}

.torre-stat {
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
}

.torre-stat span {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--torre-muted);
}

.torre-stat strong {
  font-size: 1.25rem;
}

.torre-stage {
  position: relative;
  height: min(72vh, 620px);
  min-height: 420px;
  touch-action: none;
  cursor: grab;
  overflow: hidden;
}

.torre-stage:active {
  cursor: grabbing;
}

.torre-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.torre-bubble {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(35, 24, 38, 0.08);
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: 0 6px 14px rgba(35, 24, 38, 0.1);
  pointer-events: none;
  white-space: nowrap;
}

.torre-pug {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 3;
  width: clamp(54px, 10vw, 72px);
  height: clamp(54px, 10vw, 72px);
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, 0.92), rgba(255, 231, 157, 0.9) 48%, rgba(255, 156, 197, 0.92));
  box-shadow:
    inset 0 -7px 0 rgba(35, 24, 38, 0.1),
    0 8px 0 rgba(35, 24, 38, 0.13),
    0 14px 24px rgba(35, 24, 38, 0.22);
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
  pointer-events: none;
}

.torre-pug img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 235%;
  max-width: none;
  height: auto;
  display: block;
  transform: translate(-50%, -48%);
  filter: none;
}

.torre-pug.is-hit {
  animation: torre-hit-flash 0.16s linear 4;
}

.torre-pug.is-combo {
  box-shadow:
    inset 0 -7px 0 rgba(35, 24, 38, 0.1),
    0 0 0 4px rgba(255, 200, 61, 0.78),
    0 0 24px rgba(255, 200, 61, 0.9),
    0 14px 24px rgba(35, 24, 38, 0.22);
}

@keyframes torre-hit-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.torre-screen {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(35, 24, 38, 0.38);
  backdrop-filter: blur(3px);
  overflow: auto;
}

.torre-screen.is-visible {
  display: flex;
}

.torre-panel {
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 22px;
  border-radius: 22px;
  background: var(--torre-card);
  box-shadow: var(--torre-shadow);
  text-align: center;
}

.torre-panel h1,
.torre-panel h2 {
  margin: 4px 0 8px;
  line-height: 1.1;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
}

.torre-panel h3 {
  margin: 4px 0 8px;
  line-height: 1.25;
}

.torre-subtitle {
  margin: 0 0 8px;
  font-weight: 800;
  color: #a3529c;
}

.torre-start-visual {
  position: relative;
  width: 210px;
  margin: 6px auto 10px;
}

.torre-start-visual img {
  width: 100%;
  height: auto;
  display: block;
}

.torre-preview-token {
  position: absolute;
  font-size: 1.5rem;
}

.torre-preview-token.good {
  top: -4px;
  right: -26px;
}

.torre-preview-token.bad {
  bottom: 2px;
  left: -28px;
}

.torre-rules {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
  font-weight: 700;
  font-size: 0.95rem;
}

.torre-rules li {
  padding: 8px 10px;
  border-radius: 12px;
  background: #f6f1fb;
}

.torre-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

body.pug-torre-page [data-torre-start-screen] .torre-panel,
body.pug-torre-embed [data-torre-start-screen] .torre-panel {
  width: min(900px, calc(100% - 24px)) !important;
  max-height: calc(100% - 20px) !important;
  display: grid;
  grid-template-columns: minmax(150px, 215px) minmax(0, 1fr);
  align-items: center;
  gap: 8px 18px;
  padding: 16px 18px !important;
  text-align: left;
}

body.pug-torre-page [data-torre-start-screen] .torre-kicker,
body.pug-torre-embed [data-torre-start-screen] .torre-kicker {
  grid-column: 1 / -1;
  margin: 0;
}

body.pug-torre-page [data-torre-start-screen] .torre-start-visual,
body.pug-torre-embed [data-torre-start-screen] .torre-start-visual {
  grid-row: 2 / span 5;
  width: clamp(165px, 20vw, 220px);
  margin: 0 auto;
  overflow: visible;
}

body.pug-torre-page [data-torre-start-screen] .torre-start-visual img,
body.pug-torre-embed [data-torre-start-screen] .torre-start-visual img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
}

body.pug-torre-page [data-torre-start-screen] .torre-preview-token,
body.pug-torre-embed [data-torre-start-screen] .torre-preview-token {
  display: none !important;
}

body.pug-torre-page [data-torre-start-screen] .torre-panel h1,
body.pug-torre-page [data-torre-start-screen] .torre-panel h2,
body.pug-torre-embed [data-torre-start-screen] .torre-panel h1,
body.pug-torre-embed [data-torre-start-screen] .torre-panel h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3.3vw, 2.15rem) !important;
}

body.pug-torre-page [data-torre-start-screen] .torre-subtitle,
body.pug-torre-embed [data-torre-start-screen] .torre-subtitle,
body.pug-torre-page [data-torre-start-screen] .torre-panel > p:not(.torre-kicker):not(.torre-subtitle),
body.pug-torre-embed [data-torre-start-screen] .torre-panel > p:not(.torre-kicker):not(.torre-subtitle) {
  margin: 0;
}

body.pug-torre-page [data-torre-start-screen] .torre-rules,
body.pug-torre-embed [data-torre-start-screen] .torre-rules {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 2px 0 0;
  font-size: 0.84rem;
}

body.pug-torre-page [data-torre-start-screen] .torre-rules li,
body.pug-torre-embed [data-torre-start-screen] .torre-rules li {
  padding: 7px 8px;
}

body.pug-torre-page [data-torre-start-screen] .torre-actions,
body.pug-torre-embed [data-torre-start-screen] .torre-actions {
  justify-content: flex-start;
  margin-top: 2px;
}

body.pug-torre-page [data-torre-start-screen] .torre-button,
body.pug-torre-embed [data-torre-start-screen] .torre-button {
  min-height: 42px;
  padding: 9px 16px;
}

.torre-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.torre-result-card {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: 14px;
  background: #f6f1fb;
}

.torre-result-card span {
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--torre-muted);
}

.torre-result-card strong {
  font-size: 1.5rem;
}

.torre-quote {
  margin: 10px 0;
  font-style: italic;
  color: var(--torre-muted);
}

.torre-reward-panel {
  display: none;
  margin: 12px 0;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(140deg, #fff7e0, #ffeef9);
  border: 2px solid rgba(255, 200, 61, 0.65);
}

.torre-reward-panel.is-visible {
  display: block;
}

.torre-reward-panel.torre-reward-locked {
  background: #f4f2f7;
  border-color: rgba(35, 24, 38, 0.14);
}

.torre-reward-kicker {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #a3529c;
}

.torre-reward-status {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--torre-muted);
}

.torre-content-section {
  padding: 18px 0;
}

.torre-content-section h2 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  margin-bottom: 10px;
}

.torre-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  font-size: 1.02rem;
}

.torre-link-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.torre-site-footer {
  padding: 18px 0 26px;
  color: var(--torre-muted);
}

@media (max-width: 560px) {
  .torre-stage {
    height: min(66vh, 540px);
  }

  .torre-topbar {
    padding: 10px 10px;
  }

  .torre-stat strong {
    font-size: 1.05rem;
  }

  body.pug-torre-page .torre-screen[data-torre-start-screen],
  body.pug-torre-embed .torre-screen[data-torre-start-screen] {
    padding: 10px;
  }

  body.pug-torre-page [data-torre-start-screen] .torre-panel,
  body.pug-torre-embed [data-torre-start-screen] .torre-panel {
    width: min(100%, calc(100vw - 30px)) !important;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 14px !important;
    text-align: center;
  }

  body.pug-torre-page [data-torre-start-screen] .torre-start-visual,
  body.pug-torre-embed [data-torre-start-screen] .torre-start-visual {
    grid-row: auto;
    width: min(42vw, 150px);
  }

  body.pug-torre-page [data-torre-start-screen] .torre-panel h1,
  body.pug-torre-page [data-torre-start-screen] .torre-panel h2,
  body.pug-torre-embed [data-torre-start-screen] .torre-panel h1,
  body.pug-torre-embed [data-torre-start-screen] .torre-panel h2 {
    font-size: clamp(1.35rem, 8vw, 1.85rem) !important;
  }

  body.pug-torre-page [data-torre-start-screen] .torre-rules,
  body.pug-torre-embed [data-torre-start-screen] .torre-rules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    font-size: 0.76rem;
  }

  body.pug-torre-page [data-torre-start-screen] .torre-rules li,
  body.pug-torre-embed [data-torre-start-screen] .torre-rules li {
    padding: 6px 5px;
  }

  body.pug-torre-page [data-torre-start-screen] .torre-actions,
  body.pug-torre-embed [data-torre-start-screen] .torre-actions {
    justify-content: center;
    gap: 7px;
    margin-top: 2px;
  }

  body.pug-torre-page [data-torre-start-screen] .torre-actions .torre-button.primary,
  body.pug-torre-embed [data-torre-start-screen] .torre-actions .torre-button.primary {
    min-height: 48px;
    font-size: 1.08rem;
  }

  body.pug-torre-page [data-torre-start-screen] .torre-actions .torre-button.secondary,
  body.pug-torre-embed [data-torre-start-screen] .torre-actions .torre-button.secondary {
    display: none;
  }

  .torre-screen[data-torre-end-screen] {
    align-items: flex-start;
    padding: 10px;
    overflow-x: hidden;
  }

  .torre-screen[data-torre-end-screen] .torre-panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    padding: 14px !important;
    overflow-x: hidden;
  }

  .torre-screen[data-torre-end-screen] .torre-result-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .torre-screen[data-torre-end-screen] .dm-end-cta {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 10px;
    overflow: hidden;
  }

  .torre-screen[data-torre-end-screen] .dm-end-cta-grid {
    grid-template-columns: 1fr !important;
  }

  .torre-screen[data-torre-end-screen] .dm-end-cta-link {
    grid-template-columns: 58px minmax(0, 1fr);
    min-height: 72px;
    padding: 8px;
  }

  .torre-screen[data-torre-end-screen] .dm-end-cta-thumb {
    width: 52px;
    height: 52px;
  }

  .torre-screen[data-torre-end-screen] .dm-end-cta-copy strong,
  .torre-screen[data-torre-end-screen] .dm-end-cta-copy span {
    overflow-wrap: break-word;
    word-break: normal;
    writing-mode: horizontal-tb;
  }

  .torre-screen[data-torre-end-screen] .dm-end-cta-copy strong {
    font-size: 0.9rem;
  }

  .torre-screen[data-torre-end-screen] .dm-end-cta-copy span {
    font-size: 0.74rem;
  }
}
