@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/Fredoka.ttf') format('truetype');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --blue: #1e5bff;
  --red: #e8242c;
  --amber: #c46a00; /* yellow screen, darkened so white text stays readable */
  --green: #0a9b3c;
  --bg: var(--blue);
}
body[data-color='blue'] { --bg: var(--blue); }
body[data-color='red'] { --bg: var(--red); }
body[data-color='amber'] { --bg: var(--amber); }
body[data-color='green'] { --bg: var(--green); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: #fff;
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  transition: background 0.25s;
}
#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  max-width: 28rem;
  margin: 0 auto;
}
.grow { flex: 1; }
.center { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 1rem; }
h1 { font-size: 3rem; margin: 0; letter-spacing: 0.04em; text-align: center; }
h2 { font-size: 1.1rem; margin: 0; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.12em; }
.big { font-size: 3.2rem; line-height: 1.05; word-break: break-word; }
.code { font-size: 4.5rem; letter-spacing: 0.18em; padding-left: 0.18em; }

button, input {
  font: inherit;
  color: #fff;
  background: transparent;
  border: 4px solid #fff;
  border-radius: 1.1rem;
  padding: 0.9rem 1rem;
  width: 100%;
  min-height: 3.6rem;
  text-shadow: inherit;
}
input { text-align: center; user-select: text; -webkit-user-select: text; outline: none; }
input::placeholder { color: rgba(255, 255, 255, 0.6); }
input:focus { background: rgba(255, 255, 255, 0.15); }
button { cursor: pointer; }
button:active:not(:disabled) { background: #fff; color: var(--bg); text-shadow: none; }
button:disabled { opacity: 0.45; }
button.solid { background: #fff; color: var(--bg); text-shadow: none; }
button.link { border: 0; min-height: 0; padding: 0.4rem; width: auto; align-self: center; opacity: 0.8; text-decoration: underline; font-size: 1rem; }
button.small { min-height: 0; width: auto; padding: 0.25rem 0.7rem; font-size: 0.9rem; border-width: 3px; border-radius: 0.7rem; }
.row { display: flex; gap: 0.75rem; }
.row > * { flex: 1; }
.toggle button.on { background: #fff; color: var(--bg); text-shadow: none; }
.error { text-align: center; min-height: 1.5rem; }

ul.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
ul.players li { display: flex; align-items: center; gap: 0.6rem; border: 4px solid #fff; border-radius: 1.1rem; padding: 0.5rem 0.9rem; }
ul.players .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.players li.off { opacity: 0.45; }
.tag { font-size: 0.8rem; opacity: 0.85; }

.hold {
  border: 6px solid #fff;
  border-radius: 2rem;
  min-height: 45vh;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  touch-action: none;
}
.hold .secret { display: none; }
.hold .hint { display: block; opacity: 0.85; font-size: 1.4rem; }
.hold.shown .secret { display: block; }
.hold.shown .hint { display: none; }
.hold.shown { background: rgba(255, 255, 255, 0.15); }
.hold .secret.imp { font-size: 3rem; }

#banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  background: #000; color: #fff; text-align: center; padding: env(safe-area-inset-top) 0 0.3rem; font-size: 0.95rem;
}
#modal {
  position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
#modal[hidden], #banner[hidden] { display: none; }
#modal .card {
  background: var(--bg); border: 4px solid #fff; border-radius: 1.5rem; padding: 1.5rem;
  max-width: 24rem; width: 100%; display: grid; gap: 1rem; text-align: center;
}

.toggle.stack { flex-direction: column; }
.hold .label { font-size: 1.3rem; opacity: 0.85; font-weight: 600; }
.chance { align-items: center; text-align: center; }
.chance[hidden] { display: none; }
.chance .small { flex: 0 0 3.2rem; font-size: 1.5rem; }
.chance-val { flex: 1; }
button[aria-pressed] { text-align: left; }
button[aria-pressed]::before { content: '☐  '; }
button[aria-pressed='true']::before { content: '☑  '; }
