:root {
  --pink: #ff8fab;
  --pink-soft: #ffe1ea;
  --brown: #3b221d;
  --shadow: 0 24px 60px rgba(120, 55, 75, .18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 143, 171, .35), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(200, 247, 226, .45), transparent 35rem),
    linear-gradient(135deg, #fff7fa 0%, #fffaf1 100%);
  color: var(--brown);
}

.page-shell {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.game-card {
  width: min(1160px, 100%);
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: stretch;
}

.brand-panel,
#game-wrap {
  background: rgba(255, 255, 255, .84);
  border: 2px solid rgba(255, 143, 171, .35);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.brand-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-logo {
  width: 98px;
  height: 98px;
  object-fit: contain;
  border-radius: 24px;
  background: #fff;
  padding: 6px;
  margin-bottom: 12px;
  box-shadow: 0 14px 28px rgba(120, 55, 75, .12);
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--pink-soft);
  color: #b64665;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 14px 0 10px;
  font-size: clamp(34px, 4vw, 54px);
  line-height: .95;
  color: #44231d;
  letter-spacing: -0.04em;
}

p {
  margin: 0;
  color: #7a5751;
  line-height: 1.55;
  font-weight: 700;
}

.tips {
  margin-top: 20px;
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff, #fff0f5);
  border: 1px solid rgba(255, 143, 171, .28);
}

.tips strong {
  color: #b64665;
}

.control-row {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 10px;
}

.control-label {
  font-size: 14px;
  font-weight: 900;
  color: #6f4d47;
}

.arrow-pad {
  display: grid;
  grid-template-columns: repeat(3, 36px);
  grid-template-rows: repeat(2, 36px);
  gap: 8px;
  align-items: center;
}

.keycap,
.pad-empty {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 950;
  font-size: 16px;
}

.keycap {
  background: linear-gradient(180deg, #ffffff 0%, #ffe8ef 100%);
  border: 1px solid rgba(255, 143, 171, .35);
  color: #b64665;
  box-shadow:
    inset 0 -2px 0 rgba(255, 143, 171, .18),
    0 8px 16px rgba(120, 55, 75, .10);
}

.pad-empty {
  background: transparent;
  box-shadow: none;
  border: 0;
}

.sound-button {
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  padding: 11px 14px;
  background: linear-gradient(135deg, #ff8fab, #ffadc2);
  color: #fff;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(120, 55, 75, .18);
}

.sound-button:active {
  transform: scale(.98);
}

#game-wrap {
  position: relative;
  padding: 14px;
  overflow: hidden;
}

#game canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
}

.mobile-controls {
  position: absolute;
  right: 24px;
  bottom: 24px;
  display: none;
  gap: 8px;
  flex-direction: column;
  align-items: center;
  z-index: 5;
  user-select: none;
}

.mobile-controls div {
  display: flex;
  gap: 8px;
}

.mobile-controls button {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 143, 171, .92);
  color: white;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(120, 55, 75, .22);
}

.mobile-controls button:active {
  transform: scale(.94);
}

.html-start-panel,
.html-end-panel {
  position: absolute;
  left: 50%;
  top: calc(50% + 150px);
  transform: translateX(-50%);
  z-index: 220;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: min(92%, 560px);
  pointer-events: auto;
}

.html-start-panel input {
  min-width: 210px;
  flex: 1 1 220px;
  height: 52px;
  border: 2px solid rgba(255, 143, 171, .48);
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 900;
  font-size: 15px;
  color: #4b2b25;
  outline: none;
  background: #fff;
  box-shadow: 0 10px 20px rgba(120, 55, 75, .08);
}

.html-start-panel input:focus {
  border-color: #ff8fab;
  box-shadow: 0 0 0 4px rgba(255, 143, 171, .15);
}

