/* ==========================================================
   Ten Dice Race Pro — Teal & Navy Theme
   ========================================================== */

.tzp-container {
	--tzp-navy-deep: #071a2c;
	--tzp-navy: #0f2a44;
	--tzp-navy-light: #1e3a5f;
	--tzp-teal: #14b8a6;
	--tzp-teal-bright: #2dd4bf;
	--tzp-teal-deep: #0d9488;
	--tzp-text: #e6f6f4;
	--tzp-text-muted: #9fb8c9;
	--tzp-danger: #ff6b6b;
	--tzp-gold: #ffd166;

	max-width: 680px;
	margin: 24px auto;
	padding: 28px;
	border-radius: 20px;
	background: linear-gradient(160deg, var(--tzp-navy-deep) 0%, var(--tzp-navy) 55%, var(--tzp-navy-light) 100%);
	color: var(--tzp-text);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
	position: relative;
	overflow: hidden;
	isolation: isolate;
}
.tzp-container::before {
	content: "";
	position: absolute;
	inset: -40% -20% auto auto;
	width: 420px;
	height: 420px;
	background: radial-gradient(circle, rgba(20, 184, 166, 0.25) 0%, transparent 70%);
	z-index: 0;
	pointer-events: none;
}
.tzp-container * {
	box-sizing: border-box;
	position: relative;
	z-index: 1;
}

/* ---------- Header ---------- */
.tzp-header { text-align: center; margin-bottom: 18px; }
.tzp-title {
	margin: 0;
	font-size: 26px;
	font-weight: 800;
	letter-spacing: 0.5px;
	background: linear-gradient(90deg, var(--tzp-teal-bright), #7fe3d8);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}
.tzp-dice-emoji { font-size: 24px; }
.tzp-subtitle { margin: 6px 0 0; font-size: 13px; color: var(--tzp-text-muted); }

/* ---------- Setup / player input ---------- */
.tzp-setup { margin-bottom: 16px; }
.tzp-input-row { display: flex; gap: 10px; margin-bottom: 10px; }
.tzp-player-name-input {
	flex: 1;
	padding: 10px 14px;
	border-radius: 10px;
	border: 1px solid var(--tzp-navy-light);
	background: rgba(255, 255, 255, 0.95);
	color: #0f2a44;
	font-size: 14px;
}
.tzp-player-name-input:focus { outline: 2px solid var(--tzp-teal-bright); outline-offset: 1px; }
.tzp-player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tzp-player-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px 6px 14px;
	border-radius: 999px;
	background: rgba(20, 184, 166, 0.14);
	border: 1px solid var(--tzp-teal-deep);
	font-size: 13px;
	font-weight: 600;
}
.tzp-player-chip button {
	border: none;
	background: rgba(255, 107, 107, 0.18);
	color: var(--tzp-danger);
	border-radius: 50%;
	width: 18px;
	height: 18px;
	line-height: 1;
	cursor: pointer;
	font-size: 12px;
}
.tzp-token-swatch {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
}

/* ---------- Controls ---------- */
.tzp-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 18px;
	margin-bottom: 16px;
	padding: 14px 16px;
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.06);
}
.tzp-control-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--tzp-text-muted); }
.tzp-control-label select {
	padding: 7px 10px;
	border-radius: 8px;
	border: 1px solid var(--tzp-navy-light);
	background: var(--tzp-navy);
	color: var(--tzp-text);
	font-size: 13px;
}
.tzp-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tzp-text-muted); cursor: pointer; }
.tzp-toggle input { accent-color: var(--tzp-teal-bright); width: 16px; height: 16px; }

/* ---------- Scoreboard ---------- */
.tzp-scoreboard-wrap {
	margin-bottom: 14px;
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.08);
}
.tzp-scoreboard { width: 100%; border-collapse: collapse; font-size: 13px; }
.tzp-scoreboard thead th {
	text-align: left;
	padding: 10px 14px;
	background: rgba(255, 255, 255, 0.05);
	color: var(--tzp-text-muted);
	font-weight: 700;
	text-transform: uppercase;
	font-size: 11px;
	letter-spacing: 0.4px;
}
.tzp-scoreboard tbody td { padding: 9px 14px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.tzp-scoreboard tbody tr.tzp-active-player { background: rgba(255, 209, 102, 0.1); }
.tzp-scoreboard tbody tr.tzp-finished-player { opacity: 0.75; }
.tzp-empty-row td { text-align: center; color: var(--tzp-text-muted); padding: 16px; }
.tzp-status-waiting { color: var(--tzp-text-muted); font-weight: 600; font-size: 11px; }
.tzp-status-active { color: var(--tzp-gold); font-weight: 700; font-size: 11px; }
.tzp-status-finished { color: var(--tzp-teal-bright); font-weight: 700; font-size: 11px; }
.tzp-status-winner { color: var(--tzp-gold); font-weight: 800; font-size: 11px; }

/* ---------- Turn indicator ---------- */
.tzp-turn-indicator {
	text-align: center;
	padding: 10px 16px;
	border-radius: 12px;
	background: rgba(20, 184, 166, 0.08);
	border: 1px solid var(--tzp-teal-deep);
	margin-bottom: 16px;
	font-size: 13px;
	color: var(--tzp-text-muted);
}
.tzp-turn-name { color: var(--tzp-teal-bright); font-weight: 700; }

/* ---------- Dice stage (10 dice) ---------- */
.tzp-dice-stage {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 10px;
	max-width: 420px;
	margin: 0 auto 10px;
}
@media (max-width: 480px) {
	.tzp-dice-stage { grid-template-columns: repeat(5, 1fr); gap: 6px; }
}
.tzp-die {
	aspect-ratio: 1 / 1;
	border-radius: 12px;
	background: var(--tzp-die-color, #d7ece9);
	border: 2px solid var(--tzp-die-color-deep, var(--tzp-teal-deep));
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	font-weight: 900;
	color: #06231e;
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.35);
	cursor: pointer;
	user-select: none;
	transition: transform 0.15s ease;
}
.tzp-die:active { transform: scale(0.95); }
.tzp-die.tzp-locked {
	box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.5), 0 6px 14px rgba(0, 0, 0, 0.35);
}
.tzp-die.tzp-blocked { cursor: not-allowed; opacity: 0.55; }
.tzp-die.tzp-rolling { animation: tzp-die-shake 0.4s ease-in-out infinite; }
@keyframes tzp-die-shake {
	0%, 100% { transform: rotate(0deg) scale(1); }
	25% { transform: rotate(-8deg) scale(1.05); }
	75% { transform: rotate(8deg) scale(1.05); }
}
.tzp-die.tzp-landed { animation: tzp-die-land 0.35s ease; }
@keyframes tzp-die-land {
	0% { transform: scale(1.25); }
	100% { transform: scale(1); }
}
.tzp-die[data-nointeract="1"] { cursor: default; }

