:root {
  --bg: #0e0f13;
  --bar: #16181e;
  --line: #262a33;
  --text: #eceef2;
  --muted: #8b91a0;
  --accent: #7cc4ff;
  --keep: #5ed39a;
  --drop: #ff7a7a;
  --bar-h: 104px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
}

body {
  position: fixed;
  inset: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
}

#app {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

#stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
  touch-action: auto;
}

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 17px;
  pointer-events: none;
}

#loading .dots::after {
  content: "…";
  animation: blink 1.2s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

#notice {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(22, 24, 30, 0.96);
  border: 1px solid var(--line);
  text-align: center;
  font-size: 16px;
}

#bar {
  flex: 0 0 auto;
  min-height: var(--bar-h);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--bar);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#credit {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

#title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.sep {
  color: var(--muted);
}

#maker {
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

#maker::after {
  content: " ↗";
}

#buttons,
#pickbar {
  display: flex;
  gap: 8px;
}

#pickbar {
  align-items: center;
}

#shield {
  position: absolute;
  inset: 0;
  z-index: 3;
}

#pickbar[hidden],
#picknotes[hidden],
#shield[hidden],
#notice[hidden] {
  display: none;
}

#pickinfo {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pick mode: the automatic check's warnings, visible on the phone (a title
   tooltip never shows on touch). Capped at three lines so the game keeps
   most of the screen. */
#picknotes {
  font-size: 12px;
  line-height: 1.35;
  color: #f0c36b;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

/* Tapped: show every warning, scrolling if long. */
#picknotes.open {
  display: block;
  -webkit-line-clamp: unset;
  max-height: 40dvh;
  overflow-y: auto;
  touch-action: pan-y;
}

#reason {
  flex: 0 1 120px;
  min-width: 70px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0c0d11;
  color: var(--text);
  font-size: 16px; /* 16px stops iOS zooming on focus */
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
}

button {
  flex: 1 1 0;
  height: 44px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1f232b;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  white-space: nowrap;
  touch-action: none; /* a swipe that starts on a button must still reach the bar handler */
  cursor: pointer;
}

button:active {
  background: #2a2f39;
}

#next {
  background: #24344a;
  border-color: #33506f;
}

#pickbar button {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 14px;
}

#keep {
  color: var(--keep);
}

#drop {
  color: var(--drop);
}

#keep.on {
  background: #1d3a2c;
  border-color: var(--keep);
}

#drop.on {
  background: #3d1f22;
  border-color: var(--drop);
}

@media (max-width: 360px) {
  button {
    font-size: 13px;
  }
}
