:root {
  --ink: #2a2158;
  --line: #2a2158;
  --sky-0: #b7e4ff;
  --sky-1: #e7d6ff;
  --sky-2: #f7c8ef;
  font-family: "Fredoka", "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #9fd8ff 0%, #d9c8ff 46%, #f3c6ef 100%);
  overflow-x: hidden;
}

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

button {
  border: 3px solid var(--line);
  background: #ff5a36;
  color: white;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 #c13b22;
}

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

button.settings {
  all: unset;
  box-sizing: border-box;
  position: fixed;
  top: 16px;
  right: 16px;
  width: 58px;
  height: 58px;
  min-width: 58px;
  max-width: 58px;
  padding: 0;
  margin: 0;
  border: 4px solid #2a2158;
  border-radius: 50%;
  background: linear-gradient(180deg, #b388ff, #7a4dff);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  z-index: 40;
  line-height: 0;
  box-shadow: 0 5px 0 #4d2bb8;
}

button.settings svg { width: 28px; height: 28px; display: block; pointer-events: none; }

#settingsPanel {
  display: none;
  position: fixed;
  top: 84px;
  right: 16px;
  width: 260px;
  padding: 16px;
  background: #fffdf8;
  border: 4px solid var(--line);
  border-radius: 22px;
  z-index: 40;
  box-shadow: 0 8px 0 rgba(42, 33, 88, 0.15);
}

#settingsPanel.open { display: grid; gap: 12px; }
#settingsPanel h3 { margin: 0; font-size: 1.05rem; }

#settingsPanel label {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

#settingsPanel input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  border-radius: 999px;
  border: 3px solid var(--line);
  background: linear-gradient(90deg, #6d5efc, #3ec6ff);
  cursor: pointer;
}

#settingsPanel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--line);
  box-shadow: 0 2px 0 #243044;
}

#settingsPanel input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--line);
}

