* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --tinta: #ffd166;
  --esfera: #59d9ff;
  --salida: #7dffce;
  --pinza: #ff5470;
  --dim: #8a93ad;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0906;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #f2f7ff;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  cursor: crosshair;
}

#hud {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 26px;
  pointer-events: none;
  z-index: 3;
}

.hud-left, .hud-right { display: flex; flex-direction: column; gap: 2px; }
.hud-right { text-align: right; }

.hud-label { font-size: 10px; letter-spacing: 3px; color: var(--dim); }

.hud-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--tinta);
  text-shadow: 0 0 12px rgba(255,209,102,.45);
  font-variant-numeric: tabular-nums;
}

.small-v { font-size: 16px; }
.dim2 { color: var(--dim); }

.hud-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.lvl-name {
  font-size: clamp(13px, 2vw, 17px);
  letter-spacing: 6px;
  text-transform: uppercase;
  color: #e6ecff;
}

#inkwrap {
  width: 240px;
  max-width: 34vw;
  height: 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,209,102,.5);
  background: rgba(255,209,102,.07);
  overflow: hidden;
}

#inkfill {
  height: 100%;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #ffb347, #ffd166, #ffe9b0);
  box-shadow: 0 0 14px rgba(255,209,102,.7);
  transition: width .08s linear;
}

#inkfill.low {
  background: linear-gradient(90deg, #ff5470, #ff9838);
  animation: inkBlink .5s steps(2) infinite;
}

@keyframes inkBlink { 50% { opacity: .45; } }

#hintbar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--dim);
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
  max-width: 94vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(14,11,20,.86) 0%, rgba(6,5,10,.97) 100%);
  z-index: 10;
  padding: 24px;
}

.hidden { display: none !important; }

.game-title {
  font-size: clamp(56px, 11vw, 110px);
  font-weight: 800;
  letter-spacing: 18px;
  line-height: 1;
  color: #f8fbff;
  margin-left: 18px;
}

.game-title span {
  color: var(--tinta);
  text-shadow: 0 0 28px var(--tinta), 0 0 70px rgba(255,209,102,.35);
}

.tagline {
  font-size: clamp(12px, 2vw, 17px);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--esfera);
}

.rules p { margin: 3px 0; color: #c6cce2; font-size: clamp(12px, 1.65vw, 14.5px); }
.rules strong { color: var(--tinta); }
.rules p:nth-child(1) strong { color: var(--tinta); }
.rules p:nth-child(2) strong { color: var(--esfera); }
.rules p:nth-child(3) strong { color: var(--salida); }
.rules p:nth-child(4) strong { color: var(--pinza); }
.rules p:nth-child(6) strong { color: #cfeef7; }

.chips {
  display: grid;
  grid-template-columns: repeat(7, 52px);
  gap: 9px;
  margin-top: 6px;
}

.chip {
  width: 52px;
  height: 44px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #eef3ff;
  background: rgba(255,209,102,.06);
  border: 1px solid rgba(255,209,102,.35);
  border-radius: 9px;
  cursor: pointer;
  transition: all .15s;
  pointer-events: auto;
}

.chip:hover { background: rgba(255,209,102,.18); transform: translateY(-2px); }

.chip.locked {
  color: #5a5f76;
  border-color: rgba(255,255,255,.09);
  background: rgba(255,255,255,.02);
  cursor: not-allowed;
}

.chip.locked:hover { transform: none; background: rgba(255,255,255,.02); }

.chip.done { border-color: rgba(125,255,206,.55); color: var(--salida); }
.chip.cur { box-shadow: 0 0 14px rgba(255,209,102,.5); border-color: var(--tinta); }

.btn {
  margin-top: 6px;
  padding: 14px 38px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  font-family: inherit;
  color: var(--tinta);
  background: transparent;
  border: 2px solid var(--tinta);
  border-radius: 40px;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 0 18px rgba(255,209,102,.2), inset 0 0 14px rgba(255,209,102,.06);
}

.btn:hover {
  background: rgba(255,209,102,.12);
  box-shadow: 0 0 30px rgba(255,209,102,.42), inset 0 0 18px rgba(255,209,102,.1);
}

.btn.secondary {
  color: #99a1bd;
  border-color: rgba(150,160,190,.5);
  box-shadow: none;
}

.btn.secondary:hover { background: rgba(150,160,190,.1); box-shadow: none; }

.btn-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.win-title {
  font-size: clamp(26px, 5.5vw, 46px);
  letter-spacing: 8px;
  color: var(--salida);
  text-shadow: 0 0 28px rgba(125,255,206,.45);
}

.stars {
  font-size: clamp(34px, 6vw, 56px);
  letter-spacing: 12px;
  color: var(--tinta);
  text-shadow: 0 0 24px rgba(255,209,102,.55);
}

.stars .off { opacity: .18; text-shadow: none; }

.final-wrap { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.final-label { font-size: 11px; letter-spacing: 4px; color: var(--dim); }

.final-score {
  font-size: clamp(38px, 7.5vw, 62px);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 24px rgba(255,255,255,.35);
  font-variant-numeric: tabular-nums;
}

.dim { color: #9aa4c0; font-size: 13px; letter-spacing: 1.5px; }

.best {
  min-height: 20px;
  font-size: 12.5px;
  letter-spacing: 2px;
  color: #ffd97a;
}
