/* Cosy Camp — interface styles */
:root {
  --cream: #fff6e6;
  --cream-2: #f6e7cc;
  --bark: #5b3a29;
  --bark-soft: #8a6a55;
  --moss: #6f9a57;
  --moss-dark: #55803f;
  --ember: #ef8354;
  --ember-dark: #d96a3b;
  --berry: #d9506b;
  --line: rgba(91, 58, 41, .22);
  --shadow: 0 10px 30px rgba(52, 33, 20, .22);
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito", "Quicksand", "Varela Round", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #9fd8ef;
  color: var(--bark);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

[hidden] { display: none !important; }

/* ── Shared pieces ─────────────────────────────────────────── */
.panel {
  background: var(--cream);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  outline: 1.5px dashed var(--line);
  outline-offset: -5px;
}
.panel-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--bark-soft);
  margin-bottom: 6px;
}
.panel-label b { color: var(--moss-dark); margin-left: 4px; }

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 1px 6px;
  margin: 0 1px;
  border-radius: 7px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  font: 700 12px var(--font);
  text-align: center;
  color: var(--bark);
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font: 800 16px var(--font);
  color: var(--bark);
  background: var(--cream-2);
  box-shadow: 0 4px 0 rgba(91, 58, 41, .25);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(91, 58, 41, .25); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { width: 100%; color: #fff; background: var(--ember); box-shadow: 0 4px 0 var(--ember-dark); }
.btn:focus-visible, .chip-btn:focus-visible, input:focus-visible, .swatch:focus-visible, .emote:focus-visible {
  outline: 3px solid #3c7fd6;
  outline-offset: 2px;
}

/* ── Lobby ─────────────────────────────────────────────────── */
.lobby {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: auto;
  background: radial-gradient(ellipse at center, rgba(255, 246, 230, .0) 30%, rgba(255, 226, 180, .35) 100%);
}
.card {
  width: min(420px, 100%);
  background: var(--cream);
  border-radius: 28px;
  padding: 28px 28px 20px;
  box-shadow: 0 24px 60px rgba(52, 33, 20, .3);
  outline: 2px dashed var(--line);
  outline-offset: -9px;
  animation: rise .5s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); } }

.eyebrow {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--moss-dark);
}
.card h1 {
  margin: 0;
  font-size: 46px;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--bark);
}
.lede { margin: 10px 0 18px; line-height: 1.45; color: var(--bark-soft); }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--bark-soft);
}
input[type="text"] {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  padding: 11px 13px;
  font: 700 16px var(--font);
  color: var(--bark);
}
input[type="text"]::placeholder { color: #c2ac98; font-weight: 600; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--line);
  cursor: pointer;
  padding: 0;
  transition: transform .12s;
}
.swatch:hover { transform: scale(1.1); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--bark); transform: scale(1.12); }

.or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bark-soft);
}
.or::before, .or::after { content: ""; flex: 1; border-top: 2px dashed var(--line); }

.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: .25em; text-align: center; }
.join-row .btn { white-space: nowrap; }

.error {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 12px;
  background: #fde3e0;
  color: #a2332b;
  font-weight: 700;
}
.keys { margin: 16px 0 0; font-size: 12.5px; line-height: 2; text-align: center; color: var(--bark-soft); }

/* ── HUD layout ────────────────────────────────────────────── */
.hud { position: fixed; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; position: absolute; }

.top-left { top: 14px; left: 14px; max-width: 210px; }
.camp-code { font-size: 14px; margin-bottom: 6px; }
.camp-code strong { font-size: 20px; letter-spacing: .14em; margin-left: 4px; }
.chip-btn {
  appearance: none;
  border: 1.5px solid var(--line);
  background: #fffdf8;
  border-radius: 999px;
  padding: 4px 10px;
  margin: 0 4px 4px 0;
  font: 700 12px var(--font);
  color: var(--bark);
  cursor: pointer;
}
.chip-btn:hover { background: var(--cream-2); }
.campers { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; font-weight: 700; font-size: 13px; }
.camper { display: flex; align-items: center; gap: 7px; }
.camper i { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.camper small { font-weight: 600; color: var(--bark-soft); }

.top-center { top: 14px; left: 50%; transform: translateX(-50%); text-align: center; }
.stock { display: flex; gap: 14px; }
.stock-item { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px; min-width: 52px; }
.stock-item svg { width: 26px; height: 26px; flex: none; }
.stock-item.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.3); } }

