/* Chọi Dép: home, big screen (host/OBS) and the phone controller. Builds on style.css (sticker style). */

/* ---------- shared bits ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; padding: 16px; }
.brand-shoe { font-size: 1.7rem; transform: rotate(-18deg); display: inline-block; }
.site-foot { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; padding: 24px 16px 32px; font-weight: 700; }
.site-foot a { color: var(--ink-soft); }
.team-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); vertical-align: -2px; }

/* ---------- home ---------- */
.home { max-width: 1100px; margin: 0 auto; padding: 8px 16px 24px; display: grid; gap: 24px; }
.home-hero { display: grid; gap: 12px; }
.home-hero h1 { font-size: clamp(2.6rem, 1.6rem + 4.5vw, 5rem); max-width: 14ch; }
.home-hero h1 em { font-style: normal; color: var(--tomato); }
.home-hero .lede { font-size: 1.15rem; font-weight: 600; line-height: 1.6; max-width: 60ch; margin: 0; }
.home-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.home-card { display: grid; gap: 12px; align-content: start; }
.home-card h2 { font-size: 1.6rem; }
.home-card p { margin: 0; font-weight: 600; color: var(--ink-soft); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.15em; }
.how { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.how li { display: grid; gap: 4px; background: #fff; border: var(--border); border-radius: 14px; padding: 14px; }
.how strong { font: 800 1.15rem var(--font-display); }
.how span { color: var(--ink-soft); font-weight: 600; }
.error { margin: 0; color: #c0392b; font-weight: 800; }

/* ---------- big screen ---------- */
.screen { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.screen-bar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; flex-wrap: wrap; }
.screen-bar .spacer { flex: 1; }
.scores { display: flex; gap: 10px; flex-wrap: wrap; }
.score { display: flex; align-items: center; gap: 8px; padding: 4px 14px; border: var(--border); border-radius: 999px; background: #fff; box-shadow: var(--shadow-sm); font: 800 1.4rem var(--font-display); }
.score b { color: #fff; padding: 0 10px; border-radius: 999px; border: 2px solid var(--ink); }
.score.out { opacity: 0.45; filter: grayscale(1); }
.mode-hint { margin: -4px 0 4px; color: var(--ink-soft); font-weight: 700; font-size: 0.95rem; }
.timer { font: 800 2rem var(--font-display); min-width: 4ch; text-align: right; }
.join-hint { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.join-hint img { width: 64px; height: 64px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; }
.join-hint code { font: 800 1.4rem var(--font-display); letter-spacing: 0.12em; }
.arena-wrap { position: relative; min-height: 0; padding: 0 12px 12px; }
#arena { width: 100%; height: 100%; display: block; }

.lobby { max-width: 1300px; width: 100%; margin: 0 auto; padding: 0 16px 16px; display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 18px; align-items: start; min-height: 0; overflow: auto; }
@media (max-width: 760px) { .lobby { grid-template-columns: 1fr; } }
.qr-card { display: grid; gap: 8px; justify-items: center; text-align: center; }
.qr-card img { width: min(100%, 320px); aspect-ratio: 1; border: var(--border); border-radius: 14px; background: #fff; }
.qr-card .code { font: 800 3rem var(--font-display); letter-spacing: 0.14em; line-height: 1; }
.qr-card .url { font-weight: 800; word-break: break-all; }
.lobby-main { display: grid; gap: 14px; align-content: start; min-width: 0; }
.settings { display: grid; gap: 12px; }
.setting-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.setting-row .eyebrow { min-width: 9ch; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { font: 800 0.95rem var(--font-body); border: 2px solid var(--ink); border-radius: 999px; background: #fff; padding: 5px 12px; cursor: pointer; }
.seg button[aria-checked='true'] { background: var(--ink); color: #fff; }
.seg button:focus-visible { outline: 3px dashed var(--tomato); outline-offset: 2px; }
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.team-col { border: var(--border); border-radius: 14px; background: #fff; overflow: hidden; }
.team-col h3 { color: #fff; padding: 8px 12px; border-bottom: var(--border); font-size: 1.2rem; display: flex; justify-content: space-between; }
.team-col ul { list-style: none; margin: 0; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; max-height: 40vh; overflow: auto; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 4px 2px 10px; font-weight: 700; background: var(--paper); }
.chip.off { opacity: 0.45; }
.chip button { border: 0; background: none; cursor: pointer; font-weight: 800; color: #c0392b; padding: 0 4px; }
.start-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.results { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(29, 26, 47, 0.45); padding: 16px; }
.results .card { max-width: 640px; width: 100%; text-align: center; justify-items: center; }
.results h2 { font-size: clamp(2rem, 1.4rem + 3vw, 3.4rem); }
.results .final { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; width: 100%; }
.award { border: var(--border); border-radius: 14px; padding: 10px; background: #fff; display: grid; gap: 2px; }
.award strong { font: 800 1.3rem var(--font-display); }

/* ---------- phone controller ---------- */
.play { min-height: 100vh; min-height: 100dvh; display: grid; }
.play-view { max-width: 520px; width: 100%; margin: 0 auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.picker { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.picker canvas { width: 100%; height: 160px; }
.picker-name { text-align: center; font: 800 1.2rem var(--font-display); margin: 0; }
.team-banner { color: #fff; border: var(--border); border-radius: 14px; padding: 12px; text-align: center; font: 800 1.4rem var(--font-display); box-shadow: var(--shadow-sm); }

.pad { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; touch-action: none; user-select: none; -webkit-user-select: none; background: var(--cream); }
.pad-view { position: relative; min-height: 0; }
.pad-view canvas { width: 100%; height: 100%; display: block; }
.keys-hint { display: none; position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; padding: 6px 14px; border: var(--border); border-radius: 999px; background: var(--paper); font-weight: 700; white-space: nowrap; }
.pad-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: #fff; font: 800 1.1rem var(--font-display); border-bottom: var(--border); }
.pad-bar .spacer { flex: 1; }
.pad-area { display: grid; grid-template-columns: 1.2fr 1fr; height: min(40vh, 300px); border-top: var(--border); background: var(--paper); }
/* Landscape phones: the arena fills the screen, the controls float over its lower corners. */
@media (orientation: landscape) and (pointer: coarse) {
  .pad { grid-template-rows: auto 1fr; }
  .pad-area { position: fixed; left: 0; right: 0; bottom: 0; height: 55vh; border: 0; background: none; pointer-events: none; }
  .stick-zone, .throw { pointer-events: auto; }
  .stick-zone { border: 0; }
  .throw { opacity: 0.85; }
}
/* Laptops / desktops: keyboard instead of the touch joystick. */
.desktop .stick-zone { display: none; }
.desktop .pad-area { grid-template-columns: 1fr; height: auto; padding: 10px; }
.desktop .throw { width: 120px; font-size: 1.4rem; }
.desktop .keys-hint { display: block; }
.stick-zone { position: relative; border-right: 3px dashed rgba(29, 26, 47, 0.2); touch-action: none; }
.stick-zone .hint { position: absolute; inset: auto 0 12px; text-align: center; color: var(--ink-soft); font-weight: 700; }
.stick { position: absolute; width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%; border: 4px solid var(--ink); background: rgba(255, 255, 255, 0.6); pointer-events: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: var(--sun); border: 4px solid var(--ink); }
.throw-zone { display: grid; place-items: center; }
.throw {
  width: min(42vw, 42vh, 220px); aspect-ratio: 1; border-radius: 50%; border: 5px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  background: conic-gradient(rgba(29, 26, 47, 0.35) calc(var(--cd, 0) * 1turn), var(--tomato) 0);
  color: #fff; font: 800 clamp(1.6rem, 6vw, 2.6rem) var(--font-display); display: grid; place-items: center; touch-action: none; cursor: pointer;
}
.throw:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--ink); }
.throw small { display: block; font-size: 1.6rem; line-height: 1; }
.pad.stunned::after { content: 'BỐP! Mất 1 mạng'; position: fixed; inset: 0; display: grid; place-items: center; background: rgba(230, 57, 70, 0.35); color: #fff; font: 800 2rem var(--font-display); -webkit-text-stroke: 1px var(--ink); pointer-events: none; }
.pad .waiting { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; text-align: center; background: rgba(255, 246, 229, 0.92); font: 800 1.5rem var(--font-display); padding: 16px; }
.pad .waiting small { font: 700 1rem var(--font-body); color: var(--ink-soft); }
/* Knocked out: a strip over the view (the arena stays visible underneath, following a teammate). */
.pad .waiting.spectate { inset: auto 0 0 0; background: rgba(29, 26, 47, 0.82); color: #fff; font-size: 1.2rem; padding: 10px 16px; }
.pad .waiting.spectate small { color: #f3e9d6; }
.pad.out .throw { filter: grayscale(1); opacity: 0.5; }
#me-lives { letter-spacing: 2px; }
