:root {
  --ink: #1b1b22;
  --paper: #fff8ee;
  --yellow: #ffe14a;
  --pink: #ff5d8f;
  --mint: #8eedb0;
  --sky: #4cc9f0;
  --violet: #8b6cff;
  color: var(--ink);
  font-family: "Trebuchet MS", "Verdana", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #9fd0ff;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

button, input[type="range"] { font: inherit; }

.panel {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 7px 7px 0 var(--ink);
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 4vh 6vw;
  pointer-events: none;
}

.screen .panel { pointer-events: auto; }

.hidden { display: none !important; }

.menu-card {
  width: min(460px, 92vw);
  padding: 28px 28px 22px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 8px;
}

.brand-hole {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #07010f 0 42%, #6d4aff 46% 58%, #3de0ff 62% 70%, transparent 72%),
    conic-gradient(from 20deg, #ff5d8f, #ffe14a, #8ac926, #4cc9f0, #b5179e, #ff5d8f);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  animation: spin 8s linear infinite;
}

@keyframes spin { to { transform: rotate(1turn); } }

h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: -1px;
  line-height: 0.9;
}

.tag {
  margin: 8px 0 16px;
  font-size: 15px;
  line-height: 1.35;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.choice, .btn {
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  text-align: left;
}

.choice strong, .btn { display: block; }

.choice span, .muted {
  display: block;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.75;
  margin-top: 2px;
}

.choice.active {
  background: var(--yellow);
  transform: translate(-1px, -1px);
}

.btn {
  width: 100%;
  text-align: center;
  font-weight: 800;
  font-size: 18px;
  margin-top: 8px;
}

.btn:hover, .choice:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active, .choice:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }

.btn.play { background: var(--yellow); }
.btn.mint { background: var(--mint); }
.btn.sky { background: var(--sky); }
.btn.pink { background: var(--pink); color: white; }
.btn.violet { background: var(--violet); color: white; }

.credits {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.4;
}

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: 16px;
}

.hud-top {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: space-between;
  margin-right: 168px;
}

.touch-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 40;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff3bf;
  color: var(--ink);
  font-weight: 800;
  padding: 10px 12px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}

.touch-toggle.active {
  background: #8b6cff;
  color: white;
}

.joystick {
  position: fixed;
  right: 48px;
  bottom: 56px;
  z-index: 25;
  width: min(42vw, 220px);
  height: min(42vw, 220px);
  touch-action: none;
}

.joy-base {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid rgba(27, 27, 34, 0.85);
  background: rgba(255, 248, 238, 0.28);
  box-shadow: inset 0 0 0 10px rgba(139, 108, 255, 0.28);
}

.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 40% 35%, #fff, #8b6cff 42%, #2a2148 78%);
  border: 3px solid var(--ink);
  pointer-events: none;
}

.pill {
  pointer-events: none;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 8px 12px;
  min-width: 140px;
}

.pill b { display: block; font-size: 18px; }
.pill small { font-size: 12px; font-weight: 700; }
.pill.rival { min-width: 124px; background: #f3ffe8; }
.pill.rival b { color: #178a3a; }

.grow {
  flex: 1;
  max-width: 460px;
}

.bar {
  height: 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: white;
  margin-top: 6px;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff5d8f, #ffe14a, #8ac926, #4cc9f0);
}

.hud-btn {
  pointer-events: auto;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.hint {
  position: absolute;
  left: 16px;
  bottom: 208px;
  max-width: 360px;
  padding: 10px 12px;
  font-size: 14px;
}

.minimap-wrap {
  position: absolute;
  left: 16px;
  bottom: 16px;
  padding: 8px;
}

#minimap {
  width: 168px;
  height: 168px;
  display: block;
  border-radius: 12px;
  background: #67c25b;
}

.overlay-center {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 16, 32, 0.28);
  padding: 20px;
}

.overlay-center .panel { width: min(440px, 94vw); padding: 22px; }

.slider {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  font-weight: 700;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
  margin: 8px 0 14px;
}

#toast {
  position: fixed;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  background: #ff5d8f;
  color: white;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--ink);
  pointer-events: none;
}

.floater {
  position: fixed;
  pointer-events: none;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 0 #1b1b22, 2px 0 0 #1b1b22;
  animation: pop 800ms ease forwards;
  z-index: 5;
}

@keyframes pop {
  from { transform: translate(-50%, 0); opacity: 1; }
  to { transform: translate(-50%, -36px); opacity: 0; }
}

.loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #ffd6e8, #fff3bf 40%, #b8f2ff);
  z-index: 20;
}

.loading .bar { width: min(320px, 80vw); background: white; }
.loading p { font-weight: 800; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.stats div { background: white; border: 3px solid var(--ink); border-radius: 12px; padding: 8px; }
.stats b { display: block; font-size: 20px; }

.shop-panel { position: relative; padding-bottom: 58px; }
.shop-list { margin: 10px 0 4px; max-height: min(42vh, 360px); overflow: auto; }
.color-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--ink);
}
.color-row b { font-size: 15px; }
.color-row .btn {
  width: auto;
  margin: 0;
  font-size: 14px;
  padding: 6px 10px;
}
.color-row .btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: 3px 3px 0 var(--ink);
}
.coin-line { margin: 4px 0; font-weight: 900; font-size: 18px; }
.btn.hallo {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: auto;
  margin: 0;
  font-size: 13px;
  padding: 5px 9px;
  background: #efe7d6;
}
#pin-code {
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 10px;
  min-height: 42px;
}
#pin-note.bad { color: #d0124a; opacity: 1; font-weight: 800; }
#pin-note.good { color: #178a3a; opacity: 1; font-weight: 800; }
.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.pin-grid button {
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: white;
  font-weight: 900;
  font-size: 22px;
  padding: 10px 0;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
.level-up {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
  padding: 10px 14px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}

@media (max-width: 720px) {
  .screen { align-items: flex-end; padding: 12px; }
  h1 { font-size: 32px; }
  .hud-top { flex-wrap: wrap; }
  .grow { order: 3; flex-basis: 100%; max-width: none; }
  .hint { bottom: 148px; }
  .minimap-wrap, #minimap { width: 112px; height: 112px; }
}
