/* Rapper or Malware? : retro 80s synthwave arcade style */
:root {
  --night: #0d0221;
  --purple: #261447;
  --pink: #ff2a6d;
  --cyan: #05d9e8;
  --yellow: #f9f871;
  --orange: #ff8b3d;
  --green: #39ff14;
  --text: #f4e9ff;
  --muted: #b9a7d6;
  --font: "Courier New", Courier, "Lucida Console", Monaco, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ---------- Background: sunset + neon grid ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, #0d0221 0%, #261447 45%, #6b1d5c 62%, #0d0221 62.2%);
  overflow: hidden;
}

.sun {
  position: absolute;
  left: 50%;
  bottom: 38%;
  width: min(70vw, 460px);
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--yellow) 0%, var(--orange) 45%, var(--pink) 100%);
  -webkit-mask: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 18px);
          mask: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 18px);
  filter: drop-shadow(0 0 40px rgba(255, 42, 109, .6));
  opacity: .45;
}

.grid {
  position: absolute;
  left: -50%;
  right: -50%;
  top: 62%;
  height: 80%;
  background-image:
    linear-gradient(var(--pink) 2px, transparent 2px),
    linear-gradient(90deg, var(--pink) 2px, transparent 2px);
  background-size: 60px 60px;
  transform: perspective(300px) rotateX(60deg);
  transform-origin: top center;
  opacity: .55;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 2px, transparent 2px 4px);
}

/* ---------- Layout ---------- */
.cabinet {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px 16px 40px;
  min-height: 100%;
}

.screen { display: none; text-align: center; }
.screen.active { display: block; }

/* ---------- Title ---------- */
.logo {
  margin: 0 0 12px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .04em;
}
.logo span { display: block; }
.logo-top, .logo-bottom {
  font-size: clamp(44px, 12vw, 96px);
  font-style: italic;
  background: linear-gradient(180deg, #fff 0%, #a7f3ff 40%, #2b2bff 52%, #ff9de2 70%, #fff 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,.4);
  filter: drop-shadow(0 0 6px var(--cyan)) drop-shadow(0 4px 0 var(--pink));
}
.logo-or {
  font-size: clamp(28px, 7vw, 48px);
  color: var(--pink);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  text-shadow: 0 0 8px var(--pink), 0 0 20px var(--pink);
  margin: 4px 0;
}

.tagline { display: inline-block; padding: 4px 10px; background: rgba(13,2,33,.75); color: var(--yellow); font-size: 20px; margin: 20px 0; text-shadow: 0 0 6px rgba(249,248,113,.5); }

.howto {
  list-style: none;
  padding: 16px;
  margin: 0 auto 28px;
  max-width: 460px;
  text-align: left;
  border: 2px solid var(--cyan);
  background: rgba(13, 2, 33, .75);
  box-shadow: 0 0 12px rgba(5,217,232,.5), inset 0 0 12px rgba(5,217,232,.2);
}
.howto li::before { content: "\25B6  "; color: var(--pink); }
.pink { color: var(--pink); }
.cyan { color: var(--cyan); }

.hiscore { display: table; margin-left: auto; margin-right: auto; padding: 2px 10px; background: rgba(13,2,33,.75); color: var(--yellow); letter-spacing: .1em; margin-top: 20px; }
.keys { color: var(--muted); font-size: 15px; }
kbd {
  border: 1px solid var(--muted);
  border-radius: 3px;
  padding: 0 6px;
  font-family: var(--font);
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: .12em;
  color: var(--text);
  background: rgba(13, 2, 33, .85);
  border: 3px solid currentColor;
  padding: 14px 28px;
  min-height: 56px;
  cursor: pointer;
  text-transform: uppercase;
}
a.btn { display: inline-block; text-decoration: none; }
.btn:hover { filter: brightness(1.25); }
.btn:active { transform: translateY(2px); }
.btn:focus-visible, .sound:focus-visible, .review summary:focus-visible {
  outline: 3px dashed var(--yellow);
  outline-offset: 4px;
}
.btn:disabled { cursor: default; }

.btn-start {
  color: var(--yellow);
  box-shadow: 0 0 14px var(--yellow), inset 0 0 10px rgba(249,248,113,.4);
  text-shadow: 0 0 6px var(--yellow);
}

.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}
.btn-rapper {
  color: var(--pink);
  box-shadow: 0 0 14px var(--pink), inset 0 0 10px rgba(255,42,109,.4);
  text-shadow: 0 0 6px var(--pink);
  font-size: 26px;
}
.btn-malware {
  color: var(--cyan);
  box-shadow: 0 0 14px var(--cyan), inset 0 0 10px rgba(5,217,232,.4);
  text-shadow: 0 0 6px var(--cyan);
  font-size: 26px;
}
.btn.picked { background: currentColor; }
.btn.picked { color: var(--night) !important; text-shadow: none; }
.btn-rapper.picked { background: var(--pink); }
.btn-malware.picked { background: var(--cyan); }
.btn.faded { opacity: .35; }

