*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	background: #1a472a;
	color: #f0f0f0;
	min-height: 100vh;
}

#game-container {
	display: flex;
	flex-direction: column;
	height: 100vh;
	max-width: 1000px;
	margin: 0 auto;
	padding: 16px;
	gap: 16px;
}
#opponent-area { flex: 0 0 140px; display: flex; align-items: center; justify-content: center; gap: 8px; }
#play-area {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	flex-wrap: wrap;
	position: relative;
}
#player-area { flex: 0 0 140px; display: flex; align-items: center; justify-content: center; gap: 8px; }
#board-area { flex: 0 0 100px; position: relative; }
#game-info {
	flex: 0 0 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 16px;
	background: rgba(0, 0, 0, 0.3);
	border-radius: 8px;
	font-size: 14px;
	color: white;
}
#game-info .your-turn {
	font-weight: bold;
	color: #4ade80;
}

.card {
	width: 80px;
	height: 112px;
	border-radius: 8px;
	background: white;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	margin: 0 4px;
	cursor: pointer;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	position: relative;
	user-select: none;
	font-family: Georgia, serif;
}
.card .rank { font-size: 16px; font-weight: bold; color: inherit; }
.card .rank.top-left { position: absolute; top: 6px; left: 8px; }
.card .rank.bottom-right { position: absolute; bottom: 6px; right: 8px; transform: rotate(180deg); }
.card .suit { font-size: 28px; }
.card.hearts, .card.diamonds { color: #dc2626; }
.card.clubs, .card.spades { color: #1a1a1a; }

.card.selected {
	transform: translateY(-16px);
	box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
	outline: 2px solid #3b82f6;
}
.card.playable:hover {
	transform: translateY(-8px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.card.selected.playable:hover {
	transform: translateY(-16px);
}
.card.face-down {
	background: repeating-linear-gradient(
		135deg,
		#1e3a5f,
		#1e3a5f 5px,
		#2563eb 5px,
		#2563eb 10px
	);
	cursor: default;
	color: transparent;
}

#starter-area { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#starter-area .label { font-size: 12px; text-transform: uppercase; opacity: 0.7; }
#played-cards { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
#crib-area { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#running-count {
	font-size: 24px;
	font-weight: bold;
	background: rgba(0, 0, 0, 0.4);
	padding: 8px 16px;
	border-radius: 8px;
}

.btn {
	padding: 8px 20px;
	border: none;
	border-radius: 6px;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.2s;
}
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #64748b; cursor: not-allowed; }
.btn-danger { background: #dc2626; color: white; }
.btn-go { background: #d97706; color: white; }

.peg-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px;
	background: rgba(0, 0, 0, 0.3);
	border-radius: 8px;
}
.peg-controls input[type="number"] {
	width: 80px;
	padding: 4px 8px;
	border-radius: 4px;
	border: 1px solid #475569;
	background: #1e293b;
	color: white;
	text-align: center;
	font-size: 16px;
}
.peg-controls .btn { padding: 4px 12px; }

#home {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	gap: 16px;
	text-align: center;
}
#home h1 { font-size: 48px; }
#home p { font-size: 18px; opacity: 0.8; }

.notice {
	text-align: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.3);
	border-radius: 8px;
	margin: 8px 0;
}
.share-url {
	background: #1e293b;
	padding: 8px 16px;
	border-radius: 4px;
	font-family: monospace;
	user-select: all;
	cursor: pointer;
}

@media (max-width: 768px) {
	.card { width: 64px; height: 90px; }
	.card .suit { font-size: 22px; }
	.card .rank { font-size: 13px; }
	#game-container { padding: 8px; gap: 8px; }
}

.game-over-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.8);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 16px;
	z-index: 100;
}
.game-over-overlay h2 { font-size: 36px; }
.game-over-overlay .skunk { color: #d97706; }

/* Board CSS (Task 10) */
.cribbage-board {
	background: linear-gradient(#8B6914, #A07828, #8B6914);
	border-radius: 8px;
	padding: 12px 16px;
	position: relative;
	overflow-x: auto;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.board-row {
	position: relative;
	height: 20px;
	margin: 4px 0;
}
.hole {
	position: absolute;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #3d2b00;
	top: 7px;
}
.hole.skunk-line { box-shadow: 0 0 0 2px #d97706; }
.peg {
	position: absolute;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	top: 6px;
	z-index: 2;
	transition: left 0.5s ease-in-out;
}
.peg-0 { background: #dc2626; }
.peg-1 { background: #2563eb; }
.peg-back { opacity: 0.6; }

/* Video Chat */
#game-wrapper {
	display: flex;
	flex-direction: column;
	height: 100vh;
	max-width: 1000px;
	margin: 0 auto;
}
#game-wrapper #game-container {
	flex: 1;
	height: auto;
	min-height: 0;
	margin: 0;
	width: 100%;
}

#video-panel {
	order: -1;
	display: flex;
	flex-direction: row;
	width: 100%;
	gap: 8px;
	padding: 8px;
	max-height: 25vh;
	transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
	overflow: hidden;
}
#video-panel.collapsed {
	max-height: 0;
	padding: 0;
	opacity: 0;
	pointer-events: none;
}

#remote-video-wrapper {
	position: relative;
	flex: 1;
	min-height: 0;
}
#remote-video, #local-video {
	width: 100%;
	height: 100%;
	max-height: 25vh;
	border-radius: 8px;
	background: #000;
	object-fit: cover;
	display: block;
}
#local-video {
	flex: 1;
	min-height: 0;
}

.video-status-overlay {
	position: absolute;
	bottom: 8px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 12px;
	text-align: center;
}

#video-controls {
	display: flex;
	flex-direction: column;
	gap: 4px;
	justify-content: center;
}

.video-btn {
	background: rgba(0, 0, 0, 0.4);
	color: white;
	font-size: 12px;
	padding: 6px 10px;
}
.video-btn:hover { background: rgba(0, 0, 0, 0.6); }
.video-btn:disabled { opacity: 0.5; cursor: not-allowed; }

#game-wrapper {
	position: relative;
}
.video-toggle {
	position: absolute;
	right: 8px;
	top: 8px;
	z-index: 10;
}
.video-toggle.active { background: #2563eb; }

#video-status-msg {
	font-size: 12px;
	text-align: center;
	color: #fbbf24;
	padding: 4px;
}
