:root {
  font-family: ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
  color: #493872;
  background: #eadfff;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 15%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 80% 70%, #fff 0 2px, transparent 3px),
    linear-gradient(145deg, #d9caff, #ffe1f0 52%, #c7f3ff);
  background-size: 90px 90px, 130px 130px, auto;
}

button { font: inherit; }

.game-shell {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #cce8ff;
  box-shadow: 0 30px 100px rgba(81, 54, 134, .26);
}

canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.card {
  position: absolute;
  left: clamp(22px, 5.5%, 58px);
  top: 50%;
  width: min(430px, 48%);
  transform: translateY(-50%);
  padding: clamp(20px, 3vw, 34px) clamp(22px, 3.5vw, 38px) 24px;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 32px;
  background: rgba(255, 251, 255, .96);
  box-shadow: 0 18px 50px rgba(87, 64, 139, .2), inset 0 0 0 1px rgba(135,93,190,.1);
  transition: opacity .25s, transform .25s;
}

.card.hidden { opacity: 0; pointer-events: none; transform: translateY(-46%) scale(.96); }
.eyebrow { color: #ab79d2; font-size: 12px; font-weight: 800; letter-spacing: .18em; }

h1 {
  margin: 4px 0 8px;
  font-family: ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
  font-size: clamp(46px, 6vw, 70px);
  line-height: .78;
  letter-spacing: -.045em;
  color: #59407e;
}

h1 span { color: #e76fa8; }
.story { max-width: 350px; margin: 15px 0 18px; color: #6e6187; font-size: clamp(12px, 1.5vw, 15px); line-height: 1.45; }

.customizer { margin: 0 0 17px; padding: 14px 16px 10px; border-radius: 20px; background: rgba(235,224,255,.68); }
.customizer h2 { margin: 0 0 7px; font-family: ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif; font-size: 16px; }
.choice-row { display: grid; grid-template-columns: 48px 1fr; align-items: center; min-height: 35px; }
.choice-row > span { font-size: 11px; font-weight: 800; color: #776595; text-transform: uppercase; letter-spacing: .07em; }
.swatches { display: flex; gap: 9px; }

.swatch {
  width: 25px; height: 25px; padding: 0; border: 3px solid #fff; border-radius: 50%; cursor: pointer;
  background: var(--color); box-shadow: 0 2px 7px rgba(75,52,108,.18); transition: transform .12s, outline .12s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.selected { outline: 3px solid #8560b4; transform: scale(1.08); }

.primary {
  width: 100%; min-height: 50px; border: 0; border-radius: 17px; cursor: pointer; color: white;
  background: linear-gradient(135deg, #a174d1, #e678b1); box-shadow: 0 9px 20px rgba(197, 96, 164, .28);
  font-family: ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif; font-size: 18px; font-weight: 800; transition: transform .12s, box-shadow .12s;
}
.primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(197, 96, 164, .35); }
.primary:active { transform: translateY(1px); }
.primary span { float: right; padding-right: 10px; font-size: 22px; }
.hint { margin: 11px 0 0; text-align: center; color: #8a7b9e; font-size: 10px; font-weight: 800; letter-spacing: .05em; }
kbd { padding: 3px 7px; border-radius: 6px; background: #fff; box-shadow: 0 2px 0 #d5c8e5; }

.round-btn {
  position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border: 2px solid rgba(255,255,255,.85);
  border-radius: 50%; cursor: pointer; color: #765c9f; background: rgba(255,255,255,.7); box-shadow: 0 5px 15px rgba(83,63,130,.12);
}
.full-btn { right: 60px; }

.game-menu-btn {
  position: absolute;
  z-index: 2;
  right: 16px;
  top: 66px;
  min-height: 40px;
  padding: 7px 14px 7px 10px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 20px;
  cursor: pointer;
  color: #684c91;
  background: rgba(255,255,255,.88);
  box-shadow: 0 5px 15px rgba(83,63,130,.15);
  font-size: 13px;
  font-weight: 800;
  transition: opacity .2s, transform .12s;
}
.game-menu-btn span { margin-right: 4px; font-size: 18px; line-height: 0; }
.game-menu-btn:hover { transform: translateY(-2px); }
.game-menu-btn:active { transform: translateY(1px); }
.game-menu-btn.hidden { opacity: 0; pointer-events: none; }

.win-card { left: 50%; width: min(390px, 80%); text-align: center; transform: translate(-50%, -50%); }
.win-card.hidden { transform: translate(-50%, -45%) scale(.96); }
.win-card .story { margin-left: auto; margin-right: auto; }
.crown { font-size: 42px; color: #f6b842; filter: drop-shadow(0 4px 5px rgba(180,112,31,.2)); }

@media (max-width: 680px), (max-height: 520px) {
  .card { width: min(390px, 56%); padding: 16px 20px; border-radius: 24px; }
  .story { margin: 7px 0 10px; }
  .customizer { padding: 8px 12px 6px; margin-bottom: 10px; }
  .choice-row { min-height: 29px; }
  .swatch { width: 21px; height: 21px; }
  .primary { min-height: 42px; font-size: 15px; }
  .hint { margin-top: 7px; }
  .game-menu-btn { top: 60px; min-height: 36px; padding: 5px 11px 5px 8px; font-size: 11px; }
}
