body {
  margin: 0;
  min-height: 100vh;
  background: #151a2a;
  color: #fff;
  font-family: Georgia, serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  width: min(90vw, 760px);
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}

#game[hidden] {
  display: none;
}

#presentsArea {
  flex: 1;
  min-height: 0;
  container-type: size;
}

#home {
  width: min(90vw, 640px);
  text-align: center;
}

#home h1 {
  margin: 0 0 6px;
  color: #ffcf6e;
  font-size: clamp(1.8rem, 7vh, 3.2rem);
}

#homePresent {
  display: block;
  margin: 0 auto 6px;
  width: min(40vw, 24vh);
  aspect-ratio: 1;
  object-fit: contain;
}

#home {
  position: relative;
  z-index: 1;
}

#homeCharacters {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

#homeCharacters img {
  position: absolute;
  width: min(18vw, 18vh);
  aspect-ratio: 1;
  object-fit: contain;
  transform: translate(-50%, -50%);
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(-50%, -50%) rotate(-6deg); }
  50% { transform: translate(-50%, calc(-50% - 3vh)) rotate(6deg); }
}

#mode {
  width: min(90vw, 460px);
  text-align: center;
}

#mode h2 {
  margin: 0 0 18px;
  color: #ffcf6e;
  font-size: 1.8rem;
}

#credits {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 8px;
  margin: 0;
  padding: 0 12px;
  text-align: center;
  font-size: 0.7rem;
  line-height: 1.4;
  color: #8f98b3;
}

#credits a {
  color: #b9c2e0;
}

#homeButtons, #modeButtons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

#play, #playFriend, #playBot {
  padding: 12px 22px;
  font: inherit;
  font-size: 1.1rem;
  color: #fff;
  background: #b3202a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#play {
  padding: 12px 40px;
  font-size: 1.3rem;
}

#warning {
  width: min(90vw, 460px);
  text-align: center;
  line-height: 1.5;
}

#warning[hidden] {
  display: none;
}

#warning h1 {
  color: #ff6b6b;
  font-size: 2rem;
  margin: 0 0 12px;
}

#warning p {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

#warningContinue {
  margin-top: 8px;
  padding: 12px 26px;
  font: inherit;
  font-size: 1.05rem;
  color: #fff;
  background: #b3202a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#select {
  width: min(90vw, 760px, calc((100vh - 110px) * 1.5));
  text-align: center;
}

#selectTitle {
  font-size: 1.4rem;
  margin: 0 0 16px;
}

#characters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.character {
  background: none;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 4px;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.character:hover {
  border-color: #ffcf6e;
}

.character img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
}

#nameScreen {
  width: min(90vw, 360px);
  text-align: center;
}

#namePic {
  width: 55%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  margin: 0 auto 8px;
}

#nameTitle {
  font-size: 1.4rem;
  margin: 0 0 14px;
}

#nameInput {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font: inherit;
  font-size: 1.2rem;
  text-align: center;
  color: #fff;
  background: #0d1120;
  border: 2px solid #3a4468;
  border-radius: 8px;
  margin-bottom: 14px;
}

#nameInput:focus {
  outline: none;
  border-color: #ffcf6e;
}

#nameContinue {
  padding: 10px 26px;
  font: inherit;
  font-size: 1.05rem;
  color: #fff;
  background: #b3202a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#nameContinue:disabled {
  opacity: 0.4;
  cursor: default;
}

#wheelScreen {
  width: min(90vw, 460px);
  text-align: center;
}

#wheelTitle {
  font-size: 1.3rem;
  margin: 0 0 14px;
}

#wheelBox {
  position: relative;
  width: min(80vw, 420px, calc(100vh - 300px));
  margin: 0 auto 12px;
}

#wheel {
  width: 100%;
  display: block;
  border-radius: 50%;
}

#pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 30px solid #ffcf6e;
  filter: drop-shadow(0 2px 3px #000);
}

#wheelLegend {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

#wheelResult {
  min-height: 1.6em;
  margin: 10px 0;
  font-size: 1.3rem;
  color: #ffcf6e;
}

#spin, #startSuddenDeath {
  padding: 10px 26px;
  font: inherit;
  font-size: 1.05rem;
  color: #fff;
  background: #b3202a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#spin:disabled {
  opacity: 0.4;
  cursor: default;
}

#startSuddenDeath[hidden] {
  display: none;
}

#score {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.scoreItem {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scoreItem img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

#turn {
  margin: 0 0 6px;
  text-align: center;
  font-size: 1.1rem;
}

#turn {
  color: #ffcf6e;
}

#message {
  min-height: 2.8em;
  margin: 0 0 8px;
  text-align: center;
  font-size: 1.1rem;
}

#homeButton,
#mute {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

#homeButton {
  right: auto;
  left: 8px;
}

#homeButton[hidden] {
  display: none;
}

@media (max-width: 700px) {
  #game {
    padding-top: 52px;
  }
}

#scare {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #3a0000;
  overflow: hidden;
  animation: shake 0.08s infinite;
}

#scare[hidden] {
  display: none;
}

#scare img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#scare::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #ff0000;
  mix-blend-mode: multiply;
  animation: flash 0.15s infinite alternate;
}

@keyframes shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-12px, 8px); }
  50% { transform: translate(10px, -10px); }
  75% { transform: translate(-8px, -6px); }
  100% { transform: translate(12px, 10px); }
}

@keyframes flash {
  from { opacity: 0.1; }
  to { opacity: 0.6; }
}

#action {
  display: block;
  margin: 0 auto 8px;
  padding: 10px 22px;
  font: inherit;
  font-size: 1.05rem;
  color: #fff;
  background: #b3202a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#action[hidden] {
  display: none;
}

#presents {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 8px;
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  margin: 0 auto;
}

.present {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.present.opened {
  visibility: hidden;
}

.present img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
}
