:root {
  --ink: #0f1728;
  --muted: #5c6b82;
  --line: rgba(15, 23, 40, 0.1);
  --surface: rgba(255, 255, 255, 0.94);
  --accent: #ffc107;
  --accent-deep: #e5a800;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #5a9ef5;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--ink);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
canvas.game-active {
  pointer-events: auto;
  z-index: 2;
}

#hud {
  position: fixed;
  left: 16px;
  top: 16px;
  min-width: 168px;
  z-index: 4;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(15, 23, 40, 0.14);
  backdrop-filter: blur(10px);
  font: 600 13px/1.45 "Plus Jakarta Sans", system-ui, sans-serif;
  pointer-events: none;
}
#hud[hidden],
#progress-wrap[hidden] {
  display: none;
}
#hud #round {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
#hud b {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
#hud #you {
  font-weight: 700;
  margin-top: 2px;
}
#hud #clock {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 15px;
  margin-top: 4px;
}

#progress-wrap {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 22px;
  height: 10px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 1px 2px rgba(15, 23, 40, 0.12);
  pointer-events: none;
}
#progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffe066 0%, #ffc107 55%, #ff9f1c 100%);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(255, 193, 7, 0.55);
  transition: width 0.15s linear;
}

#banner {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 40, 0.45);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  opacity: 0;
}
#banner.show {
  display: flex;
  animation: banner-in 0.45s ease forwards;
}
@keyframes banner-in {
  to {
    opacity: 1;
  }
}

.victory-card {
  width: min(400px, 94vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 22px;
  box-shadow: 0 20px 50px rgba(15, 23, 40, 0.22);
  color: var(--ink);
  position: relative;
}
.victory-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}
.victory-tag {
  margin: 4px 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.victory-title {
  margin: 0 0 14px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.reward-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.reward-chip {
  flex: 1 1 90px;
  min-width: 90px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-weight: 800;
  font-size: 14px;
  text-align: center;
  background: #f0f4fb;
}
.reward-chip.star {
  background: linear-gradient(180deg, #ffe066, #ffc107);
}
.reward-chip.xp {
  background: linear-gradient(180deg, #d4ecff, #9ed4ff);
}
.reward-chip.trophy {
  background: linear-gradient(180deg, #ffd699, #e5a800);
}
.btn-claim {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font: 800 18px/1 "Plus Jakarta Sans", system-ui, sans-serif;
  cursor: pointer;
  color: var(--ink);
  background: linear-gradient(180deg, #ffe066 0%, #ffc107 100%);
  box-shadow: 0 6px 0 var(--accent-deep);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn-claim:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--accent-deep);
}

#lobby {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(255, 255, 255, 0.45), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 30%, rgba(255, 214, 102, 0.35), transparent 50%),
    radial-gradient(ellipse 45% 35% at 0% 80%, rgba(120, 180, 255, 0.4), transparent 45%),
    linear-gradient(180deg, #7ec0ff 0%, #6a9ef7 42%, #5b8fe8 100%);
  overflow: hidden;
}
#lobby[hidden] {
  display: none;
}

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 8px;
  flex-shrink: 0;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
}
.tabs button {
  border: 0;
  border-radius: 999px;
  padding: 8px 18px;
  font: 700 13px "Plus Jakarta Sans", system-ui, sans-serif;
  cursor: pointer;
  background: transparent;
  color: rgba(15, 23, 40, 0.72);
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 40, 0.12);
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 6px 20px rgba(15, 23, 40, 0.12);
  cursor: pointer;
  font: inherit;
  color: inherit;
  max-width: min(280px, 42vw);
  text-align: left;
}
.profile-pill .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd166, #ef476f);
  object-fit: cover;
  flex-shrink: 0;
}
.profile-pill .name {
  font: 800 15px/1.2 "Plus Jakarta Sans", system-ui, sans-serif;
}
.profile-pill .sub {
  font: 600 11px/1.3 system-ui, sans-serif;
  color: var(--muted);
}
.profile-pill .pill-meta {
  font-size: 10px;
}

.home-screen {
  flex: 1;
  min-height: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 8px 20px 28px;
  overflow: auto;
}
@media (min-width: 820px) {
  .home-screen {
    grid-template-columns: 1fr min(340px, 38vw);
    padding: 12px 32px 36px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
  }
}

.home-center {
  text-align: center;
  width: 100%;
  max-width: 480px;
}
.home-logo {
  width: min(420px, 88vw);
  height: auto;
  max-height: min(36vh, 220px);
  object-fit: contain;
  display: block;
  margin: 0 auto 8px;
  filter: drop-shadow(0 10px 28px rgba(15, 23, 40, 0.22));
}
.home-tagline {
  margin: 0 0 22px;
  font-size: 15px;
  font-weight: 600;
  color: rgba(15, 23, 40, 0.72);
  line-height: 1.5;
}
.demo-tip {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}
.btn-play {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 18px 20px;
  font: 800 24px/1 "Plus Jakarta Sans", system-ui, sans-serif;
  letter-spacing: 0.06em;
  cursor: pointer;
  color: var(--ink);
  background: linear-gradient(180deg, #ffe066 0%, #ffc107 100%);
  box-shadow: 0 8px 0 var(--accent-deep), 0 16px 36px rgba(15, 23, 40, 0.22);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn-play:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 var(--accent-deep);
}
.btn-play:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-outline {
  width: 100%;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 14px;
  padding: 14px 16px;
  font: 700 15px "Plus Jakarta Sans", system-ui, sans-serif;
  cursor: pointer;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
  transition: background 0.12s ease;
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.62);
}
.btn-outline:active {
  transform: translateY(2px);
}
.home-controls {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(15, 23, 40, 0.62);
}
.home-controls kbd,
kbd {
  font: 700 11px system-ui, sans-serif;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(15, 23, 40, 0.15);
  border-radius: 6px;
  padding: 2px 6px;
  color: #142033;
}

.home-showcase {
  width: 100%;
  max-width: 340px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 22px;
  padding: 12px 12px 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 40, 0.1);
  backdrop-filter: blur(10px);
}
.showcase-label {
  margin: 0 0 8px 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
#play-preview {
  height: min(280px, 34vh);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #eef6ff 0%, #d4e8ff 100%);
  border: 1px solid var(--line);
  position: relative;
}
#play-preview canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

