:root {
  --bg: #f3ecdf;
  --ink: #2b2118;
  --muted: #6f5c4c;
  --card: #fffdf9;
  --line: #e4d5c3;
  --brown: #3c291f;
  --orange: #d4652f;
  --orange-dark: #b54e1e;
  --green: #2e6b45;
  --gold: #c8963e;
  --danger: #a33b32;
  --mine: #fff4e8;
  --shadow: 0 8px 24px rgba(60, 41, 31, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

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

button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  background: var(--orange);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.row button { width: auto; }

.goat { font-size: 3rem; line-height: 1; }

button.secondary {
  background: white;
  color: var(--brown);
  border: 2px solid var(--line);
}

button.ghost {
  background: transparent;
  color: var(--brown);
  border: 2px solid var(--line);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input, textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: white;
  font-size: 16px;
}

textarea { min-height: 140px; resize: vertical; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 12px 0 6px;
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

body.has-dock { padding-bottom: 196px; }

header.top {
  background: var(--brown);
  color: #fff8ee;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { font-weight: 800; font-size: 1.15rem; }
.role-pill {
  font-size: 0.75rem;
  border: 1px solid rgba(255, 248, 238, 0.4);
  border-radius: 999px;
  padding: 4px 8px;
}

.hero { text-align: center; padding: 12px 0 4px; }
.hero h1 { margin: 0; font-size: 2.2rem; }
.lede { color: var(--muted); margin: 6px 0 16px; }

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.code-box {
  font-size: 2.4rem;
  letter-spacing: 0.28em;
  font-weight: 800;
  text-align: center;
  margin: 4px 0;
}

.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }

.lot h2, .team h3, .banner { overflow-wrap: anywhere; }
.stack { display: flex; flex-direction: column; gap: 8px; }

.counter {
  background: #fff6ea;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
}
.counter.ok { background: #e7f5ec; color: var(--green); }
.counter.bad { background: #fdeceb; color: var(--danger); }

.team {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: white;
}
.team.mine { background: var(--mine); border-color: #efc7a4; }
.team.turn { border-color: var(--orange); }
.team.winner { border-color: var(--green); background: #f1faf4; }
.team h3 { margin: 0 0 4px; font-size: 1rem; display: flex; justify-content: space-between; gap: 8px; }
.meta { color: var(--muted); font-size: 0.85rem; }
.offline { color: var(--danger); font-weight: 700; }

.roster { list-style: none; padding: 0; margin: 8px 0 0; }
.roster li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid var(--line);
}

.banner {
  text-align: center;
  font-weight: 800;
  font-size: 1.35rem;
  padding: 14px 12px;
  background: #efe4d4;
  position: sticky;
  top: 52px;
  z-index: 4;
}
.banner.mine { background: var(--orange); color: white; }

.lot { text-align: center; padding: 18px 12px; }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 800;
}
.lot h2 { margin: 6px 0; font-size: 2rem; line-height: 1.15; }
.bid { font-size: 1.2rem; margin: 0; }
.bid strong { color: var(--orange-dark); }

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  background: #fffdf9;
  border-top: 2px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
.dock-inner { max-width: 520px; margin: 0 auto; }
.dock .info { font-weight: 700; margin-bottom: 8px; text-align: center; }
.bump { background: var(--brown); }

.log { list-style: none; padding: 0; margin: 0; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }

.win {
  text-align: center;
  background: #2e6b45;
  color: white;
  border-radius: 16px;
  padding: 18px 12px;
  margin-bottom: 12px;
}
.win .goat { font-size: 3rem; }
.win h2 { margin: 4px 0; }

#toast {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--brown);
  color: white;
  padding: 10px 14px;
  border-radius: 999px;
  max-width: calc(100% - 24px);
  text-align: center;
}

.home-actions { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-top: 12px; }
.check input { width: auto; }

@media (min-width: 900px) {
  .wrap { max-width: 960px; }
  .play-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 16px;
    align-items: start;
  }
  .dock { position: static; border: 2px solid var(--line); border-radius: 16px; margin-top: 12px; }
  body.has-dock { padding-bottom: 0; }
  .banner { position: static; border-radius: 16px; margin-bottom: 12px; }
}