/* Keyboard hints, shown on the buttons while playing */
.key-hint {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  letter-spacing: .06em;
  font-weight: 700;
  text-shadow: none;
  opacity: .9;
}
.key-hint kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 5px;
  border: 2px solid currentColor;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.3;
}
.btn-next .key-hint { display: inline-block; margin: 0 0 0 10px; }
.keys-reminder { margin: 14px 0 0; }
.keys-reminder[hidden] { display: none; }

/* Phones and tablets have no keyboard, so hide the hints there */
@media (hover: none) and (pointer: coarse) {
  .key-hint, .keys-reminder { display: none; }
}

.btn-next {
  color: var(--green);
  box-shadow: 0 0 14px var(--green), inset 0 0 10px rgba(57,255,20,.3);
  text-shadow: 0 0 6px var(--green);
  margin-top: 8px;
}

.sound {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(13,2,33,.8);
  border: 2px solid var(--muted);
  padding: 8px 12px;
  min-height: 44px;
  cursor: pointer;
}

/* ---------- Game ---------- */
.hud {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--yellow);
  font-size: 18px;
  letter-spacing: .08em;
  text-shadow: 0 0 6px rgba(249,248,113,.6);
}
.hud b { color: #fff; }
.hud span { white-space: nowrap; }
@media (max-width: 599px) {
  .hud { display: grid; grid-template-columns: auto auto; gap: 4px 12px; font-size: 16px; letter-spacing: .04em; }
  .hud span:nth-child(even) { text-align: right; }
}

.progress {
  height: 10px;
  margin: 8px 0 20px;
  border: 2px solid var(--yellow);
  background: rgba(13,2,33,.8);
}
.bar {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--yellow) 0 10px, var(--orange) 10px 12px);
  transition: width .3s;
}

.terminal {
  border: 3px solid var(--green);
  background: rgba(0, 12, 0, .88);
  padding: 20px 16px 28px;
  box-shadow: 0 0 18px rgba(57,255,20,.45), inset 0 0 30px rgba(57,255,20,.15);
  text-align: left;
}
.prompt { margin: 0; color: var(--green); font-size: 16px; opacity: .8; }
.name {
  margin: 10px 0 0;
  text-align: center;
  color: var(--green);
  font-size: clamp(30px, 8vw, 54px);
  font-weight: 900;
  line-height: 1.15;
  word-break: break-word;
  text-shadow: 0 0 8px var(--green), 0 0 24px rgba(57,255,20,.6);
}
.name::after {
  content: "_";
  margin-left: 4px;
}

.feedback {
  margin-top: 20px;
  padding: 18px 16px 22px;
  border: 3px solid var(--muted);
  background: rgba(13,2,33,.9);
}
.feedback.right { border-color: var(--green); box-shadow: 0 0 16px rgba(57,255,20,.5); }
.feedback.wrong { border-color: var(--pink); box-shadow: 0 0 16px rgba(255,42,109,.6); }
.verdict { margin: 0; font-size: 34px; font-weight: 900; letter-spacing: .1em; }
.right .verdict { color: var(--green); text-shadow: 0 0 10px var(--green); }
.wrong .verdict { color: var(--pink); text-shadow: 0 0 10px var(--pink); }
.reveal { margin: 6px 0 10px; color: var(--yellow); font-weight: 700; }
.desc { margin: 0 0 16px; text-align: left; font-size: 19px; }

