/* styles.css: how Corner Pocket's menus, players' cards and controls look. The table itself is drawn on the canvas. */
:root {
  --felt: #0f6b3f;
  --felt-dark: #0a4a2c;
  --wood: #6b3a1e;
  --cream: #fff6dc;
  --gold: #f2c230;
  --ink: #1b1410;
  --red: #d8312a;
  --panel: rgba(18, 12, 8, 0.86);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #08301d; color: var(--cream); font-family: 'Nunito', system-ui, sans-serif; font-weight: 600; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#table { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; font-weight: 800; color: var(--ink); background: var(--cream); border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
button.big { font-size: 1.1rem; padding: 13px 18px; background: var(--gold); }
button.ghost { background: transparent; color: var(--cream); box-shadow: none; text-decoration: underline; }
button:disabled { opacity: 0.5; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4, 20, 12, 0.55); z-index: 10; }
#title { background: radial-gradient(circle at 50% 40%, rgba(15, 107, 63, 0.6), rgba(4, 25, 15, 0.92)); }
.card { background: var(--panel); border: 3px solid var(--wood); border-radius: 18px; padding: 22px; width: min(420px, 100%); max-height: 100%; overflow: auto; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.card.wide { width: min(620px, 100%); text-align: left; }
.card h2 { font-family: 'Lilita One', sans-serif; font-weight: 400; color: var(--gold); margin: 0 0 10px; font-size: 1.8rem; letter-spacing: 1px; text-align: center; }
.logo { font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: clamp(2rem, 8vw, 2.8rem); margin: 0; letter-spacing: 2px; color: var(--cream); }
.logo em { font-style: normal; color: var(--gold); }
.ball8 { display: inline-flex; align-items: center; justify-content: center; width: 1.1em; height: 1.1em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #555, #111 60%); color: #111; font-size: 0.8em; vertical-align: 0.05em; position: relative; }
.ball8::before { content: ''; position: absolute; width: 0.62em; height: 0.62em; border-radius: 50%; background: #fff; }
.ball8 { font-family: 'Nunito', sans-serif; font-weight: 800; }
.ball8 { isolation: isolate; }
.ball8::before { z-index: -1; }
.sub { margin: 6px 0 4px; opacity: 0.9; }
.who { margin: 4px 0 14px; color: var(--gold); min-height: 1.2em; }
.small { font-size: 0.9rem; opacity: 0.9; }
.error { color: #ff9a8f; font-size: 0.9rem; }
.buttons { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; font: inherit; font-weight: 800; font-size: 1.2rem; letter-spacing: 6px; text-align: center; text-transform: uppercase; border-radius: 12px; border: 2px solid var(--wood); padding: 8px; background: #fffbea; color: var(--ink); }
.links { display: flex; justify-content: center; gap: 18px; margin: 14px 0 0; }
.links a { color: var(--cream); opacity: 0.85; }
.code { font-family: 'Lilita One', sans-serif; font-size: 3rem; letter-spacing: 10px; color: var(--gold); margin: 6px 0; }
.rules { padding-left: 20px; line-height: 1.45; }
.rules li { margin-bottom: 6px; }

/* The players' cards along the top. */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud button, #hud .track, #emotes { pointer-events: auto; }
#players { position: absolute; top: calc(6px + env(safe-area-inset-top)); left: 8px; right: 8px; display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.pcard { background: var(--panel); border: 2px solid transparent; border-radius: 12px; padding: 5px 10px; min-width: 120px; max-width: 38%; transition: border-color 0.2s, box-shadow 0.2s; }
.pcard.turn { border-color: var(--gold); box-shadow: 0 0 12px rgba(242, 194, 48, 0.6); }
.pcard.away { opacity: 0.55; }
.pname { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
.pballs { display: flex; gap: 3px; min-height: 16px; margin-top: 3px; flex-wrap: wrap; }
.mini { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.25); }
.mini.stripe { background-clip: padding-box; }
.pgroup { font-size: 0.75rem; opacity: 0.8; }
.pclock { height: 4px; background: rgba(255, 255, 255, 0.15); border-radius: 2px; margin-top: 4px; overflow: hidden; visibility: hidden; }
.pclock.on { visibility: visible; }
.pclock i { display: block; height: 100%; width: 100%; background: var(--gold); }
.pclock.low i { background: var(--red); }
#msg { flex: 1; text-align: center; font-weight: 800; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); padding-top: 6px; font-size: 1rem; min-height: 1.2em; }

/* The buttons down the side. */
#side { position: absolute; left: calc(8px + env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; }
.round { width: 46px; height: 46px; border-radius: 50%; padding: 0; font-size: 1.2rem; background: var(--panel); color: var(--cream); border: 2px solid var(--wood); }
.round.spin { background: #fffbea; position: relative; }
.round.spin i { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--red); left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* The power bar: pull the handle down (or along) and let go to shoot. */
#power { position: absolute; right: calc(10px + env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); }
#power .track { position: relative; width: 52px; height: min(300px, 58vh); border-radius: 26px; background: var(--panel); border: 2px solid var(--wood); overflow: hidden; touch-action: none; }
#power .fill { position: absolute; left: 0; right: 0; top: 0; height: 0; background: linear-gradient(#2fbf62, #f2c230 60%, #d8312a); opacity: 0.85; }
#power .handle { position: absolute; left: 3px; right: 3px; top: 3px; height: 44px; border-radius: 22px; background: var(--cream); color: var(--ink); font-size: 0.65rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
#power.off { opacity: 0.35; }
body.portrait #side { top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); left: 8px; transform: none; flex-direction: row; }
body.portrait #power { top: auto; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); left: 8px; transform: none; }
body.portrait #power .track { width: 100%; height: 52px; }
body.portrait #power .fill { top: 0; bottom: 0; left: 0; height: auto; width: 0; background: linear-gradient(90deg, #2fbf62, #f2c230 60%, #d8312a); }
body.portrait #power .handle { top: 3px; bottom: 3px; left: 3px; right: auto; width: 60px; height: auto; }

/* Emotes. */
#emotes { position: absolute; left: 64px; top: 50%; transform: translateY(-50%); display: grid; grid-template-columns: repeat(2, auto); gap: 6px; background: var(--panel); padding: 8px; border-radius: 12px; border: 2px solid var(--wood); }
body.portrait #emotes { left: 8px; right: 8px; top: auto; bottom: 130px; transform: none; grid-template-columns: repeat(4, 1fr); }
#emotes button { font-size: 0.85rem; padding: 6px 10px; }
#bubbles { position: absolute; top: 70px; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 14px; }
.bubble { background: var(--cream); color: var(--ink); border-radius: 14px; padding: 6px 12px; font-weight: 800; animation: pop 2.6s forwards; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
.bubble.right { margin-left: auto; }
@keyframes pop { 0% { transform: scale(0.5); opacity: 0; } 10% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* Picking spin. */
#spinball { width: 200px; height: 200px; border-radius: 50%; margin: 10px auto 14px; background: radial-gradient(circle at 38% 32%, #ffffff, #e9e2cc 60%, #b9b098); position: relative; cursor: crosshair; touch-action: none; }
#spinball i { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--red); border: 2px solid #fff; transform: translate(-50%, -50%); left: 50%; top: 50%; pointer-events: none; }
#spinbox .card button { margin: 4px; }
body.portrait #players { flex-wrap: wrap; }
body.portrait .pcard { max-width: 48%; flex: 1; }
body.portrait #msg { order: 3; flex-basis: 100%; padding-top: 2px; font-size: 0.9rem; }
