/*!
 * Carrom 3D - interface styles
 * Version 1.0.0 | Author: Md Shunam Al Anam
 * The board, coins and shadows are drawn by js/render.js. This file styles the menus and the on-screen controls.
 * Change the colours in the variables below.
 */
:root {
  --ink: #f6efe4; --muted: #c9b9a2; --panel: rgba(28, 19, 12, .82); --line: rgba(255, 226, 170, .18);
  --accent: #f5b82e; --accent-ink: #261800; --warn: #ff6b5b; --good: #6fd37b;
  box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: #120c08; color: var(--ink); overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
[hidden] { display: none !important; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
h1 { font-size: clamp(38px, 10vw, 54px); letter-spacing: -.03em; margin: 0; line-height: 1; }
h2 { margin: 0; font-size: 22px; }
p { margin: 0; color: var(--muted); line-height: 1.5; }

.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px; overflow: auto; z-index: 3; pointer-events: none; }
.screen.on { display: flex; animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.card { pointer-events: auto; width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 24px 22px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .7); display: flex; flex-direction: column; gap: 14px; }
.home-card { text-align: center; align-items: center; }
.logo { display: grid; grid-template-columns: repeat(2, 18px); gap: 4px; }
.logo i { width: 18px; height: 18px; border-radius: 50%; background: #f1e6cf; } .logo i:nth-child(2), .logo i:nth-child(3) { background: #1d1d22; border: 1px solid #555; } .logo i:nth-child(4) { background: #c7142b; }
.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.foot { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.top { display: flex; align-items: center; gap: 12px; } .top h2 { flex: 1; }

.btn { min-height: 48px; padding: 8px 20px; border-radius: 14px; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .07); color: var(--ink); font-family: inherit; font-weight: 600; font-size: 16px; cursor: pointer; transition: transform .12s, background .15s; pointer-events: auto; }
.btn:hover { background: rgba(255, 255, 255, .14); } .btn:active { transform: translateY(2px); }
.btn.pri { background: var(--accent); color: var(--accent-ink); border-color: transparent; } .btn.pri:hover { background: #ffc94d; }
.btn.danger { color: var(--warn); } .btn.sm { min-height: 44px; padding: 6px 18px; }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; text-decoration: underline; cursor: pointer; padding: 6px; }
.ib { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink); font-size: 14px; font-weight: 700; cursor: pointer; pointer-events: auto; backdrop-filter: blur(8px); }
.btn:focus-visible, .ib:focus-visible, .chip:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.statrow div { background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; text-align: center; }
.statrow b { display: block; font-size: 20px; } .statrow span { font-size: 10px; color: var(--muted); }
.srows { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; } .srow { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; } .srow:last-child { border: 0; } .srow span { color: var(--muted); }

/* Game HUD */
#hud { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.bar { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(780px, calc(100vw - 150px)); display: flex; align-items: stretch; gap: 8px; }
.pcard { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color .2s, box-shadow .2s; }
.pcard:last-child { flex-direction: row; justify-content: flex-end; text-align: right; }
.pcard.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245, 184, 46, .25); }
.pcard b { display: block; font-size: 14px; } .pcard small { color: var(--muted); font-size: 11px; } .pcard em { font-style: normal; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; }
.disc { width: 24px; height: 24px; border-radius: 50%; flex: none; border: 2px solid rgba(255, 255, 255, .25); } .disc.w { background: #f1e6cf; } .disc.k { background: #1d1d22; }
.mid { display: flex; align-items: center; justify-content: center; min-width: 90px; font-size: 12px; color: var(--accent); text-align: center; font-weight: 600; }
.side { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; display: flex; flex-direction: column; gap: 8px; }
#msg { position: absolute; left: 50%; top: calc(86px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -8px); max-width: min(560px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 9px 18px; font-size: 14px; text-align: center; opacity: 0; transition: .25s; backdrop-filter: blur(10px); }
#msg.on { opacity: 1; transform: translate(-50%, 0); }
#controls { position: absolute; left: 0; right: 0; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: flex-end; gap: 12px; padding: 0 12px; max-width: 760px; margin: 0 auto; }
.slide { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px 10px; pointer-events: auto; backdrop-filter: blur(10px); }
.slide span, .power span { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.slide input { width: 100%; accent-color: var(--accent); height: 28px; margin: 0; }
.power { position: absolute; left: 12px; right: 12px; bottom: 78px; height: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; opacity: 0; transition: opacity .2s; }
.power.on { opacity: 1; } .power i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #6fd37b, #f5b82e, #ff6b5b); } .power span { position: absolute; left: 14px; top: 6px; margin: 0; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); z-index: 1; }

#modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(8, 5, 3, .6); padding: 20px; z-index: 6; }
#modal.on { display: flex; animation: rise .2s; }
.box { width: min(380px, 100%); max-height: 92%; overflow: auto; background: #26190f; border: 1px solid var(--line); border-radius: 22px; padding: 24px 20px; text-align: center; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7); }
.box .big { font-size: 40px; font-weight: 800; } .box .trophy { font-size: 42px; color: var(--accent); line-height: 1; }
.scoreline { display: flex; justify-content: center; align-items: baseline; gap: 14px; } .scoreline b { font-size: 46px; } .scoreline span { font-size: 30px; color: var(--muted); }
.box ul { text-align: left; margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.6; font-size: 14px; }
.label { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: -4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; } .chip { height: 38px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; } .chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
#toast { position: fixed; left: 50%; top: calc(88px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -16px); z-index: 20; opacity: 0; pointer-events: none; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; padding: 10px 18px; border-radius: 99px; transition: .3s; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; top: -14px; width: 9px; height: 14px; z-index: 30; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (max-width: 700px) { .bar { left: 10px; right: 64px; width: auto; transform: none; } }
@media (max-width: 560px) { .mid { display: none; } .pcard small { display: none; } .pcard { padding: 6px 10px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
