/* Jeu de l'oie Twins & Co : couleurs reprises du plateau illustré. */
:root {
	--green: #0d4a46;
	--green-dark: #093733;
	--cream: #f6f0e4;
	--yellow: #f5c23e;
	--red: #e4434b;
	--burgundy: #8a1d3d;
	--navy: #2a2160;
	--font: "Avenir Next Condensed", "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Pas de hauteur à 100 % : l'iframe prend la hauteur du contenu (voir embed.js). */
html, body { margin: 0; background: var(--green); }

body {
	color: var(--cream);
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.app {
	max-width: 1160px;
	margin: 0 auto;
	padding: 16px;
}

@media (min-width: 860px) {
	.app { padding: 24px 32px; }
}

.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 20px;
}

h1 {
	margin: 0;
	font-size: clamp(20px, 4.5vw, 30px);
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.lang {
	flex: none;
	min-width: 48px;
	min-height: 40px;
	border: 2px solid var(--cream);
	border-radius: 999px;
	background: transparent;
	color: var(--cream);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.lang:hover, .lang:focus-visible { background: var(--cream); color: var(--green); }

.card {
	background: var(--cream);
	color: var(--green-dark);
	border-radius: 18px;
	padding: 22px;
}

.error { margin: 0; font-size: 19px; }

/* Lot à gagner, en tête du panneau */
.prize {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px 18px;
	border-radius: 18px;
	background: rgba(255, 255, 255, .07);
}

.prize img { flex: none; width: auto; height: 72px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
.prize p { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; }

@media (min-width: 860px) {
	.prize { gap: 22px; padding: 22px 26px; }
	.prize img { height: 150px; }
	.prize p { font-size: 20px; }
}

/* « Voir les règles » : bouton discret qui déplie les règles */
.link-btn {
	align-self: flex-start;
	padding: 6px 0;
	border: 0;
	background: none;
	color: var(--cream);
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.link-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.rules-card {
	padding: 16px 18px;
	border-radius: 16px;
	background: var(--cream);
	color: var(--green-dark);
	font-size: 16px;
}

.rules { margin: 0 0 10px; padding-left: 20px; }
.rules li { margin-bottom: 6px; }
.rules-card p { margin: 0; font-weight: 600; }

.btn {
	display: inline-block;
	min-height: 52px;
	padding: 12px 30px;
	border: 0;
	border-radius: 999px;
	background: var(--yellow);
	color: var(--green-dark);
	font: inherit;
	font-size: 19px;
	font-weight: 800;
	letter-spacing: .03em;
	cursor: pointer;
	box-shadow: 0 4px 0 #c8962a;
	transition: transform .1s, box-shadow .1s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c8962a; }
.btn:focus-visible, .lang:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

/* Jeu : panneau au-dessus du plateau sur mobile, à côté sur grand écran. */
.game {
	display: grid;
	gap: 20px;
}

.panel {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* Compteur de lancers et bouton : un seul bloc */
.play {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.status {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
}

.turn { margin: 0; font-size: 20px; font-weight: 700; }
.next { margin: 0; color: var(--yellow); font-weight: 700; }

.result {
	padding: 18px;
	border-radius: 16px;
	background: var(--cream);
	color: var(--green-dark);
}

.result h2 { margin: 0 0 8px; font-size: 24px; color: var(--burgundy); }
.result p { margin: 0 0 8px; }
.result .btn { margin-top: 6px; font-size: 16px; min-height: 44px; padding: 8px 20px; }
.result.won { background: var(--yellow); }
.result.won h2 { color: var(--green-dark); }
.result.won .btn { background: var(--green); color: var(--cream); box-shadow: 0 4px 0 var(--green-dark); }
.result::after { content: ""; display: block; clear: both; }
.result-bottle { float: right; height: 170px; width: auto; margin: 0 0 8px 12px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .3)); }

@media (min-width: 860px) {
	.game { grid-template-columns: minmax(0, 600px) minmax(320px, 1fr); column-gap: 48px; align-items: start; }
	.board { order: -1; }
	.panel { gap: 28px; padding-top: 8px; }
	.turn { font-size: 22px; }
	.next { font-size: 18px; }
}

/* Plateau */
.board {
	position: relative;
	width: 100%;
	max-width: 600px;
	margin: 0 auto;
	container-type: inline-size;
	border-radius: 14px;
	overflow: hidden;
	isolation: isolate; /* Safari : sans cela, les dés en 3D peuvent déborder du plateau */
	box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.board-img { display: block; width: 100%; height: auto; }

.pawn {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 4;
	width: 6.5cqw;
	height: 6.5cqw;
	border: .7cqw solid #fff;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #fff3c4 0 12%, var(--yellow) 40%, #b07b12 100%);
	box-shadow: 0 .6cqw 1.4cqw rgba(0, 0, 0, .55);
	transform: translate(-50%, -50%);
	pointer-events: none;
}

/* Case d'arrivée agrandie : un morceau de l'image du plateau (calé par game.js) qui grandit. */
.zoom {
	position: absolute;
	z-index: 2;
	border-radius: 1.2cqw;
	background: url("board.webp") no-repeat;
	pointer-events: none;
}

/* Zone centrale du plateau, sous l'endroit où les dés s'arrêtent : bulles. */
.console {
	position: absolute;
	left: 36%;
	top: 39.5%;
	z-index: 3;
	width: 28%;
	display: flex;
	flex-direction: column;
	align-items: center;
	pointer-events: none;
}

/*
 * Dés : calque 3D sur tout le plateau, vu de dessus. game.js les lance depuis le bas
 * et les fait rouler jusqu'au centre. Unités en cqw : la largeur du plateau vaut 100.
 * Au repos, ils passent sous la case agrandie, la bulle et le pion ; en roulant, au-dessus.
 */
.dice {
	position: absolute;
	inset: 0;
	z-index: 1;
	perspective: 200cqw;
	perspective-origin: 50% 35%;
	transform-style: preserve-3d;
	pointer-events: none;
}

.dice.rolling { z-index: 5; }

/* .die porte la position sur le plateau, .cube la hauteur et la rotation, .die-shadow l'ombre au sol. */
.die {
	position: absolute;
	left: 0;
	top: 0;
	width: 7.5cqw;
	height: 7.5cqw;
	margin: -3.75cqw 0 0 -3.75cqw;
	transform-style: preserve-3d;
}

.cube {
	position: absolute;
	inset: 0;
	transform-style: preserve-3d;
}

.die-shadow {
	position: absolute;
	inset: 4%;
	border-radius: 24%;
	background: rgba(0, 0, 0, .6);
	filter: blur(.6cqw);
}

.face {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template: repeat(3, 1fr) / repeat(3, 1fr);
	padding: 14%;
	border-radius: 18%;
	background: radial-gradient(circle, #fff 55%, #ebe5d8 100%);
	box-shadow: inset 0 0 0 .25cqw rgba(0, 0, 0, .12);
	backface-visibility: hidden;
}

/* Plans intérieurs : bouchent les coins arrondis des faces quand le dé roule. */
.core {
	position: absolute;
	inset: 1%;
	border-radius: 18%;
	background: #ddd6c8;
}

.core-x { transform: rotateY(90deg); }
.core-y { transform: rotateX(90deg); }

.pip {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: var(--burgundy);
	transform: scale(.75);
}

.face-1 { transform: translateZ(3.75cqw); }
.face-6 { transform: rotateY(180deg) translateZ(3.75cqw); }
.face-3 { transform: rotateY(90deg) translateZ(3.75cqw); }
.face-4 { transform: rotateY(-90deg) translateZ(3.75cqw); }
.face-2 { transform: rotateX(90deg) translateZ(3.75cqw); }
.face-5 { transform: rotateX(-90deg) translateZ(3.75cqw); }

.bubble {
	margin: 0;
	padding: 1.6cqw 2.2cqw;
	border-radius: 2.5cqw;
	background: #fff;
	color: var(--green-dark);
	font-size: max(12px, 3cqw);
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
	box-shadow: 0 1cqw 2.4cqw rgba(0, 0, 0, .3);
}

.bubble:empty { display: none; }

.confetti {
	position: absolute;
	inset: 0;
	z-index: 5;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

/* ?debug=1 : numéros des cases pour caler board.json */
.marker {
	position: absolute;
	z-index: 6;
	transform: translate(-50%, -50%);
	padding: .3cqw .8cqw;
	border-radius: 999px;
	background: #00b4ff;
	color: #000;
	font-size: 2.6cqw;
	font-weight: 800;
}

.legal {
	margin-top: 22px;
	font-size: 13px;
	opacity: .85;
	text-align: center;
}

.legal p { margin: 4px 0; }
.legal a { color: var(--cream); }

@media (prefers-reduced-motion: reduce) {
	.btn { transition: none; }
}