.menu-screen {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 18px 24px;
}
.menu-card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 24px;
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 20px 50px rgba(15, 23, 40, 0.16);
}
.menu-card + .menu-card {
  margin-top: 14px;
}
.menu-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
}

.profile-screen {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}
.profile-tabs {
  margin: 0 auto 14px;
  max-width: 420px;
}
.profile-tabs button {
  flex: 1;
}

#look-preview {
  height: 220px;
  margin-bottom: 14px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #eef6ff 0%, #d4e8ff 100%);
  border: 1px solid var(--line);
  position: relative;
}
#look-preview canvas {
  position: absolute;
  inset: 0;
  max-width: 100%;
  max-height: 100%;
}

.color-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.color-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
  background: #f0f4fb;
  border-radius: 10px;
  border: 1px solid #d5deed;
}
.color-chip input[type="color"] {
  width: 52px;
  height: 36px;
  padding: 2px;
  border: 0;
  background: transparent;
}
.equip-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.equip-row label {
  margin: 0;
}

.shop-balance {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.cosmetic-shop {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d5deed;
  background: #f8fafc;
}
.shop-row.equipped {
  border-color: #7bc67e;
  background: #eefbea;
}
.shop-row-icon {
  font-size: 22px;
  width: 28px;
  text-align: center;
}
.shop-row-meta {
  flex: 1;
  min-width: 0;
}
.shop-row-name {
  font-weight: 800;
  font-size: 14px;
}
.shop-row-price {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.shop-row-btn {
  width: auto !important;
  min-width: 72px;
  padding: 8px 12px !important;
  margin: 0 !important;
  font-size: 13px !important;
}

.profile-card {
  background: #f0f4fb;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid #d5deed;
}
.profile-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
.profile-head img,
#profile-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #ffd166, #ef476f);
}

form button[type="submit"] {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font: 800 15px "Plus Jakarta Sans", system-ui, sans-serif;
  cursor: pointer;
  color: var(--ink);
  background: linear-gradient(180deg, #ffe066, #ffc107);
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 4px 0 var(--accent-deep);
}
.party-card {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.row > * {
  flex: 1 1 140px;
}
button.secondary,
form button.secondary {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font: 700 14px "Plus Jakarta Sans", system-ui, sans-serif;
  cursor: pointer;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.75);
  width: 100%;
  box-shadow: 0 4px 14px rgba(15, 23, 40, 0.08);
  transition: background 0.12s ease;
}
button.secondary:hover {
  background: rgba(255, 255, 255, 0.72);
}
button.ghost {
  border: 0;
  background: transparent;
  color: #2a5fad;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
label {
  display: block;
  margin: 10px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: #4a6080;
}
input,
select {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid #b8cce8;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
}
.hint,
.err,
.ok {
  font-size: 13px;
  margin: 8px 0 0;
  color: var(--muted);
}
.err {
  color: #d62839;
}
.ok {
  color: #2a9d8f;
}
.signed-card {
  background: #f0f4fb;
  border-radius: 14px;
  padding: 14px;
}
.signed-card button {
  margin-top: 10px;
  background: #8ec8ff;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
#party-roster {
  margin: 8px 0 0;
  padding-left: 18px;
}
#party-roster li.you {
  font-weight: 800;
}
.room-code {
  font: 800 22px/1.2 system-ui, sans-serif;
  letter-spacing: 0.12em;
}

.confetti,
.confetti-burst {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}
.confetti-burst i {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti-fall 2.5s ease-in forwards;
}
@keyframes confetti-fall {
  to {
    transform: translateY(120px) rotate(720deg);
    opacity: 0;
  }
}
