:root {
  --purple: #5b2c83;
  --purple-dark: #3d1a5c;
  --pink: #c4427e;
  --pink-light: #f6b3d0;
  --ink: #444444;
  --cream: #fff8fc;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #1d0f2e;
  overscroll-behavior: none;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #efe6fb;
}

canvas#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* HUD */
#hud {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 3;
}
.hud-left { color: var(--purple-dark); text-shadow: 0 1px 0 rgba(255,255,255,0.8); }
.hud-big { font-size: 34px; font-weight: 800; line-height: 1; }
.hud-big small { font-size: 16px; font-weight: 700; }
.hud-small { font-size: 18px; font-weight: 800; margin-top: 2px; }
.tickdot {
  display: inline-block;
  width: 22px; height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font-size: 14px;
  vertical-align: 1px;
}
.tokdot {
  display: inline-block;
  width: 22px; height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-size: 13px;
  box-shadow: inset 0 0 0 2px var(--pink);
  vertical-align: 1px;
  margin-left: 6px;
}
#chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
}
.chip {
  background: rgba(91, 44, 131, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}
.icon-btn {
  pointer-events: auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.88);
  color: var(--purple);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: rgba(40, 16, 66, 0.45);
  z-index: 5;
  overflow-y: auto;
}
.card {
  width: 100%;
  max-width: 340px;
  margin: auto;
  background: var(--cream);
  border-radius: 26px;
  padding: 22px 20px 16px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  border: 4px solid var(--purple);
}
.brand {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 4px;
  font-weight: 800;
  color: var(--pink);
}
img.logo { display: block; width: 72px; height: 72px; margin: 0 auto 6px; }
h1 {
  margin: 0;
  font-size: 46px;
  line-height: 0.95;
  color: var(--purple);
  font-weight: 900;
  letter-spacing: -1px;
}
h1 .h1-top { display: block; color: var(--pink); font-size: 56px; }
h2 {
  margin: 0;
  font-size: 34px;
  color: var(--purple);
  font-weight: 900;
}
.tag { margin: 8px 0 14px; font-size: 15px; font-weight: 600; }
.btn {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 13px 14px;
  border: 3px solid var(--purple);
  border-radius: 16px;
  background: #fff;
  color: var(--purple);
  font: inherit;
  font-size: 17px;
  font-weight: 800;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #d9558f, var(--pink));
  color: #fff;
  border-color: var(--purple);
  font-size: 22px;
  padding: 15px 14px;
  box-shadow: 0 4px 0 var(--purple);
}
.btn.small { font-size: 14px; padding: 10px 8px; }
.row { display: flex; gap: 8px; }
.how {
  list-style: none;
  margin: 14px 0 6px;
  padding: 0;
  text-align: left;
  font-size: 13px;
  line-height: 1.35;
}
.how li { padding: 3px 0 3px 18px; position: relative; }
.how li::before {
  content: "";
  position: absolute;
  left: 2px; top: 9px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pink);
}
.best { margin: 8px 0 2px; font-size: 15px; font-weight: 800; color: var(--purple); }
.hint { margin: 2px 0; font-size: 12px; opacity: 0.75; }
.foot { margin: 6px 0 0; font-size: 12px; }
.foot a { color: var(--purple); }
.stats {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 4px 0 8px;
}
.stats div {
  flex: 1;
  background: #f1e6f8;
  border-radius: 14px;
  padding: 8px 4px;
  color: var(--purple);
  font-weight: 900;
}
.stats div span { display: block; font-size: 24px; line-height: 1.1; }
.stats div small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.stats div.big { background: var(--pink); color: #fff; flex: 1.3; }

/* Privacy page */
html.page { height: auto; overflow: auto; background: var(--cream); }
html.page body {
  display: block;
  overflow: auto;
  background: var(--cream);
  height: auto;
  min-height: 100%;
  -webkit-user-select: text;
  user-select: text;
}
.page main { max-width: 640px; margin: 0 auto; padding: 24px 18px 40px; line-height: 1.5; }
.page h1 { font-size: 32px; letter-spacing: 0; }
.page h2 { font-size: 20px; margin-top: 22px; }
.page a { color: var(--purple); font-weight: 700; }