.top-right { top: 14px; right: 14px; width: 232px; }
.projects { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.project { display: grid; grid-template-columns: 20px 1fr; gap: 2px 8px; align-items: center; }
.project .tick {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 900; color: #fff;
}
.project .pname { font-weight: 800; font-size: 14px; }
.project .costs { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; }
.project.done .tick { background: var(--moss); border-color: var(--moss); }
.project.done .pname { color: var(--moss-dark); }
.project.done .costs { display: none; }
.project.ready .tick { border-color: var(--ember); box-shadow: 0 0 0 3px rgba(239, 131, 84, .25); }

.cost { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; font-size: 12.5px; color: var(--bark-soft); }
.cost svg { width: 15px; height: 15px; }
.cost.ok { color: var(--moss-dark); }
.cost.short { color: var(--berry); }

/* Prompt above the feet */
.prompt {
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: var(--cream);
  border-radius: 16px;
  padding: 9px 16px;
  box-shadow: var(--shadow);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  max-width: 94vw;
}
.prompt .costs { display: inline-flex; gap: 8px; }
.prompt .cost { font-size: 14px; }
.prompt .cost svg { width: 18px; height: 18px; }
.prompt.muted { font-weight: 700; color: var(--bark-soft); }
.prompt.nope { animation: nope .3s; }
@keyframes nope { 25% { transform: translateX(calc(-50% - 7px)); } 75% { transform: translateX(calc(-50% + 7px)); } }

/* Bottom-left: chat + bag */
.bottom-left { left: 14px; bottom: 14px; width: 290px; display: flex; flex-direction: column; gap: 8px; }
.chat-log { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow: hidden; justify-content: flex-end; pointer-events: none; }
.chat-line {
  align-self: flex-start;
  max-width: 100%;
  background: rgba(255, 246, 230, .92);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 13.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  animation: rise .25s both;
  transition: opacity .8s;
}
.chat-line b { margin-right: 5px; }
.chat-line.sys { font-style: italic; color: var(--bark-soft); }
.chat-line.old { opacity: 0; }
.chat-input {
  border-radius: 999px !important;
  padding: 7px 14px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  background: rgba(255, 253, 248, .85) !important;
}
.bag-panel { align-self: flex-start; }
.bag { display: flex; gap: 6px; }
.slot {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--cream-2);
  border: 1.5px solid var(--line);
  display: grid; place-items: center;
}
.slot svg { width: 24px; height: 24px; animation: pop .25s cubic-bezier(.2, .9, .3, 1.6) both; }
@keyframes pop { from { transform: scale(0); } }
.bag.full .slot { border-color: var(--ember); }

/* Bottom-right: emotes + touch action */
.bottom-right { right: 14px; bottom: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.emotes { display: flex; gap: 6px; background: var(--cream); padding: 6px; border-radius: 999px; box-shadow: var(--shadow); }
.emote {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--cream-2);
  font-size: 20px;
  cursor: pointer;
  position: relative;
  transition: transform .1s;
}
.emote:hover { transform: translateY(-2px) scale(1.08); }
.emote sup { position: absolute; right: -1px; top: -3px; font: 800 10px var(--font); color: var(--bark-soft); }
.act-btn {
  width: 92px; height: 92px;
  border-radius: 50%;
  border: 0;
  background: var(--ember);
  color: #fff;
  font: 800 16px var(--font);
  box-shadow: 0 5px 0 var(--ember-dark), var(--shadow);
  line-height: 1.1;
  padding: 6px;
}
.act-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ember-dark); }
.act-btn.idle { background: #d8c6ad; box-shadow: 0 5px 0 #b9a58b; }

.stick {
  left: 26px; bottom: 150px;
  width: 124px; height: 124px;
  border-radius: 50%;
  background: rgba(255, 246, 230, .45);
  border: 2px solid rgba(255, 255, 255, .7);
  touch-action: none;
}
.stick-knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 54px; height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: var(--shadow);
}

/* Toasts + banner */
.toasts { top: 84px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast {
  background: var(--bark);
  color: var(--cream);
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: rise .25s both;
  transition: opacity .5s, transform .5s;
}
.toast.out { opacity: 0; transform: translateY(-8px); }
.banner {
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  background: var(--cream);
  padding: 20px 34px;
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(52, 33, 20, .35);
  outline: 2px dashed var(--line);
  outline-offset: -8px;
  animation: rise .6s cubic-bezier(.2, .9, .3, 1.3) both;
  pointer-events: none;
}
.banner h2 { margin: 0 0 4px; font-size: 30px; }
.banner p { margin: 0; color: var(--bark-soft); font-weight: 600; }
.net {
  bottom: 14px; left: 50%; transform: translateX(-50%);
  background: #a2332b; color: #fff;
  padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13px;
}
.noscript { position: fixed; inset: auto 0 20px; text-align: center; font-weight: 700; }

/* ── Small screens / touch ─────────────────────────────────── */
@media (max-width: 860px) {
  .top-right { width: 190px; padding: 8px 10px; }
  .project .costs { display: none; }
  .top-center { top: auto; bottom: 14px; left: 50%; padding: 6px 12px; }
  .top-center .panel-label { display: none; }
  .stock { gap: 8px; }
  .stock-item { font-size: 15px; min-width: 40px; }
  .stock-item svg { width: 20px; height: 20px; }
  .bottom-left { width: 230px; bottom: 64px; }
  .chat-input { display: none; }
  .prompt { bottom: 120px; font-size: 13.5px; }
  .toasts { top: 150px; }
  .bottom-right { bottom: 64px; }
}
@media (max-width: 560px) {
  .top-left .chip-btn#btn-mute, .campers { display: none; }
  .top-left { max-width: 150px; padding: 8px 10px; }
  .top-right { width: 150px; }
  .project .pname { font-size: 12.5px; }
  .emotes { display: none; }
  .bottom-left { width: auto; }
  .chat-log { max-width: 200px; }
  .card { padding: 22px 20px 16px; }
  .card h1 { font-size: 38px; }
}
@media (max-width: 560px) {
  .prompt { top: 238px; bottom: auto; white-space: normal; text-align: center; flex-wrap: wrap; justify-content: center; max-width: 88vw; padding: 7px 12px; }
  .stick { bottom: 216px; left: 18px; }
  .chat-log { max-height: 62px; }
}
@media (pointer: coarse) {
  .prompt kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
