/* Shared Tesla-game UI base (from cgolf v4-v7). Copy into each game (games deploy standalone).
   One scale unit for ALL UI: 1rem is ~11.5px on the 1920x1200 Tesla screen and shrinks with the viewport,
   so every panel/button is sized in rem and stays compact. Theme with the CSS variables below.
   --pc / --pcText = current player's colour (set from JS on each turn). */
html { font-size: clamp(8px, min(0.6vw, 0.96vh), 14px); }
:root { --bg: rgba(10, 30, 20, .72); --pc: #e53935; --pcText: #fff; --btnA: #2e9d58; --btnB: #1f7a41; --btnS: #145a2e; --accent: #ffd23f; --cardBg: rgba(12, 40, 24, .93); --page: #0c2416; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--page); color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "DejaVu Sans", Arial, sans-serif;
  touch-action: none; overscroll-behavior: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
canvas#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
.hidden { display: none !important; }
svg.i { width: 1.9rem; height: 1.9rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: block; pointer-events: none; }
button { font: inherit; color: #fff; border: 0; border-radius: .9rem; cursor: pointer; touch-action: manipulation;
  background: linear-gradient(var(--btnA), var(--btnB)); box-shadow: 0 .25rem 0 var(--btnS), 0 .3rem .8rem rgba(0,0,0,.3);
  min-height: 3.6rem; padding: 0 1.4rem; font-size: 1.35rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--btnS); }
button.ghost { background: rgba(255,255,255,.14); box-shadow: none; }
button.sel { outline: .2rem solid var(--accent); }
input { font: inherit; font-size: 1.4rem; padding: .5rem .9rem; border-radius: .7rem; border: .15rem solid var(--btnA); background: #fff; color: #123;
  min-height: 3.2rem; width: 100%; user-select: text; -webkit-user-select: text; touch-action: manipulation; }
.panel { background: var(--bg); border-radius: .9rem; padding: .45rem .9rem; box-shadow: 0 .2rem .8rem rgba(0,0,0,.25); }
.chip { width: 1.2rem; height: 1.2rem; border-radius: 50%; display: inline-block; border: .15rem solid #fff; flex: none; }
.ib { width: 3.6rem; height: 3.6rem; min-height: 0; padding: 0; background: var(--bg); box-shadow: 0 .2rem .8rem rgba(0,0,0,.25); }
/* camera cluster: bottom-LEFT (bottom-right is covered by the ship.page badge) */
#camBtns { position: fixed; left: .8rem; bottom: .8rem; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
#camMore { display: grid; grid-template-columns: repeat(2, 3.6rem); gap: .5rem; }
#camMain { display: flex; gap: .5rem; }
#camToggle.on { outline: .15rem solid var(--accent); }
/* cancel X shown while dragging (release on it, or tap it with a second finger) */
#cancelBtn { width: 4.6rem; height: 4.6rem; border-radius: 50%; padding: 0; background: rgba(180, 30, 30, .9); box-shadow: 0 .3rem 1rem rgba(0,0,0,.4); }
#cancelBtn.hot { transform: scale(1.25); outline: .25rem solid #fff; }
#cancelBtn svg.i { width: 2.4rem; height: 2.4rem; stroke-width: 3; }
/* big "Player X's turn" card */
#turnBig { position: fixed; top: 38%; left: 50%; transform: translate(-50%, -50%) scale(.7); z-index: 15; pointer-events: none; opacity: 0;
  background: var(--pc); color: var(--pcText); padding: 1rem 2.6rem; border-radius: 1.4rem; font-size: 2.6rem; font-weight: 900; text-align: center;
  box-shadow: 0 .6rem 2rem rgba(0,0,0,.45); transition: opacity .3s, transform .3s; white-space: nowrap; }
#turnBig small { display: block; font-size: 1.2rem; font-weight: 700; opacity: .9; }
#turnBig.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#toast { position: fixed; top: 22%; left: 50%; z-index: 20; transform: translate(-50%, -50%) scale(.85); font-size: 2.8rem; font-weight: 900; text-align: center; pointer-events: none;
  text-shadow: 0 .2rem 0 rgba(0,0,0,.35), 0 0 1.2rem rgba(0,0,0,.4); opacity: 0; transition: opacity .25s, transform .25s; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#toast small { display: block; font-size: 1.3rem; font-weight: 700; }
#hint { position: fixed; bottom: .5rem; left: 50%; transform: translateX(-50%); font-size: 1rem; pointer-events: none; white-space: nowrap; opacity: .85; }
/* screens / cards (cards may scroll vertically; everything else blocks touch scrolling) */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 30%, rgba(20,80,40,.4), rgba(5,20,10,.8)); z-index: 10; }
.card { background: var(--cardBg); border-radius: 1.3rem; padding: 1.6rem 2rem; width: min(40rem, 92vw); max-height: 92vh; overflow: auto; box-shadow: 0 1rem 3rem rgba(0,0,0,.5); touch-action: pan-y; }
.card h1 { margin: 0; font-size: 2.6rem; display: flex; align-items: center; gap: .6rem; }
.card h1 svg { width: 2.6rem; height: 2.6rem; }
.ver { font-size: 1.1rem; font-weight: 700; color: var(--accent); letter-spacing: .05rem; }
.card h2 { margin: 0 0 .8rem; font-size: 1.8rem; }
.card p { font-size: 1.05rem; opacity: .85; margin: .3rem 0 .8rem; }
.row { display: flex; gap: .7rem; align-items: center; margin: .6rem 0; flex-wrap: wrap; }
.row > button.grow { flex: 1; }
.lbl { font-size: 1.05rem; opacity: .8; min-width: 5.5rem; }
.seg button { min-width: 3.8rem; padding: 0 .9rem; }