.sky-bits { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
body:has(#game:not([hidden])) .sky-bits { display: none; }

.cloud {
  position: absolute;
  background: #fff;
  border-radius: 40px;
  height: 36px;
  opacity: 0.95;
  filter: drop-shadow(0 8px 0 rgba(255, 255, 255, 0.35));
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.cloud::before { width: 42px; height: 42px; left: 16px; top: -22px; }
.cloud::after { width: 58px; height: 58px; right: 14px; top: -30px; }
.c1 { width: 130px; top: 8%; left: 4%; }
.c2 { width: 160px; top: 16%; right: 6%; }
.c3 { width: 110px; top: 42%; left: -2%; }
.c4 { width: 140px; bottom: 18%; right: 2%; }
.c5 { width: 90px; bottom: 8%; left: 18%; opacity: 0.8; }

.float { position: absolute; filter: drop-shadow(3px 6px 0 rgba(42, 33, 88, 0.18)); }
.f-die1 { width: 74px; top: 9%; left: 1.5%; animation: bob 4.6s ease-in-out infinite; }
.f-die2 { width: 64px; top: 46%; right: 1.5%; animation: bob 5.2s ease-in-out infinite reverse; }
.f-die3 { width: 48px; bottom: 10%; right: 6%; animation: bob 4.2s ease-in-out infinite; }
.f-pawn1 { width: 46px; bottom: 16%; left: 2%; animation: bob 5s ease-in-out infinite; }
.f-pawn2 { width: 36px; top: 40%; left: 1%; animation: bob 4.4s ease-in-out infinite reverse; }
.f-pawn3 { width: 42px; top: 7%; right: 2%; animation: bob 5.4s ease-in-out infinite; }
.f-pawn4 { width: 34px; bottom: 22%; right: 2%; animation: bob 4.8s ease-in-out infinite reverse; }

.spark {
  position: absolute;
  font-weight: 800;
  color: #ffe14a;
  text-shadow: 0 3px 0 #7a4dff;
  animation: bob 3.6s ease-in-out infinite;
}
.s1 { top: 8%; left: 10%; font-size: 28px; color: #ffe14a; }
.s2 { top: 14%; right: 12%; font-size: 22px; color: #ff7ad9; }
.s3 { bottom: 30%; left: 3%; font-size: 20px; color: #7ec8ff; }
.s4 { top: 32%; right: 3%; font-size: 26px; color: #b388ff; }
.s5 { bottom: 12%; left: 14%; font-size: 24px; color: #ffe14a; }

.confetti { position: absolute; width: 12px; height: 12px; border-radius: 3px; transform: rotate(18deg); }
.k1 { background: #ff5a36; top: 26%; left: 40%; }
.k2 { background: #37c15b; top: 40%; right: 32%; }
.k3 { background: #7a4dff; bottom: 34%; left: 36%; }
.k4 { background: #ffd23f; top: 62%; right: 24%; width: 10px; height: 16px; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-10px) rotate(6deg); }
}

#app { position: relative; z-index: 1; width: 100%; margin: 0; }
#setup { width: min(1120px, calc(100% - 28px)); margin: 8px auto 28px; }

.landing {
  min-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 8px 12px;
}

.brand-chip {
  margin: 8px 0 0;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #5b3fd6;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: 0 6px 0 rgba(90, 60, 160, 0.08);
}

.hero-title {
  margin: 10px 0 8px;
  font-family: "Lilita One", "Fredoka", "Trebuchet MS", sans-serif;
  font-weight: 400;
  font-size: clamp(4.4rem, 12vw, 8.2rem);
  line-height: 0.82;
  letter-spacing: 0.01em;
}

.hero-title span {
  display: block;
  color: #ffe14a;
  -webkit-text-stroke: 10px #6a2db8;
  paint-order: stroke fill;
  text-shadow:
    0 7px 0 #5a22a8,
    0 14px 0 #3d1578,
    6px 18px 0 rgba(61, 21, 120, 0.28);
}

.hero-title .line-meno {
  color: #7fd4ff;
  -webkit-text-stroke-color: #5b2d9e;
  text-shadow:
    0 7px 0 #4e2496,
    0 14px 0 #341668,
    6px 18px 0 rgba(52, 22, 104, 0.28);
  font-size: 0.92em;
}

.cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.cta button, #startBtn, #joinBtn, #copyCode, #copyInvite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-width: 4px;
  border-bottom-width: 8px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

#createBtn {
  min-width: 250px;
  font-size: 1.2rem;
  background: linear-gradient(180deg, #ffe56a 0%, #ffc400 100%);
  color: #3a2a08;
  border-color: #2a2158;
  border-bottom-color: #c99200;
  box-shadow: 0 8px 0 #a87400;
}
#createBtn:hover { transform: translateY(1px); box-shadow: 0 6px 0 #a87400; }

#joinFocus {
  min-width: 260px;
  font-size: 1.2rem;
  background: linear-gradient(180deg, #6aabff 0%, #2f74f0 100%);
  color: #fff;
  border-color: #2a2158;
  border-bottom-color: #1a4cb5;
  box-shadow: 0 8px 0 #143e96;
}
#joinFocus:hover { transform: translateY(1px); box-shadow: 0 6px 0 #143e96; }

.btn-ico { width: 26px; height: 26px; flex: 0 0 26px; display: block; }
.btn-ico.plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  max-width: 34px;
  min-height: 34px;
  max-height: 34px;
  flex: 0 0 34px;
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: #fff6c2;
  border: 3px solid #3a2a08;
  box-sizing: border-box;
  line-height: 0;
  overflow: hidden;
}
.btn-ico.plus svg { display: block; width: 16px; height: 16px; flex: 0 0 16px; }

.code-wrap {
  position: relative;
  width: min(680px, 100%);
  margin-top: 78px;
  display: grid;
  justify-items: center;
  gap: 14px;
}
.code-rule {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  border-top: 3px dashed rgba(255, 255, 255, 0.85);
  z-index: 0;
}
.code-pill {
  position: relative;
  z-index: 1;
  margin: 0;
  background: linear-gradient(180deg, #9a6bff, #6d3df0);
  color: #fff;
  font-weight: 800;
  border-radius: 999px;
  padding: 8px 18px;
  border: 3px solid #2a2158;
  border-bottom-width: 6px;
  box-shadow: 0 4px 0 #4a22b0;
}

.code-join {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 4px solid #efe8ff;
  border-radius: 999px;
  padding: 8px 8px 8px 18px;
  box-shadow: 0 12px 28px rgba(80, 60, 150, 0.16);
}
.code-join.nudge { animation: nudge 0.35s ease; }
@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
}

.hash { font-weight: 800; color: #7a4dff; font-size: 1.45rem; }
#codeInput, #nameInput, #roomCode, #inviteLink {
  border: 0;
  background: transparent;
  font-weight: 700;
}
#codeInput {
  flex: 1;
  min-width: 0;
  font-size: 1.12rem;
  padding: 0.45rem 0;
  outline: none;
}
#joinBtn {
  background: linear-gradient(180deg, #b388ff, #7a4dff);
  color: #fff;
  border-color: #2a2158;
  border-bottom-color: #5428c9;
  box-shadow: 0 5px 0 #3d1a9a;
  padding: 0.7rem 1.15rem;
  white-space: nowrap;
}

.features {
  margin-top: auto;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 28px;
  box-shadow: 0 14px 32px rgba(80, 60, 150, 0.14);
}
.features > div {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  text-align: left;
  padding: 8px 10px;
  min-height: 72px;
}
.features b { display: block; font-size: 0.98rem; line-height: 1.15; }
.features > div > div span { display: block; color: #6a6288; font-weight: 600; font-size: 0.86rem; line-height: 1.2; }
.features .bubble {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  flex: 0 0 52px;
  align-self: center;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #2a2158;
  box-sizing: border-box;
  box-shadow: 0 4px 0 rgba(42, 33, 88, 0.18);
  line-height: 0;
  padding: 0;
}
.features .bubble svg { display: block; width: 26px; height: 26px; margin: 0; }
.bubble.y { background: #ffe14a; }
.bubble.b { background: #3d8bff; }
.bubble.g { background: #37c15b; }
.bubble.p { background: #8d5cff; }
.hint { color: #5c5678; min-height: 1.2em; font-weight: 700; }
.version, .host-note { text-align: center; color: #4d4670; font-weight: 800; margin: 8px 0 0; }
.host-note { font-size: 1.05rem; }

#lobby {
  min-height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
  padding: 8px 0 16px;
}
.lobby-top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  padding: 6px 0 4px;
}
.lobby-title {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 4.4rem);
}
.lobby-title span {
  -webkit-text-stroke-width: 6px;
  text-shadow: 0 4px 0 #5a22a8, 0 8px 0 #3d1578;
}
button.leave-lobby {
  all: unset;
  box-sizing: border-box;
  position: fixed;
  top: 16px;
  right: 86px;
  width: 58px;
  height: 58px;
  min-width: 58px;
  max-width: 58px;
  padding: 0;
  margin: 0;
  border: 4px solid #2a2158;
  border-radius: 50%;
  background: linear-gradient(180deg, #6aabff, #2f74f0);
  box-shadow: 0 5px 0 #143e96;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 40;
  line-height: 0;
}
button.leave-lobby svg { width: 26px; height: 26px; display: block; pointer-events: none; }

.party-logo { text-align: center; line-height: 0.9; filter: drop-shadow(0 8px 0 rgba(90, 40, 160, 0.12)); }
.party-word {
  margin: 0;
  font-family: "Lilita One", "Fredoka", sans-serif;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: 0.04em;
  -webkit-text-stroke: 6px #2a2158;
  paint-order: stroke fill;
}
.party-word span:nth-child(1) { color: #ff4b4b; }
.party-word span:nth-child(2) { color: #ff9a1f; }
.party-word span:nth-child(3) { color: #ffe14a; }
.party-word span:nth-child(4) { color: #37c15b; }
.party-word span:nth-child(5) { color: #3d8bff; }
.party-word span:nth-child(6) { color: #b06bff; }
.party-banner {
  margin: 2px auto 0;
  width: fit-content;
  background: #fff;
  color: #2a2158;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 4px 16px 6px;
  border-radius: 8px;
  transform: rotate(-2deg);
  border: 3px solid #2a2158;
}
.party-ribbon {
  margin: 6px auto 0;
  width: fit-content;
  background: linear-gradient(180deg, #b06bff, #7a3df0);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 0.92rem;
  padding: 6px 18px;
  border-radius: 999px;
  border: 3px solid #2a2158;
  border-bottom-width: 6px;
  box-shadow: 0 4px 0 #4a22b0;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: stretch;
  margin-top: 8px;
}
.panel {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 28px;
  padding: 0 14px 16px;
  text-align: left;
  box-shadow: 0 16px 0 rgba(42, 33, 88, 0.08);
}
.players-panel { border: 6px solid #7a4dff; }
.avatar-panel { border: 6px solid #22c3d6; background: linear-gradient(180deg, #f3fbff, #fff); }
.panel h2 {
  margin: 0 -14px 14px;
  padding: 12px 16px;
  color: white;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 1.25rem;
  border-radius: 20px 20px 0 0;
}
.players-panel h2 { background: linear-gradient(180deg, #9a6bff, #6a35f0); }
.avatar-panel h2 { background: linear-gradient(180deg, #3ad4e6, #14b0c4); }
.h-crown { float: right; color: #ffe14a; text-shadow: 0 2px 0 #2a2158; }

.slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.slots { gap: 12px; }
.slot {
  position: relative;
  min-height: 176px;
  border-radius: 18px;
  border: 4px dashed #c9b4ff;
  background: #fbf8ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 40px 10px 12px;
  text-align: center;
}
.slot.filled {
  border-style: solid;
  border-color: var(--slot, #7a4dff);
  background: linear-gradient(180deg, #fff, #f6f2ff);
}
.slot-num {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  background: #7a4dff;
  border: 2px solid #2a2158;
}
.slot.filled .slot-num { background: var(--slot, #7a4dff); color: #fff; }
.slot-avatar {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  border: 4px solid var(--slot, #7a4dff);
  background-color: #fff;
  background-image: url("avatars.jpg?v=4");
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: calc(var(--col, 0) * 100% / 3) calc(var(--row, 0) * 100%);
  box-shadow: 0 4px 0 rgba(42, 33, 88, 0.12);
  margin-top: 6px;
}
.slot b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}
.ready {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #178a3a;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.ready::before { content: "✓"; }
.slot-q {
  font-family: "Lilita One", "Fredoka", sans-serif;
  font-size: 3.2rem;
  color: #8d5cff;
  line-height: 1;
  margin-top: auto;
}
.slot-free {
  margin: 0;
  color: #8d5cff;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.name-block { margin-top: 14px; }
.name-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.name-label, .code-row label, .invite-row label {
  display: block;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: #5b3fd6;
}
.free-label { font-weight: 800; color: #8d5cff; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.name-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 4px solid #7a4dff;
  border-radius: 18px;
  padding: 6px 10px;
  box-shadow: 0 5px 0 #d9ccff;
}
.pencil {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #7a4dff;
  color: #fff;
  font-weight: 800;
}
#nameInput { flex: 1; min-width: 0; font-size: 1.15rem; font-weight: 800; outline: none; padding: 6px 4px; }
.name-hint { margin: 4px 0 0; color: #7a7396; font-weight: 700; font-size: 0.85rem; }

.host-badge {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: #eefbf1;
  border: 3px solid #37c15b;
  border-radius: 16px;
  padding: 8px 12px;
  font-weight: 800;
  color: #146b32;
}
.host-badge p { margin: 0; }
.shield {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #37c15b;
  color: #fff;
  border: 3px solid #146b32;
  font-weight: 800;
}

.room-tools { margin-top: 12px; }
.code-row, .invite-line, .hud, .piece-buttons, .win-mode { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.invite-row { margin-top: 8px; }
#roomCode, #inviteLink {
  border: 3px solid #e4dcff;
  border-radius: 14px;
  padding: 0.55rem 0.7rem;
  background: #fff;
}
#roomCode { width: 110px; font-size: 1.2rem; font-weight: 800; letter-spacing: 0.14em; text-align: center; }
#inviteLink { flex: 1; min-width: 140px; }
#copyCode, #copyInvite {
  background: linear-gradient(180deg, #6aabff, #2f74f0);
  border-bottom-color: #1a4cb5;
  box-shadow: 0 4px 0 #143e96;
  padding: 0.55rem 0.9rem;
}
#copyInvite { background: linear-gradient(180deg, #b388ff, #7a4dff); border-bottom-color: #5428c9; box-shadow: 0 4px 0 #3d1a9a; }
.win-mode { display: grid; margin-top: 12px; gap: 8px; }
.win-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  border: 3px solid #e4dcff;
  border-radius: 14px;
  background: #f8f5ff;
  font-weight: 800;
  cursor: pointer;
}
.win-opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.win-ui {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 8px;
  border: 3px solid #2a2158;
  background: #fff;
  box-shadow: 0 3px 0 #d5c8ff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.win-opt input:checked + .win-ui {
  background: #7a4dff;
  box-shadow: 0 3px 0 #4a22b0;
}
.win-opt input:checked + .win-ui::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #fff;
}
.win-opt:has(input:checked) {
  border-color: #7a4dff;
  background: #f3ecff;
}
.win-opt:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }

.avatar-carousel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 6px;
}
.avatars {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  flex: 1;
  padding: 10px 6px 14px;
}
.avatars::-webkit-scrollbar { display: none; }
.avatar-btn, .slot-avatar { background-image: url("avatars.jpg?v=4"); background-repeat: no-repeat; }
.avatar-btn {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  padding: 0;
  border-radius: 14px;
  border: 4px solid #d7e7c8;
  background-color: #fff;
  background-size: 400% 200%;
  background-position: calc(var(--col, 0) * 100% / 3) calc(var(--row, 0) * 100%);
  box-shadow: 0 4px 0 rgba(42, 33, 88, 0.08);
  scroll-snap-align: start;
}
.avatar-btn.selected { border-color: #ffd23f; box-shadow: 0 0 0 4px #ffe14a, 0 4px 0 rgba(42, 33, 88, 0.08); }
.avatar-btn.taken, .color-btn.taken { opacity: 0.38; filter: grayscale(0.55); cursor: not-allowed; }
.arrow {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  padding: 0;
  border-radius: 50%;
  border-width: 4px;
  border-bottom-width: 6px;
  background: linear-gradient(180deg, #c9a6ff, #8d5cff);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  box-shadow: 0 4px 0 #5428c9;
}
.carousel-dots { display: flex; justify-content: center; gap: 8px; margin: 4px 0 8px; }
.dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: #d5d0e6;
  box-shadow: none;
}
.dot.on { background: #7a4dff; width: 22px; border-radius: 999px; }

.color-label { margin: 8px 0; font-weight: 800; color: #1497ad; text-align: center; text-transform: uppercase; letter-spacing: 0.04em; }
.colors { display: flex; gap: 12px; justify-content: center; }
.color-btn {
  width: 54px;
  height: 54px;
  padding: 0;
  border-radius: 50%;
  border: 4px solid #2a2158;
  border-bottom-width: 7px;
  box-shadow: 0 3px 0 rgba(42, 33, 88, 0.15);
}
.color-btn.selected { outline: 4px solid #ffe14a; outline-offset: 2px; }
.pick-note {
  margin: 16px 8px 4px;
  border: 3px dashed #7a4dff;
  border-radius: 18px;
  padding: 14px 12px;
  color: #6d4aff;
  font-weight: 800;
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
}

.lobby-bottom { margin-top: 18px; }
#startBtn {
  display: flex;
  width: min(640px, 100%);
  margin: 0 auto;
  background: linear-gradient(180deg, #7adf55, #2fa83a);
  color: #fff;
  border-color: #145c24;
  border-bottom-color: #145c24;
  border-radius: 28px;
  box-shadow: 0 10px 0 #187028;
  font-family: "Lilita One", "Fredoka", sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.85rem 1.4rem 0.7rem;
  text-shadow: 0 3px 0 #187028;
}
#startBtn:hover:not(:disabled) { transform: translateY(2px); box-shadow: 0 7px 0 #187028; }

#game {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 270px;
  gap: 14px;
  align-items: center;
  padding: 12px;
  box-sizing: border-box;
}

.infobox {
  padding: 16px 16px 12px;
  background: rgba(255, 255, 255, 0.84);
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(80, 110, 160, 0.18);
  backdrop-filter: blur(8px);
}
.infobox h2 { margin: 0 0 8px; font-size: 1.15rem; }
.infobox ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.infobox li { font-weight: 700; }

.board-col {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#rollBtn { background: #2a9d4a; box-shadow: 0 5px 0 #1d7034; flex: 0 0 auto; }
.hud {
  width: min(100%, 920px);
  height: 76px;
  min-height: 76px;
  max-height: 76px;
  overflow: hidden;
  justify-content: center;
  flex: 0 0 76px;
}
#status {
  margin: 0;
  font-weight: 800;
  text-align: center;
  height: 2.8em;
  line-height: 1.35;
  overflow: auto;
  flex: 1;
}
#board {
  width: min(100%, calc(100vh - 168px));
  height: min(100%, calc(100vh - 168px));
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: block;
  margin: 0 auto;
  border-radius: 28px;
  touch-action: none;
  box-shadow: 0 16px 40px rgba(80, 110, 160, 0.22);
}
.piece-buttons {
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  width: min(100%, 920px);
  overflow: auto hidden;
  flex: 0 0 58px;
  flex-wrap: nowrap;
  justify-content: center;
}
.piece-btn { background: #fff4c2; color: var(--ink); min-width: 130px; box-shadow: 0 4px 0 #e0b84a; }

.items ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item-row { display: flex; gap: 8px; align-items: flex-start; text-align: left; }
.item-ico {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; border: 0; font-size: 1rem;
  object-fit: contain;
}
.item-row b { display: block; font-size: 0.92rem; }
.item-row span { display: block; font-weight: 700; font-size: 0.78rem; line-height: 1.25; color: #3c4658; }

.pickup {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(24, 18, 48, 0.48);
  display: grid; place-items: center; padding: 18px;
}
.pickup-card {
  width: min(460px, 100%);
  background: #fffdf8;
  border: 6px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 12px 0 rgba(36, 48, 68, 0.18);
  padding: 22px 22px 18px;
  text-align: center;
}
.pickup-card p { margin: 0 0 14px; font-weight: 800; font-size: 1.15rem; }
#pickupOk { background: #7a4dff; box-shadow: 0 5px 0 #5a32d6; }
.hit-banner {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  background: #fffdf8;
  border: 4px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(80, 110, 160, 0.28);
  padding: 14px 22px;
  font-weight: 800;
  font-size: 1.25rem;
  text-align: center;
  max-width: min(560px, calc(100% - 32px));
}
.win-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#newGameBtn { background: #2a9d4a; box-shadow: 0 5px 0 #1d7034; }
#leaveGameBtn { background: #ff5a36; box-shadow: 0 5px 0 #c13b22; }

@media (max-width: 980px) {
  .features, .lobby-grid, #game { grid-template-columns: 1fr; }
  .features > div { border-top: 0; }
  .board-col { order: -1; }
  #board { width: min(92vw, calc(100vh - 168px)); height: min(92vw, calc(100vh - 168px)); }
  .hero-title { font-size: 4rem; }
  .hero-title span { -webkit-text-stroke-width: 6px; text-shadow: 0 5px 0 #5a22a8, 0 9px 0 #3d1578; }
  .f-pawn2, .f-die3, .s3, .k3 { display: none; }
  .lobby-title { font-size: 3rem; }
  button.leave-lobby { right: 82px; top: 16px; }
}

@media (max-width: 640px) {
  .features { grid-template-columns: 1fr 1fr; }
  .cta button { width: 100%; }
  .slot { min-height: 148px; padding: 34px 8px 10px; }
  .slot-avatar { width: 56px; height: 56px; border-radius: 12px; }
  .slot-q { font-size: 2.2rem; }
  .hero-title { font-size: 3.3rem; }
}
