:root {
  --hold: #2a1c12;
  --ply: #e2c08a;
  --ply-deep: #8a5a2b;
  --ink: #2a160c;
  --paper: #f4e2bc;
  --gap: #140e0a;
  --lamp: #ffbf47;
  --slime: #ff5d8f;
  --leak: #2f9aa3;
  color: var(--ink);
  font-family: Cabin, "Avenir Next", sans-serif;
  background: var(--gap);
}

* { box-sizing: border-box; }

body {
  position: relative;
  margin: 0;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  padding: 0.7rem;
  background:
    radial-gradient(circle at 50% 0%, #4a301c 0%, transparent 42%),
    var(--gap);
}

button, input {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

button:focus-visible, input:focus-visible {
  outline: 3px solid var(--lamp);
  outline-offset: 2px;
}

.top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  color: var(--paper);
}

h1, #scare-word {
  font-family: Shrikhand, Georgia, serif;
  font-weight: 400;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 0.9;
  color: var(--ply);
}

#objective, #log, .lead, #role, #crew {
  margin: 0.2rem 0 0;
  max-width: 62ch;
  line-height: 1.35;
}

#code {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  color: var(--lamp);
}

#sound, #hold, #create, #join, #start, #sabotage, #prank {
  border: 0;
  background: var(--ply);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
}

#manifest {
  position: absolute;
  z-index: 3;
  left: 0.7rem;
  right: 0.7rem;
  top: 5.4rem;
  background: var(--paper);
  color: var(--ink);
  padding: 0.8rem 1rem;
  border-radius: 6px 18px 8px 14px;
  box-shadow: 0 10px 0 #6b3e1e;
}

#manifest[data-mode="hidden"] { display: none; }
#manifest[data-mode="gate"] #lobby { display: none; }
#manifest[data-mode="lobby"] #gate .lead,
#manifest[data-mode="lobby"] .name-field,
#manifest[data-mode="lobby"] #create,
#manifest[data-mode="lobby"] #join,
#manifest[data-mode="lobby"] #join-code { display: none; }

#gate, .row, .actions, #imposter-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

label { display: grid; gap: 0.15rem; }

.check { display: flex; gap: 0.4rem; align-items: center; }

input[type="text"], #name, #join-code, #chat {
  border: 2px solid var(--ink);
  background: #fff8e8;
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
}

#station {
  position: relative;
  min-height: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #0b0813;
  box-shadow: inset 0 0 0 3px #3a2012, 0 6px 0 #3a2012;
}

#world {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

#alert {
  position: absolute;
  top: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.35rem 1.1rem;
  border-radius: 999px;
  font-family: Shrikhand, Georgia, serif;
  font-size: clamp(1rem, 3vw, 1.7rem);
  white-space: nowrap;
  color: #fff;
  background: var(--slime);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

#alert[data-tone="bad"] { animation: pulse 0.5s ease-in-out infinite alternate; }
#alert[data-tone="good"] { background: #3fb374; }
#alert[hidden] { display: none; }

#stick {
  position: fixed;
  z-index: 4;
  width: 104px;
  height: 104px;
  margin: -52px 0 0 -52px;
  border-radius: 50%;
  border: 3px solid rgba(255, 224, 138, 0.7);
  background: rgba(255, 224, 138, 0.12);
  pointer-events: none;
}

#stick[hidden] { display: none; }

#stick i {
  position: absolute;
  left: 32px;
  top: 32px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 224, 138, 0.85);
}

#keys { margin: 0; font-size: 0.85rem; opacity: 0.75; }

kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.35em;
  border-radius: 5px;
  background: var(--ink);
  color: var(--lamp);
  font: inherit;
  font-weight: 700;
  text-align: center;
}

.meter[hidden],
#toast[hidden],
#imposter-box[hidden],
#start[hidden] { display: none; }

.dock { color: var(--paper); }

#hold { touch-action: none; user-select: none; }
#hold[data-down="1"] { background: var(--lamp); }

#hold:disabled { opacity: 0.45; cursor: default; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  max-width: min(36rem, 90vw);
}

#scare {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  z-index: 5;
  pointer-events: none;
  text-align: center;
  background: #f2d24b;
}

#scare[hidden] { display: none; }

#scare-word {
  margin: 0;
  font-size: clamp(4rem, 18vw, 11rem);
  line-height: 0.8;
  color: var(--ink);
}

#scare-line {
  margin: 0.4rem 0 0;
  font-size: clamp(1.1rem, 3vw, 1.8rem);
}

#scare[data-kind="niesen"] { background: var(--paper); }
#scare[data-kind="auge"] { background: #1a120c; }
#scare[data-kind="auge"] #scare-word,
#scare[data-kind="auge"] #scare-line { color: var(--paper); }
#scare[data-kind="banane"] { background: #ffe14a; }
#scare[data-kind="kissen"] { background: #b7e3a1; }
#scare[data-kind="haps"] { background: var(--slime); }

@keyframes pulse {
  to { transform: translateX(-50%) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  #alert[data-tone="bad"] { animation: none; }
}

@media (max-width: 700px) {
  #keys { display: none; }
}
