:root {
  --bg: #1d2417;
  --bg-2: #283021;
  --panel: #313a28;
  --line: #45503a;
  --ink: #f2efe3;
  --muted: #a9b29a;
  --accent: #f4c430;   /* hay yellow */
  --accent-2: #8fbf5a; /* pasture green */
  --danger: #d96c4a;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-2), transparent 60%),
    var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  max-width: 540px;
  margin: 0 auto;
  padding: 22px 18px 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: .3px;
}
.brand .dot { color: var(--accent); }

h1 { font-size: 30px; line-height: 1.1; margin: 18px 0 6px; }
h2 { font-size: 19px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 22px; line-height: 1.45; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }

input[type=text], input[type=number] {
  width: 100%;
  font: inherit;
  font-size: 18px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
}
input[type=text]:focus, input[type=number]:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 8px;
  text-align: center;
  font-weight: 800;
  font-size: 26px;
}

button {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-radius: 14px;
  padding: 16px 18px;
  width: 100%;
  color: #1d2417;
  background: var(--accent);
  font-size: 18px;
  transition: transform .05s ease, filter .15s ease;
}
button:active { transform: translateY(1px) scale(.995); }
button:disabled { filter: grayscale(.6) brightness(.8); cursor: not-allowed; }
button.secondary { background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.go { background: var(--accent-2); color: #15200d; font-size: 22px; padding: 22px; }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar button { flex: 1; padding: 11px; font-size: 14px; }

/* Animal picker */
.animals {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.animal {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 6px 10px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: border-color .12s, background .12s, transform .05s;
}
.animal:active { transform: scale(.97); }
.animal .emoji { font-size: 30px; display: block; }
.animal .name { font-size: 13px; font-weight: 700; margin-top: 2px; }
.animal .snd { font-size: 11px; color: var(--muted); }
.animal.on { border-color: var(--accent); background: #3a4429; box-shadow: inset 0 0 0 1px var(--accent); }
.animal .check { position: absolute; top: 6px; right: 8px; opacity: 0; color: var(--accent); font-weight: 900; }
.animal.on .check { opacity: 1; }
.animal.clash { outline: 1px dashed var(--danger); }

.warn { color: var(--danger); font-size: 13px; margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; line-height: 1.4; }

/* Host: code + QR */
.codebox { text-align: center; }
.codebox .label { color: var(--muted); font-size: 14px; }
.codebox .code {
  font-size: 52px; font-weight: 900; letter-spacing: 10px;
  color: var(--accent); margin: 4px 0 2px;
}
.qr { background: #fff; border-radius: 14px; padding: 12px; width: 220px; margin: 12px auto 4px; }
.qr svg { width: 100%; height: auto; display: block; }
.joinurl { color: var(--muted); font-size: 13px; word-break: break-all; }

/* Herd tally board */
.totals { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 14px; }
.totals .big { font-size: 40px; font-weight: 900; color: var(--accent); }
.totals .lbl { color: var(--muted); }

.herds { display: flex; flex-direction: column; gap: 8px; }
.herd {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
}
.herd .emoji { font-size: 26px; }
.herd .nm { font-weight: 700; flex: 1; }
.herd .ct { font-size: 22px; font-weight: 900; color: var(--accent); }
.herd .bar { position: relative; flex: 2; height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.herd .bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent-2); border-radius: 6px; transition: width .25s ease; }

/* Player views */
.center { min-height: 78vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.lobby-emoji { font-size: 64px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* Deliberately compact so the whole reveal fits a phone without scrolling, and
   small enough that nobody's tempted to hold their screen up for others to read. */
.reveal { min-height: 84vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 3px; padding: 8px 4px; }
.reveal .privacy {
  display: inline-block;
  background: rgba(217,108,74,.16); border: 1px solid var(--danger); color: #f1bba9;
  font-size: 12px; font-weight: 800; letter-spacing: .3px;
  border-radius: 999px; padding: 6px 14px; margin-bottom: 16px;
}
.reveal .you { color: var(--muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.reveal .emoji { font-size: 64px; line-height: 1.1; }
.reveal .animal-name { font-size: 28px; font-weight: 900; margin: 0; }
.reveal .sound-label { color: var(--muted); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; margin-top: 12px; }
.reveal .sound {
  font-size: 24px; font-weight: 900; color: var(--accent);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 7px 18px; margin: 4px 0 16px;
}
.reveal .count { font-size: 15px; color: var(--ink); }
.reveal .count b { color: var(--accent-2); font-size: 20px; }
.reveal .hands {
  margin-top: 16px; max-width: 320px; line-height: 1.4;
  color: var(--ink); font-size: 14px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
}
.reveal .hands b { color: var(--accent); }

.flash { animation: flash .6s ease; }
@keyframes flash { 0% { background: var(--accent-2); } 100% { background: transparent; } }

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }
a { color: var(--accent); }
