:root {
	--bg: #0b0f1a;
	--card: #121828;
	--muted: #8b97b3;
	--text: #e6ecff;
	--accent: #5b8cff;
	--win: #2ecc71;
	--lose: #ff4757;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
	background: radial-gradient(1200px 600px at 50% -100px, #1a2342, #0b0f1a);
	color: var(--text);
	font: 16px/1.5 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
#app { max-width: 900px; margin: 0 auto; padding: 24px; }
header { display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
h1 { font-weight: 800; letter-spacing: 0.5px; }
.you-pill { background: #16224a; border: 1px solid #2a3b73; color: #c9d6ff; padding: 4px 10px; border-radius: 999px; font-weight: 600; }
.card { background: var(--card); border: 1px solid #1e2844; border-radius: 12px; padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.hidden { display: none; }
.row { display: flex; gap: 8px; align-items: center; }
.space-between { justify-content: space-between; }
input, button { height: 40px; border-radius: 8px; border: 1px solid #273353; background: #0d1324; color: var(--text); padding: 0 12px; }
button { background: linear-gradient(180deg, #6c8eff, #4c70ff); border: none; cursor: pointer; font-weight: 600; }
button:hover { filter: brightness(1.07); }
.muted { color: var(--muted); font-size: 14px; }
.list { list-style: none; padding: 0; margin: 8px 0 0; }
.list li { display: flex; justify-content: space-between; align-items: center; background: #0e1530; border: 1px solid #26345c; border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.badge { background: #1d2a52; border: 1px solid #30427a; padding: 4px 8px; border-radius: 999px; font-size: 12px; color: #a8b3d9; }
.progress { height: 8px; background: #0f1730; border-radius: 999px; overflow: hidden; border: 1px solid #26345c; position: relative; margin: 12px 0; }
.progress .bar { position: absolute; top: 0; left: 0; height: 100%; width: 0; background: linear-gradient(90deg, #4c70ff, #6c8eff); transition: width 350ms ease; }
.result { font-size: 24px; font-weight: 800; margin: 12px 0; text-align: center; }
.result.win { color: var(--win); text-shadow: 0 2px 12px rgba(46, 204, 113, 0.4); }
.result.lose { color: var(--lose); text-shadow: 0 2px 12px rgba(255, 71, 87, 0.4); }
.result .winner { color: var(--win); }
.result .loser { color: var(--lose); }
.proof { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: #9fb0d6; word-break: break-all; }

/* 3D Coin Flip */
.stage { perspective: 1000px; margin: 20px auto; width: 140px; }
.coin3d {
	position: relative;
	width: 140px; height: 140px;
	margin: 0 auto;
	transform-style: preserve-3d;
	transition: transform 600ms cubic-bezier(0.19, 1, 0.22, 1), filter 300ms ease;
}
.coin3d .face {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	backface-visibility: hidden;
	box-shadow: inset 0 6px 16px rgba(0,0,0,0.45), 0 20px 40px rgba(0,0,0,0.35);
	border: 3px solid rgba(255,255,255,0.15);
}
.coin3d .front {
    background: radial-gradient(circle at 30% 30%, #ffd66b, #e7b54f 40%, #b8852f 70%, #815b1d 100%);
    transform: translateZ(2px);
}
.coin3d .back {
    background: radial-gradient(circle at 30% 30%, #a4b4ff, #6c8eff 40%, #4c70ff 70%, #2f45b8 100%);
    transform: rotateY(180deg) translateZ(2px);
}
.coin3d .mark {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
    font-size: 18px;
	padding: 0 8px;
	text-align: center;
	color: rgba(0,0,0,0.35);
	text-shadow: 0 2px 0 rgba(255,255,255,0.35);
}
/* Infinite spin (unused now), kept for reference */
.coin3d.flipping { animation: flipY 2000ms linear infinite; filter: drop-shadow(0 20px 30px rgba(0,0,0,0.4)); }
/* One-time 2s spin (10 full flips = 3600deg) */
.coin3d.flippingOnce { animation: spinY10 2000ms linear 1; filter: drop-shadow(0 20px 30px rgba(0,0,0,0.4)); }
@keyframes spinY10 { 0% { transform: rotateY(0deg); } 100% { transform: rotateY(3600deg); } }
@keyframes flipY { 0% { transform: rotateY(0); } 50% { transform: rotateY(180deg); } 100% { transform: rotateY(360deg); } }
.coin3d.settled { animation: thump 500ms ease; }
@keyframes thump { 0% { transform: translateY(-6px) scale(1.02) rotateZ(0deg); } 100% { transform: translateY(0) scale(1) rotateZ(0deg); } }
.coin-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 14px; color: var(--muted); padding: 0 6px; }
.coin-labels .hl { color: #ffd66b; font-weight: 600; }
.coin-labels .tl { color: #8fb0ff; font-weight: 600; }

.countdown { text-align:center; font-weight:800; font-size:18px; color:#c9d6ff; margin: 6px 0; }
.scoreboard { display:flex; gap:12px; justify-content:center; margin-top:8px; }
.scoreboard .pill { background:#16224a; border:1px solid #2a3b73; padding:6px 10px; border-radius:999px; font-weight:600; }


/* History table scroll */
#history-section { max-height: 300px; overflow: hidden; }
#history-section table { display: block; overflow-y: auto; max-height: 240px; }
#history-section thead, #history-section tbody tr { display: table; width: 100%; table-layout: fixed; }
#history-section thead { width: calc(100% - 1px); }

/* Scrollbar styling */
#history-section table::-webkit-scrollbar { width: 10px; }
#history-section table::-webkit-scrollbar-track { background: #0f1730; border-left: 1px solid #26345c; }
#history-section table::-webkit-scrollbar-thumb { background: #2a3b73; border: 2px solid #0f1730; border-radius: 8px; }
#history-section table::-webkit-scrollbar-thumb:hover { background: #3a4b93; }

/* Disclosure component */
.details { border-top: 1px solid #26345c; margin-top: 8px; padding-top: 8px; }
.details summary { cursor: pointer; color: #a8b3d9; }
.details pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-all; }

