*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1208;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #2a1a0a;
}

#game-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, #3d2a14 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, #2a1f10 0%, transparent 45%),
    #1a1208;
}

#game {
  display: block;
  max-width: 100vw;
  max-height: 100vh;
  width: min(100vw, calc(100vh * 16 / 9));
  height: auto;
  aspect-ratio: 16 / 9;
  background: #c4a574;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
  image-rendering: auto;
  cursor: crosshair;
}

#ui-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 12, 4, 0.72);
  pointer-events: auto;
  z-index: 10;
}

.screen.hidden {
  display: none;
}

.panel {
  background: linear-gradient(160deg, #fff8e7 0%, #f5e6c8 100%);
  border: 3px solid #c45c26;
  border-radius: 16px;
  padding: 2rem 2.5rem;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow:
    0 0 0 4px #f0a868,
    0 16px 48px rgba(0, 0, 0, 0.4);
}

.panel h1 {
  font-size: 2.1rem;
  color: #c45c26;
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
  text-shadow: 1px 1px 0 #fff;
}

.panel h2 {
  font-size: 1.5rem;
  color: #c45c26;
  margin-bottom: 0.6rem;
}

.tagline {
  font-size: 1.05rem;
  color: #5a3a1a;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.blurb {
  font-size: 0.92rem;
  color: #5a4030;
  line-height: 1.45;
  margin-bottom: 1.25rem;
}

.score-line {
  font-size: 1.35rem;
  font-weight: 700;
  color: #2d6a3e;
  margin-bottom: 0.5rem;
}

.hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #7a5a40;
}

.btn {
  appearance: none;
  border: 2px solid #8a4a20;
  background: #f0d9a8;
  color: #3a2010;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.55rem 1.4rem;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
  pointer-events: auto;
}

.btn:hover {
  background: #ffe8b8;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(180deg, #e87830 0%, #c45c26 100%);
  color: #fff8e7;
  border-color: #8a3010;
  font-size: 1.15rem;
  padding: 0.65rem 2rem;
  box-shadow: 0 3px 0 #8a3010;
}

.btn.primary:hover {
  background: linear-gradient(180deg, #f08840 0%, #d46c30 100%);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.shop-panel {
  max-width: 520px;
  text-align: left;
}

.shop-money {
  font-weight: 700;
  color: #2d6a3e;
  margin-bottom: 1rem;
  text-align: center;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid #d4b888;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.55rem;
}

.shop-item .icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: #e8d4a8;
}

.shop-item .info {
  flex: 1;
  min-width: 0;
}

.shop-item .name {
  font-weight: 700;
  color: #3a2010;
  font-size: 0.95rem;
}

.shop-item .desc {
  font-size: 0.78rem;
  color: #6a5040;
}

.shop-item .price {
  font-weight: 700;
  color: #c45c26;
  white-space: nowrap;
  font-size: 0.9rem;
}

.shop-panel .btn {
  display: block;
  margin: 1rem auto 0;
}

.hud-hint {
  position: absolute;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 18, 8, 0.75);
  color: #f5e6c8;
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 5;
}

.hud-hint.hidden {
  display: none;
}

.hud-hint kbd {
  background: #c45c26;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 700;
}

@media (max-width: 600px) {
  .panel {
    padding: 1.4rem 1.2rem;
  }
  .panel h1 {
    font-size: 1.6rem;
  }
}

/* ---- Party / presence UI ---- */
.start-panel {
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
}

.name-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
  color: #5a3a1a;
  margin-bottom: 0.85rem;
}

.name-row input,
.join-row input {
  appearance: none;
  border: 2px solid #c4a070;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 1rem;
  background: #fffdf6;
  color: #2a1a0a;
}

.party-box {
  margin: 1.1rem 0 0.4rem;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.45);
  border: 2px dashed #d4884a;
  border-radius: 12px;
  text-align: center;
}

.party-box h3 {
  color: #c45c26;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.party-status {
  font-size: 0.82rem;
  color: #5a5040;
  margin-bottom: 0.55rem;
  min-height: 1.2em;
}

.party-status.offline {
  color: #a04030;
}

.party-status.online {
  color: #2d6a3e;
}

.party-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.join-row {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin: 0.4rem 0;
}

.join-row input {
  width: 7rem;
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.join-row.hidden,
.party-info.hidden,
.party-popover.hidden,
.party-hud.hidden {
  display: none;
}

.party-info {
  margin-top: 0.5rem;
}

.code-label {
  font-size: 0.75rem;
  color: #7a5a40;
  margin-bottom: 0.15rem;
}

.party-code {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #c45c26;
  margin-bottom: 0.5rem;
}

.party-members {
  list-style: none;
  margin: 0.35rem auto 0.65rem;
  padding: 0;
  max-width: 260px;
  text-align: left;
  font-size: 0.88rem;
}

.party-members li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0;
  color: #3a2010;
}

.party-members .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.party-hint {
  margin-top: 0.55rem;
  font-size: 0.75rem;
}

.party-hud {
  position: absolute;
  top: 3.2%;
  right: 2%;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(30, 18, 8, 0.8);
  color: #f5e6c8;
  padding: 0.3rem 0.55rem 0.3rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8rem;
  pointer-events: auto;
}

.party-hud .btn.tiny,
.party-popover .btn.tiny,
.btn.tiny {
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 7px;
}

.party-popover {
  position: absolute;
  top: 9%;
  right: 2%;
  z-index: 7;
  width: 240px;
  background: linear-gradient(160deg, #fff8e7 0%, #f5e6c8 100%);
  border: 2px solid #c45c26;
  border-radius: 12px;
  padding: 0.75rem;
  pointer-events: auto;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.party-popover .party-code {
  font-size: 1.4rem;
  text-align: center;
}
