:root {
  color-scheme: dark;
  --forest: #18392b;
  --forest-dark: #10271e;
  --leaf: #3f6b3a;
  --moss: #7b9e57;
  --stone: #a7a58e;
  --pink: #ff5d73;
  --cream: #f3f0e7;
  --ink: #15271f;
}

* { box-sizing: border-box; }

html, body, main {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--forest-dark);
  color: var(--cream);
}

button, input { font: inherit; }

button {
  border: 1px solid rgba(243, 240, 231, 0.35);
  color: var(--cream);
  background: transparent;
  min-height: 46px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

button:hover:not(:disabled) { border-color: var(--pink); color: var(--pink); }
button:focus-visible, input:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

button.primary {
  border-color: var(--pink);
  background: var(--pink);
  color: var(--forest-dark);
}

button.primary:hover:not(:disabled) { background: var(--cream); border-color: var(--cream); color: var(--forest-dark); }

input {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(243, 240, 231, 0.32);
  border-radius: 0;
  background: rgba(16, 39, 30, 0.68);
  color: var(--cream);
  padding: 0 14px;
}

input::placeholder { color: rgba(243, 240, 231, 0.45); }

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #161f25;
  cursor: crosshair;
}

.shell {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(460px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  border: 1px solid rgba(167, 165, 142, 0.35);
  background: rgba(24, 57, 43, 0.97);
  padding: 42px;
}

.shell::after {
  content: "";
  position: absolute;
  left: 42px;
  bottom: 0;
  width: 72px;
  height: 4px;
  background: var(--pink);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--pink);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; line-height: 0.95; }
h1 { font-size: clamp(58px, 10vw, 92px); letter-spacing: -0.06em; }
h2 { font-size: 34px; }

.tagline { margin: 16px 0 32px; color: rgba(243, 240, 231, 0.72); line-height: 1.5; }
.shell label { display: block; margin: 0 0 8px; font-size: 11px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.actions { display: grid; gap: 12px; margin-top: 14px; }
.actions > span { text-align: center; color: rgba(243, 240, 231, 0.4); font-size: 11px; text-transform: uppercase; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#room-code { text-transform: uppercase; font-weight: 900; letter-spacing: 0.2em; }

.connection { display: flex; align-items: center; gap: 8px; margin: 22px 0 0; color: rgba(243, 240, 231, 0.55); font-size: 12px; }
#connection-dot { width: 8px; height: 8px; background: var(--stone); border-radius: 50%; }
#connection-dot.online { background: var(--moss); }
#connection-dot.offline { background: var(--pink); }

.brand-mark { position: absolute; right: 38px; top: 34px; width: 50px; height: 50px; }
.brand-mark i, .brand-mark b { position: absolute; width: 22px; height: 22px; background: var(--pink); border-radius: 50% 50% 8px 50%; }
.brand-mark i:nth-child(1) { left: 14px; top: 0; transform: rotate(45deg); }
.brand-mark i:nth-child(2) { right: 0; top: 14px; transform: rotate(135deg); }
.brand-mark i:nth-child(3) { left: 14px; bottom: 0; transform: rotate(225deg); }
.brand-mark i:nth-child(4) { left: 0; top: 14px; transform: rotate(315deg); }
.brand-mark b { left: 19px; top: 19px; width: 12px; height: 12px; background: var(--cream); }

.lobby-note { color: rgba(243, 240, 231, 0.68); }
#copy-code { min-height: 0; border: 0; padding: 0; color: var(--pink); font-size: inherit; }
#player-list { min-height: 96px; max-height: 250px; overflow: auto; margin: 28px 0; padding: 0; list-style: none; border-top: 1px solid rgba(243, 240, 231, 0.15); }
#player-list li { display: flex; justify-content: space-between; padding: 13px 2px; border-bottom: 1px solid rgba(243, 240, 231, 0.15); }
#player-list span { color: var(--pink); font-size: 11px; font-weight: 900; letter-spacing: 0.08em; }
.lobby .primary { width: 100%; }
#waiting { text-align: center; color: rgba(243, 240, 231, 0.6); }

#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-top { position: absolute; top: 18px; left: 18px; right: 18px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; }
.hud-top > div { display: grid; gap: 2px; }
.hud-top .storm-status { text-align: center; padding: 9px 18px; background: rgba(16, 39, 30, 0.88); border-top: 3px solid var(--pink); min-width: 190px; }
.hud-top .ping { text-align: right; }
#hud small { color: rgba(243, 240, 231, 0.62); font-weight: 900; letter-spacing: 0.11em; }

.hud-bottom { position: absolute; left: 18px; right: 18px; bottom: 18px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; }
.health { display: grid; grid-template-columns: auto minmax(100px, 220px) auto; align-items: center; gap: 9px; }
.health > div { height: 11px; border: 2px solid var(--cream); }
.health i { display: block; width: 100%; height: 100%; background: var(--pink); }
.flower-card { display: flex; align-items: center; gap: 10px; min-width: 145px; padding: 8px 12px; background: rgba(16, 39, 30, 0.88); }
.flower-card > div:last-child { display: grid; }
/* The carried flower, drawn from its three growth stages. --flower-grow is set
   from the stored healing each frame, so it swells steadily between stages
   rather than only changing at the two thresholds. */
.flower-icon {
  width: 38px; height: 38px;
  background-repeat: no-repeat; background-position: center; background-size: contain;
  transform: scale(var(--flower-grow, 1));
  transition: transform 600ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.flower-icon[data-stage="seed"] { background-image: url('assets/flower-seed.png'); }
.flower-icon[data-stage="budding"] { background-image: url('assets/flower-budding.png'); }
.flower-icon[data-stage="bloomed"] { background-image: url('assets/flower-bloomed.png'); }
/* Played once when the flower reaches the next stage, so opening into bud or
   bloom reads as an event worth having waited for. */
.flower-icon.blooming { animation: bloom-open 620ms cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes bloom-open {
  0% { transform: scale(calc(var(--flower-grow, 1) * 0.65)) rotate(-22deg); }
  55% { transform: scale(calc(var(--flower-grow, 1) * 1.22)) rotate(8deg); }
  100% { transform: scale(var(--flower-grow, 1)) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .flower-icon { transition: none; }
  .flower-icon.blooming { animation: none; }
}
.ammo { display: grid; justify-items: end; }
.ammo strong { font-size: 25px; }

#announcement {
  position: absolute;
  left: 50%;
  top: 24%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  padding: 24px 28px;
  text-align: center;
  background: rgba(16, 39, 30, 0.92);
  border-top: 4px solid var(--pink);
  pointer-events: none;
}
#announcement-kicker { margin: 0 0 6px; color: var(--pink); font-size: 11px; font-weight: 900; letter-spacing: 0.14em; }
#announcement-copy { margin: 10px 0 0; color: rgba(243, 240, 231, 0.75); }

#toast { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(15px); opacity: 0; padding: 10px 16px; background: var(--pink); color: var(--forest-dark); font-weight: 800; transition: 160ms ease; pointer-events: none; }
#toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.controls { position: absolute; right: 18px; bottom: 77px; color: rgba(243, 240, 231, 0.48); font-size: 10px; letter-spacing: 0.08em; }

@media (max-width: 640px) {
  .shell { padding: 30px 24px; }
  .shell::after { left: 24px; }
  .brand-mark { display: none; }
  .hud-top { grid-template-columns: 1fr auto; }
  .hud-top .ping { display: none; }
  .hud-bottom { grid-template-columns: 1fr auto; }
  .flower-card { grid-row: 2; margin-top: 8px; }
  .controls { display: none !important; }
}
