:root {
  --outline: #46230a;
  --panel: #fff0cd;
  --panel-text: #6e370f;
  --page: #f6e7c4;
  --orange: #f08c28;
  --green: #3fa34d;
  --blue: #3b82d6;
  --grey: #a0a0a0;
  --red: #d9453b;
  --font: ui-rounded, "Arial Rounded MT Bold", "Nunito", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  font-family: var(--font);
  font-weight: 800;
  color: var(--panel-text);
  -webkit-tap-highlight-color: transparent;
}

h1 { margin: 0; font-size: clamp(44px, 12vmin, 90px); line-height: 1; color: var(--orange); text-shadow: 3px 3px 0 var(--outline); }
h2 { margin: 0 0 8px; font-size: 26px; text-align: center; }
p { margin: 0; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 16px;
  text-align: center;
}
.lead { max-width: 440px; font-size: 18px; font-weight: 600; }

.card {
  width: min(100%, 400px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 4px solid var(--outline);
  border-radius: 24px;
  padding: 18px;
}
.card label, .label { font-size: 16px; }
.or { margin-top: 6px; font-size: 15px; opacity: 0.75; }
.joinRow { display: flex; gap: 10px; }
.joinRow input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.2em; }
.code { font-size: 52px; letter-spacing: 0.18em; color: var(--red); line-height: 1; }

input {
  font: inherit;
  font-size: 22px;
  text-align: center;
  color: var(--panel-text);
  background: #fff;
  border: 3px solid var(--outline);
  border-radius: 14px;
  padding: 9px;
}

.buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.button {
  font: inherit;
  font-size: 19px;
  color: #fff;
  background: var(--orange);
  border: 3px solid var(--outline);
  border-radius: 16px;
  padding: 8px 20px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-shadow: -1px -1px 0 var(--outline), 1px -1px 0 var(--outline), -1px 1px 0 var(--outline), 1px 1px 0 var(--outline);
}
.button:active { transform: translateY(2px); }
.button:disabled { opacity: 0.5; }
.button.green { background: var(--green); }
.button.blue { background: var(--blue); }
.button.grey { background: var(--grey); }
.button.big { font-size: 24px; padding: 12px 22px; }
.message { min-height: 1.3em; font-size: 16px; }

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.players li { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 12px; font-size: 18px; border: 3px solid transparent; }
.players li.turn { background: #fff; border-color: var(--outline); }
.players li.left { opacity: 0.45; text-decoration: line-through; }
.players .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .lions { display: flex; gap: 3px; flex: none; }
.players .lions i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--outline); background: rgba(70, 35, 10, 0.12); }

/* The game: board with the panel beside it, or below it on an upright phone */
#play { height: 100dvh; display: flex; }
#board { flex: none; width: min(100vw, 100dvh); height: min(100vw, 100dvh); touch-action: manipulation; }
#side { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px; }
@media (orientation: portrait) {
  #play { flex-direction: column; }
  #board { height: min(100vw, 58dvh); width: 100vw; }
}
#turnBox { display: flex; align-items: center; gap: 12px; min-height: 64px; }
#dice {
  flex: none;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: #fff;
  border: 4px solid var(--outline);
  border-radius: 14px;
}
#dice.rolling { animation: tumble 0.5s ease-out; }
@keyframes tumble { from { transform: rotate(-200deg) scale(0.4); } to { transform: none; } }
#status { font-size: 19px; }
#controls { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#chooseRow { justify-content: flex-start; }
#chooseRow .button { font-size: 16px; padding: 8px 12px; }
#colorRow { display: grid; grid-template-columns: repeat(6, 44px); gap: 8px; }
#colorRow button { height: 44px; border-radius: 50%; border: 4px solid var(--outline); cursor: pointer; }
.bottom { justify-content: flex-start; margin-top: auto; }
.bottom .button { font-size: 16px; padding: 6px 14px; }

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(70, 35, 10, 0.45); }
.window {
  width: min(100%, 440px);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 4px solid var(--outline);
  border-radius: 24px;
  padding: 16px;
}
.rulesList { margin: 0; padding: 0 0 0 20px; font-size: 16px; font-weight: 600; text-align: left; display: flex; flex-direction: column; gap: 5px; }