.html-start-panel button,
.html-end-panel button {
  min-width: 118px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 950;
  font-size: 15px;
  background: linear-gradient(135deg, #ff8fab, #ffadc2);
  color: #fff;
  box-shadow: 0 12px 24px rgba(120, 55, 75, .18);
  cursor: pointer;
  white-space: nowrap;
}

.html-start-panel button:active,
.html-end-panel button:active {
  transform: scale(.97);
}

.html-end-panel {
  top: calc(50% + 145px);
}

/* Movil compacto: menos scroll, controles bajo el juego */
@media (max-width: 900px) {
  html,
  body {
    min-height: 100%;
    overflow-x: hidden;
  }

  .page-shell {
    min-height: 100dvh;
    padding: 6px;
    display: block;
  }

  .game-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
  }

  .brand-panel {
    padding: 7px 9px;
    border-radius: 18px;
    gap: 7px;
  }

  .brand-copy {
    display: grid;
    grid-template-columns: 46px 1fr;
    grid-template-areas:
      "logo eyebrow"
      "logo title";
    column-gap: 8px;
    align-items: center;
  }

  .brand-logo {
    grid-area: logo;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    margin: 0;
    padding: 3px;
  }

  .eyebrow {
    grid-area: eyebrow;
    padding: 4px 8px;
    font-size: 9px;
  }

  h1 {
    grid-area: title;
    margin: 0;
    font-size: 21px;
    line-height: 1;
  }

  p {
    display: none;
  }

  .tips {
    margin-top: 0;
    padding: 7px;
    border-radius: 15px;
    gap: 5px;
  }

  .tips strong {
    font-size: 12px;
  }

  .control-row {
    grid-template-columns: 44px 1fr;
    gap: 5px;
  }

  .control-label {
    font-size: 11px;
  }

  .arrow-pad {
    grid-template-columns: repeat(3, 25px);
    grid-template-rows: repeat(2, 25px);
    gap: 5px;
  }

  .keycap,
  .pad-empty {
    width: 25px;
    height: 25px;
    border-radius: 8px;
    font-size: 12px;
  }

  .sound-button {
    margin-top: 0;
    padding: 7px 10px;
    font-size: 12px;
  }

  #game-wrap {
    padding: 7px;
    border-radius: 18px;
    overflow: visible;
  }

  #game canvas {
    border-radius: 14px;
  }

  .mobile-controls {
    position: static;
    display: flex;
    margin: 8px auto 2px;
    width: fit-content;
    transform: none;
  }

  .mobile-controls button {
    width: 54px;
    height: 46px;
    border-radius: 16px;
    font-size: 19px;
  }

  .html-start-panel,
.html-end-panel {
  position: absolute;
  left: 50%;
  top: calc(50% + 150px);
  transform: translateX(-50%);
  z-index: 220;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: min(92%, 560px);
  pointer-events: auto;
}

.html-start-panel input {
  min-width: 210px;
  flex: 1 1 220px;
  height: 52px;
  border: 2px solid rgba(255, 143, 171, .48);
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 900;
  font-size: 15px;
  color: #4b2b25;
  outline: none;
  background: #fff;
  box-shadow: 0 10px 20px rgba(120, 55, 75, .08);
}

.html-start-panel input:focus {
  border-color: #ff8fab;
  box-shadow: 0 0 0 4px rgba(255, 143, 171, .15);
}

.html-start-panel button,
.html-end-panel button {
  min-width: 118px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 950;
  font-size: 15px;
  background: linear-gradient(135deg, #ff8fab, #ffadc2);
  color: #fff;
  box-shadow: 0 12px 24px rgba(120, 55, 75, .18);
  cursor: pointer;
  white-space: nowrap;
}

.html-start-panel button:active,
.html-end-panel button:active {
  transform: scale(.97);
}

.html-end-panel {
  top: calc(50% + 145px);
}

@media (max-width: 430px) {
  .page-shell {
    padding: 5px;
  }

  h1 {
    font-size: 20px;
  }

  .brand-panel {
    padding: 7px;
  }

  .tips {
    gap: 5px;
  }

  .mobile-controls {
    margin-top: 7px;
  }

  .mobile-controls button {
    width: 50px;
    height: 43px;
  }

  .html-start-panel,
  .html-end-panel {
    top: calc(50% + 128px);
    width: min(96%, 360px);
  }

  .html-start-panel input {
    flex: 1 1 100%;
    width: 100%;
  }

  .html-start-panel button,
  .html-end-panel button {
    min-width: 128px;
  }
}

#game-wrap { touch-action: none; }
