html, body {
  margin: 0; height: 100%; background: #1a1420; color: #f8fbf4;
  font: 12px/1.4 ui-monospace, Menlo, monospace;
  overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none;
}
#stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#screen { image-rendering: pixelated; image-rendering: crisp-edges; background: #000; box-shadow: 0 0 0 4px #303642, 0 0 40px #f01a8055; }
#help { position: fixed; bottom: 6px; left: 0; right: 0; text-align: center; opacity: .55; margin: 0; pointer-events: none; }

#touch { display: none; position: fixed; inset: 0; pointer-events: none; }
body.touch #touch { display: block; }
body.touch #help { display: none; }
#stick {
  position: absolute; left: calc(env(safe-area-inset-left) + 18px); bottom: 18px; width: 120px; height: 120px; border-radius: 50%;
  background: #ffffff14; border: 2px solid #ffffff30; pointer-events: auto; opacity: .7;
}
#nub { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: #f01a80aa; }
/* A B C D in a diamond, like the controller: D top, C left, B right, A bottom (big) */
#btns { position: absolute; right: calc(env(safe-area-inset-right) + 14px); bottom: 12px; width: 168px; height: 168px; pointer-events: none; }
.b {
  position: absolute; pointer-events: auto; width: 56px; height: 56px; border-radius: 50%; opacity: .75;
  border: 2px solid #ffffff40; background: #5f7680; color: #f8fbf4; font: bold 18px ui-monospace, monospace;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 0;
}
.b small { font-size: 9px; font-weight: bold; margin-top: 3px; color: #fef37c; transition: opacity .6s; }
#touch.quiet .b small { opacity: 0; }
.b[data-act="d"] { left: 56px; top: 0; }
.b[data-act="c"] { left: 0; top: 54px; }
.b[data-act="b"] { right: 0; top: 54px; }
.b.big { width: 64px; height: 64px; left: 52px; bottom: 0; background: #f01a80; }
.b.pause { left: calc(env(safe-area-inset-left) + 10px); top: 10px; width: 40px; height: 40px; border-radius: 8px; background: #303642; font-size: 14px; }
.b.on { filter: brightness(1.6); opacity: 1; }

/* phones play in landscape only */
#rotate { display: none; position: fixed; inset: 0; z-index: 40; background: #1a1420; color: #f8fbf4; text-align: center;
  flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 16px; }
#rotate svg { animation: tilt 1.6s ease-in-out infinite; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) { body.touch #rotate { display: flex; } }
@media (max-height: 420px) { #help { display: none; } }

/* settings */
#gear { position: fixed; top: calc(env(safe-area-inset-top) + 8px); right: 8px; z-index: 20; width: 40px; height: 40px;
  border: 2px solid #ffffff30; border-radius: 8px; background: #303642cc; color: #fef37c; display: grid; place-items: center; cursor: pointer; }
#gear:hover, #gear:focus-visible { background: #f01a80; color: #f8fbf4; outline: none; }
#settings { position: fixed; inset: 0; z-index: 30; background: #1a1420cc; display: grid; justify-items: center; align-items: start; padding: max(12px, 8vh) 12px 12px; }
#settings[hidden] { display: none; }
#settings .panel { width: min(560px, 100%); max-height: 100%; overflow: auto; background: #303642; border: 3px solid #f01a80;
  box-shadow: 6px 6px 0 #ad0b58; padding: 14px 16px 18px; color: #f8fbf4; font: 13px/1.5 ui-monospace, Menlo, monospace; }
#settings .top { display: flex; justify-content: space-between; align-items: center; }
#settings h2 { margin: 0; color: #fef37c; letter-spacing: 2px; font-size: 18px; }
#settings h3 { margin: 4px 0 6px; color: #fef37c; letter-spacing: 2px; }
#settings button { font: bold 13px ui-monospace, Menlo, monospace; cursor: pointer; }
#set-close { background: #1a1420; color: #f8fbf4; border: 2px solid #ffffff40; width: 34px; height: 34px; }
#settings .tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
#settings .tabs button { background: #1a1420; color: #f8fbf4cc; border: 2px solid #ffffff30; padding: 7px 12px; }
#settings .tabs button[aria-selected="true"] { background: #f01a80; color: #f8fbf4; border-color: #f01a80; }
#settings .row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
#settings .row.col { gap: 14px; }
#settings input[type=checkbox] { width: 20px; height: 20px; accent-color: #f01a80; }
#settings input[type=range] { flex: 1; accent-color: #f01a80; }
#settings .note { color: #f8fbf499; margin: 10px 0 0; }
#settings table { border-collapse: collapse; width: 100%; font-size: 12px; }
#settings th { color: #fef37c; text-align: left; padding: 4px 6px; border-bottom: 2px solid #ffffff20; }
#settings td { padding: 5px 6px; border-bottom: 1px solid #ffffff12; }
#settings td:first-child { color: #8cbda4; }
#settings ul { padding-left: 18px; } #settings li { margin: 4px 0; } #settings b { color: #fef37c; }
#settings .binds td { padding: 4px 6px; }
#settings .bind { background: #1a1420; color: #f8fbf4; border: 2px solid #ffffff30; padding: 5px 8px; min-width: 120px; text-align: left; }
#settings .bind:hover, #settings .bind:focus-visible { border-color: #f01a80; outline: none; }
#settings .bind.wait { border-color: #fef37c; color: #fef37c; }
#settings .bind.fixed { opacity: .55; cursor: default; }
#settings .wide { margin-top: 10px; background: #1a1420; color: #fef37c; border: 2px solid #ffffff30; padding: 7px 12px; }
#settings select { background: #1a1420; color: #f8fbf4; border: 2px solid #ffffff30; padding: 5px 8px; font: 13px ui-monospace, Menlo, monospace; }
#settings a { color: #fef37c; }

/* Pay it forward: a standard across Kyle's apps (a button on the start screen + a thank-you pop-up once a visit) */
#payfwd { display: none; position: fixed; left: calc(env(safe-area-inset-left) + 12px); top: calc(env(safe-area-inset-top) + 12px); z-index: 20; /* OOM: top-left, so the best score bottom-right stays clear */
  background: #f01a80; color: #f8fbf4; border: 2px solid #ffffff40; border-radius: 8px; padding: 9px 14px; font: bold 13px ui-monospace, Menlo, monospace;
  text-decoration: none; letter-spacing: 1px; box-shadow: 3px 3px 0 #ad0b58; }
#payfwd:hover, #payfwd:focus-visible { background: #fef37c; color: #303642; outline: none; }
body.on-title #payfwd { display: block; }
body.touch.on-title #touch { display: none; }   /* the start screen only needs a tap, so the pause button's corner is free */
#thanks { position: fixed; inset: 0; z-index: 35; background: #1a1420cc; display: grid; place-items: center; padding: 12px; }
#thanks[hidden] { display: none; }
#thanks .panel { width: min(420px, 100%); background: #303642; border: 3px solid #f01a80; box-shadow: 6px 6px 0 #ad0b58; padding: 18px 20px;
  color: #f8fbf4; font: 14px/1.55 ui-monospace, Menlo, monospace; }
#thanks h2 { margin: 0 0 10px; color: #fef37c; font-size: 17px; letter-spacing: 1px; }
#thanks p { margin: 0 0 10px; }
#thanks .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
#thanks .go { background: #f01a80; color: #f8fbf4; text-decoration: none; padding: 9px 14px; font-weight: bold; border: 2px solid #f01a80; }
#thanks .later { background: #1a1420; color: #f8fbf4; border: 2px solid #ffffff40; padding: 9px 14px; font: bold 13px ui-monospace, Menlo, monospace; cursor: pointer; }
#thanks .go:hover, #thanks .later:hover { filter: brightness(1.2); }
