/* How Sky Scuffle looks. Colours are in the :root list at the top. */
:root {
  --bg: #2b2a6b;
  --card: #fff8ec;
  --ink: #241a3a;
  --muted: #7a6d8f;
  --red: #ff4d5e;
  --blue: #4da3ff;
  --yellow: #ffcf33;
  --green: #43d675;
  --radius: 18px;
  font-family: "Baloo 2", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(circle at 20% 0%, #5b5fd6 0, transparent 50%), radial-gradient(circle at 90% 100%, #c2477a 0, transparent 45%), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
button, input, select { font: inherit; }
h1, h2, h3 { font-family: "Lilita One", "Baloo 2", sans-serif; font-weight: 400; letter-spacing: .5px; }

.screen { max-width: 980px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* ---- Title */
.title { text-align: center; color: #fff; padding-top: 6px; }
.title h1 { font-size: clamp(54px, 14vw, 116px); margin: 0; line-height: .95; color: var(--yellow); text-shadow: 0 6px 0 #c2477a, 0 12px 20px rgba(0,0,0,.35); }
.title h1 span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.title h1 span + span { animation-delay: .3s; color: #fff; }
.title p { margin: 6px 0 0; font-size: 19px; opacity: .92; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
.home-fighters { width: 100%; height: 130px; display: block; }

/* ---- Cards and buttons */
.card { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.card h2, .card h3 { margin: 0 0 10px; }
.card h3 { font-size: 22px; }
.menu { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.menu .btn.ghost { grid-column: 1 / -1; justify-self: center; }
@media (max-width: 640px) { .menu { grid-template-columns: minmax(0, 1fr); } }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 700px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }
.hint { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.bar { display: flex; align-items: center; gap: 12px; color: #fff; }
.bar h2 { margin: 0; font-size: 30px; }

.btn {
  border: 0; border-radius: 14px; padding: 10px 18px; cursor: pointer; font-weight: 800; font-size: 18px;
  background: var(--red); color: #fff; box-shadow: 0 5px 0 #a8253a; transition: transform .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #a8253a; }
.btn.alt { background: var(--blue); box-shadow: 0 5px 0 #1f5fa8; }
.btn.green { background: #2fbf63; box-shadow: 0 5px 0 #1a8040; }
.btn.ghost { background: #efe4d2; color: var(--ink); box-shadow: 0 5px 0 #cdbfa6; }
.btn.big { font-size: 22px; padding: 14px 22px; }
.btn.huge { font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 34px; padding: 10px 46px; background: var(--yellow); color: #3a2400; box-shadow: 0 6px 0 #c48a00; }
.btn.small { font-size: 16px; padding: 6px 14px; }
.btn:disabled { opacity: .5; cursor: default; }

.name-card { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: 20px; flex-wrap: wrap; }
.name-card strong { font-size: 24px; }

.how summary { font-family: "Lilita One", sans-serif; font-size: 22px; cursor: pointer; }
.how li { margin: 6px 0; }
footer { text-align: center; padding-bottom: 12px; color: #e8dcff; }
footer a { color: #e8dcff; }

/* ---- Picking fighters */
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.slot { background: var(--card); border-radius: var(--radius); padding: 10px; box-shadow: 0 6px 0 rgba(0,0,0,.25); border-top: 10px solid var(--seat); display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: center; }
.slot.off { opacity: .55; }
.slot .seat { font-family: "Lilita One", sans-serif; font-size: 22px; color: var(--seat); -webkit-text-stroke: 1px rgba(0,0,0,.25); }
.slot select { width: 100%; border-radius: 10px; border: 2px solid #dccfbb; padding: 4px; background: #fff; }
.slot canvas { width: 100%; height: 120px; display: block; }
.pick-row { display: flex; align-items: center; gap: 4px; }
.pick-row canvas { flex: 1; min-width: 0; }
.arrow { border: 0; background: #efe4d2; border-radius: 10px; font-size: 22px; padding: 2px 10px; cursor: pointer; font-weight: 800; }
.fname { font-family: "Lilita One", sans-serif; font-size: 22px; }
.fwhat { font-size: 13px; color: var(--muted); line-height: 1.2; min-height: 32px; }
.pal { border: 0; background: none; font-size: 14px; color: var(--muted); cursor: pointer; text-decoration: underline; }
.settings label { display: flex; gap: 6px; align-items: center; font-weight: 700; }
.settings select { border-radius: 10px; border: 2px solid #dccfbb; padding: 4px 6px; background: #fff; }
.stage-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
@media (max-width: 640px) { .stage-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stage-card { border: 3px solid transparent; border-radius: 14px; padding: 0; overflow: hidden; background: #2b2a6b; color: #fff; cursor: pointer; text-align: left; }
.stage-card canvas { width: 100%; height: 70px; display: block; }
.stage-card span { display: block; padding: 4px 8px; font-weight: 800; }
.stage-card.on { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255,207,51,.4); }
.stage-card:disabled { cursor: default; }

/* ---- Controls */
.keys { width: 100%; border-collapse: collapse; margin: 8px 0; }
.keys th, .keys td { padding: 5px 6px; text-align: left; border-bottom: 1px solid #eadfcc; }
.key-btn { border: 2px solid #dccfbb; background: #fff; border-radius: 10px; padding: 4px 10px; min-width: 76px; cursor: pointer; font-weight: 800; }
.key-btn.waiting { border-color: var(--blue); background: #e2f0ff; }

/* ---- Online */
.join-row { display: flex; gap: 10px; }
.join-row input {
  flex: 1; min-width: 0; font-size: 28px; font-weight: 800; letter-spacing: 8px; text-transform: uppercase; text-align: center;
  border: 3px solid #dccfbb; border-radius: 14px; padding: 4px 10px; background: #fff; color: var(--ink);
}
.join-row input:focus { outline: none; border-color: var(--blue); }
.rooms-title { margin-top: 16px !important; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); display: inline-block; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.room-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.room-list li.room { display: flex; align-items: center; gap: 10px; background: #f3e9d6; border-radius: 12px; padding: 8px 10px; }
.room-list .code { font-weight: 800; letter-spacing: 2px; font-size: 18px; }
.room-list .info { flex: 1; font-size: 14px; color: var(--muted); line-height: 1.2; }

.code-card { text-align: center; }
.room-code { font-family: "Lilita One", sans-serif; font-size: 60px; letter-spacing: 12px; line-height: 1.1; }
.pill { background: #efe4d2; border-radius: 99px; padding: 2px 12px; font-weight: 700; }
.my-pick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .my-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pick-card { border: 3px solid transparent; background: #f3e9d6; border-radius: 14px; padding: 4px; cursor: pointer; text-align: center; font-weight: 800; }
.pick-card canvas { width: 100%; height: 86px; display: block; }
.pick-card.on { border-color: var(--red); background: #ffe7e3; }
.lobby-players { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lobby-players li { display: flex; gap: 10px; align-items: center; background: #f3e9d6; border-radius: 12px; padding: 4px 10px; border-left: 8px solid var(--seat, #ccc); }
.lobby-players li canvas { width: 46px; height: 46px; }
.lobby-players .who { flex: 1; font-weight: 800; }
.lobby-players .tag { font-size: 13px; color: var(--muted); font-weight: 700; }

/* ---- The fight */
#game { position: fixed; inset: 0; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; }
#canvas { width: 100%; height: 100%; display: block; }
.corner-btn { position: absolute; top: 10px; right: 10px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); font-size: 20px; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.emote-bar { position: absolute; top: 10px; right: 64px; display: flex; flex-direction: row-reverse; gap: 6px; align-items: flex-start; }
.emote-bar .corner-btn { position: static; }
.emotes { display: flex; flex-wrap: wrap; gap: 6px; max-width: 260px; }
.emotes button { border: 0; background: #fff; border-radius: 12px; padding: 4px 8px; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.spectating { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; padding: 6px 14px; border-radius: 99px; font-weight: 700; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,8,30,.55); padding: 16px; }
.overlay .card { max-width: 480px; width: 100%; text-align: center; max-height: 100%; overflow-y: auto; }
.results-card h2 { font-size: 34px; }
.winner-pic { width: 160px; height: 150px; display: block; margin: 0 auto; }
.results-list { text-align: left; padding: 0; list-style: none; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.results-list li { display: flex; gap: 8px; align-items: center; background: #f3e9d6; border-radius: 12px; padding: 6px 10px; border-left: 8px solid var(--seat); }
.results-list .place { font-family: "Lilita One", sans-serif; font-size: 24px; width: 34px; }
.results-list .who { flex: 1; font-weight: 800; line-height: 1.1; }
.results-list .who small { display: block; color: var(--muted); font-weight: 600; }
.results-list .stat { font-size: 13px; color: var(--muted); text-align: right; line-height: 1.2; }

/* On-screen controls for phones and tablets. */
.touch-zone { position: absolute; left: 0; top: 60px; bottom: 0; width: 50%; touch-action: none; }
.stick { position: absolute; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.18); border: 3px solid rgba(255,255,255,.5); pointer-events: none; }
.stick .knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.8); }
.touch-buttons { position: absolute; right: 12px; bottom: 100px; width: 210px; height: 190px; }
.tbtn { position: absolute; border: 0; border-radius: 50%; color: #fff; font-weight: 800; font-size: 26px; touch-action: none; box-shadow: 0 4px 0 rgba(0,0,0,.35); opacity: .88; user-select: none; -webkit-user-select: none; }
.tbtn.down { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); opacity: 1; }
.tbtn.attack { width: 92px; height: 92px; right: 0; bottom: 0; background: var(--red); font-size: 38px; }
.tbtn.special { width: 74px; height: 74px; right: 100px; bottom: 6px; background: var(--blue); font-size: 32px; }
.tbtn.jump { width: 70px; height: 70px; right: 14px; bottom: 104px; background: var(--green); font-size: 32px; }
.tbtn.guard { width: 60px; height: 60px; right: 100px; bottom: 96px; background: #9a7bff; font-size: 24px; }
@media (max-height: 430px) { .touch-buttons { bottom: 70px; transform: scale(.85); transform-origin: bottom right; } }

.turn-hint { display: none; position: absolute; top: 64px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; padding: 6px 14px; border-radius: 99px; font-weight: 700; white-space: nowrap; font-size: 14px; pointer-events: none; animation: fadeout 6s forwards; }
@media (orientation: portrait) and (pointer: coarse) { .turn-hint { display: block; } }
@keyframes fadeout { 80% { opacity: 1; } 100% { opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #241a3a; color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 50; max-width: 90vw; text-align: center; }
.mute { position: fixed; left: 10px; bottom: 10px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); font-size: 20px; cursor: pointer; z-index: 40; }
body.playing .mute { top: 10px; bottom: auto; }