/* ---------- Game over ---------- */
#screen-end.active {
  padding: 24px 16px;
  background: rgba(13,2,33,.82);
  border: 3px solid var(--pink);
  box-shadow: 0 0 18px rgba(255,42,109,.5);
}
.gameover {
  margin: 0;
  font-size: clamp(42px, 11vw, 80px);
  font-style: italic;
  color: var(--pink);
  text-shadow: 0 0 10px var(--pink), 0 0 30px var(--pink), 4px 4px 0 var(--cyan);
}
.final { margin: 12px 0 0; font-size: 72px; font-weight: 900; color: var(--yellow); text-shadow: 0 0 14px var(--orange); line-height: 1; }
.final .of { font-size: 36px; color: var(--muted); text-shadow: none; }
.rank { font-size: 24px; color: var(--cyan); text-shadow: 0 0 8px var(--cyan); letter-spacing: .1em; font-weight: 900; }
.new-high { color: var(--green); font-weight: 900; font-size: 22px; }

.stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 0;
}
.stats div {
  flex: 1;
  max-width: 220px;
  border: 2px solid var(--cyan);
  padding: 8px 6px;
  box-shadow: 0 0 10px rgba(5,217,232,.4);
}
.stats dt { color: var(--muted); font-size: 14px; letter-spacing: .08em; }
.stats dd { margin: 4px 0 0; font-size: 44px; line-height: 1.1; font-weight: 900; color: var(--yellow); text-shadow: 0 0 12px var(--orange); }

.history {
  margin: 28px auto 0;
  text-align: left;
  border: 2px solid var(--yellow);
  padding: 12px 16px 16px;
}
.history h3 { margin: 0; color: var(--yellow); font-size: 20px; letter-spacing: .1em; }
.history-note { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.history table { width: 100%; border-collapse: collapse; font-size: 17px; }
.history th { color: var(--cyan); text-align: left; font-size: 14px; letter-spacing: .08em; border-bottom: 2px solid var(--cyan); padding: 4px 6px; }
.history td { padding: 6px; border-bottom: 1px dashed rgba(185,167,214,.4); }
.history tr.latest td { color: var(--green); font-weight: 900; }
.btn-small {
  font-size: 15px;
  min-height: 44px;
  padding: 8px 14px;
  margin-top: 12px;
  color: var(--muted);
}

.review {
  margin: 28px auto 0;
  text-align: left;
  background: rgba(13,2,33,.88);
  border: 2px solid var(--muted);
  padding: 12px 16px;
}
.review summary { cursor: pointer; font-weight: 900; color: var(--yellow); min-height: 44px; display: flex; align-items: center; }
.review ol { padding-left: 28px; margin: 8px 0 0; }
.review li { margin-bottom: 12px; }
.review .ok { color: var(--green); }
.review .no { color: var(--pink); }
.review small { display: block; color: var(--muted); font-size: 15px; }

.noscript { text-align: center; color: var(--yellow); }

/* ---------- Larger screens ---------- */
@media (min-width: 600px) {
  .choices { grid-template-columns: 1fr 1fr; }
  .btn-rapper, .btn-malware { min-height: 90px; font-size: 30px; }
}

/* ---------- Motion (only when the player hasn't asked for less) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .grid { animation: grid-scroll 1.2s linear infinite; }
  @keyframes grid-scroll { to { background-position: 0 60px, 0 0; } }

  .name::after { animation: blink 1s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }

  .btn-start { animation: pulse 1.6s ease-in-out infinite; }
  @keyframes pulse { 50% { box-shadow: 0 0 28px var(--yellow), inset 0 0 14px rgba(249,248,113,.6); } }

  .screen.active { animation: boot .35s ease-out; }
  @keyframes boot { from { opacity: 0; transform: scaleY(.02); } to { opacity: 1; transform: none; } }

  .feedback:not([hidden]) { animation: pop .25s ease-out; }
  @keyframes pop { from { opacity: 0; transform: translateY(8px); } }

  .wrong .verdict { animation: shake .4s; }
  @keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
}