/* ---------- Mini die (scoreboard "Picked" column) ---------- */
.tzp-picked-cell { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--tzp-text-muted); }
.tzp-mini-die {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
	border-radius: 5px;
	background: linear-gradient(145deg, #ffe38a, #ffc94d);
	border: 1px solid var(--tzp-gold);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 900;
	color: #3d2c00;
}
.tzp-picked-empty { color: var(--tzp-text-muted); }

.tzp-roll-readout {
	text-align: center;
	font-size: 13px;
	color: var(--tzp-text-muted);
	min-height: 18px;
	margin-bottom: 16px;
}

/* ---------- Buttons ---------- */
.tzp-action-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	margin-bottom: 18px;
}
.tzp-btn {
	border: none;
	border-radius: 12px;
	padding: 12px 22px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tzp-btn:active { transform: scale(0.97); }
.tzp-btn-primary {
	background: linear-gradient(135deg, var(--tzp-teal-bright), var(--tzp-teal-deep));
	color: #06231e;
	box-shadow: 0 8px 20px rgba(20, 184, 166, 0.35);
}
.tzp-btn-secondary {
	background: rgba(20, 184, 166, 0.14);
	color: var(--tzp-teal-bright);
	border: 1px solid var(--tzp-teal-deep);
}
.tzp-btn-ghost {
	background: transparent;
	color: var(--tzp-text-muted);
	border: 1px solid rgba(255, 255, 255, 0.12);
}
.tzp-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Finish toast (one player completes, game continues) ---------- */
.tzp-finish-toast {
	text-align: center;
	padding: 12px 16px;
	border-radius: 12px;
	background: linear-gradient(135deg, rgba(255, 209, 102, 0.18), rgba(255, 209, 102, 0.05));
	border: 1px solid var(--tzp-gold);
	margin-bottom: 16px;
	font-size: 14px;
	font-weight: 700;
	color: var(--tzp-gold);
}

/* ---------- Final results panel ---------- */
.tzp-results-panel {
	padding: 16px;
	border-radius: 14px;
	background: linear-gradient(135deg, rgba(255, 209, 102, 0.14), rgba(255, 209, 102, 0.03));
	border: 1px solid var(--tzp-gold);
	margin-bottom: 18px;
}
.tzp-results-panel h4 {
	margin: 0 0 12px;
	font-size: 16px;
	font-weight: 800;
	color: var(--tzp-gold);
	text-align: center;
}
.tzp-results-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; }
.tzp-results-table thead th {
	text-align: left;
	padding: 8px 12px;
	color: var(--tzp-text-muted);
	font-weight: 700;
	text-transform: uppercase;
	font-size: 11px;
	letter-spacing: 0.4px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.tzp-results-table tbody td { padding: 8px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.tzp-results-table tbody tr:first-child { background: rgba(255, 209, 102, 0.12); }
.tzp-rank-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	font-weight: 800;
	font-size: 12px;
	color: var(--tzp-text);
}
.tzp-results-table tbody tr:nth-child(1) .tzp-rank-badge { background: var(--tzp-gold); color: #3d2c00; }
.tzp-results-table tbody tr:nth-child(2) .tzp-rank-badge { background: #c7d2de; color: #1f2937; }
.tzp-results-table tbody tr:nth-child(3) .tzp-rank-badge { background: #d69a5c; color: #3d1f00; }
.tzp-results-actions { text-align: center; }

/* ---------- Panels ---------- */
.tzp-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) {
	.tzp-panels { grid-template-columns: 1fr; }
}
.tzp-panel {
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 14px;
	padding: 14px 16px;
}
.tzp-panel h4 {
	margin: 0 0 10px;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--tzp-text-muted);
}
.tzp-panel p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--tzp-text-muted); }
.tzp-history-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; font-size: 12.5px; }
.tzp-history-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.tzp-history-list li:last-child { border-bottom: none; }
.tzp-history-time { color: var(--tzp-text-muted); font-size: 11px; white-space: nowrap; }
.tzp-empty-msg { color: var(--tzp-text-muted); text-align: center; padding: 10px 0; }

/* ---------- Confetti ---------- */
.tzp-confetti-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.tzp-confetti-piece { position: absolute; top: -10px; width: 8px; height: 14px; opacity: 0.9; animation: tzp-confetti-fall linear forwards; }
@keyframes tzp-confetti-fall {
	to { transform: translateY(420px) rotate(540deg); opacity: 0; }
}
