/* ============================================
   Inspirational Solitaire – Stylesheet
   ============================================ */

/* --- Page Shell: sticky footer --- */
html, body { height: 100%; margin: 0; }

body {
	background: #967e88 url('../assets/grain.png') repeat;
	font-family: 'Open Sans', sans-serif;
	-webkit-font-smoothing: antialiased;
	overscroll-behavior-y: contain;
}

.wrapper {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.game-board {
	flex: 0 0 auto;
	padding: 14px 0 20px 0;
	touch-action: none;
}

.footer {
	flex-shrink: 0;
	background: #5e4f56 !important;
	border-top: 2px solid #eaad7a !important;
	margin-top: 0 !important;
	padding: 10px 0 !important;
}
.footer .footer-copyright { padding-top: 0 !important; border-top: 0 !important; }
.footer .footer-copyright p { color: rgba(255,255,255,0.5) !important; font-size: 11px !important; text-align: center; margin: 0; }
.footer .footer-editions { margin-top: 4px; }
.footer .footer-editions a { color: rgba(255,255,255,0.6) !important; text-decoration: none; }
.footer .footer-editions a:hover { color: #fff !important; text-decoration: underline; }

/* ======================
   HEADER – single bar
   ====================== */
.header {
	background: #5e4f56 !important;
	border-bottom: 2px solid #eaad7a !important;
	box-shadow: 0 2px 12px rgba(0,0,0,0.35) !important;
	padding: 0 !important;
	/* Notch/camera cutout buffer */
	padding-top: 6px !important;
	position: relative;
	z-index: 500;
}

.game-header {
	display: flex;
	align-items: center;
	padding: 7px 12px;
	gap: 10px;
}

/* Title */
.game-title {
	display: flex;
	align-items: center;
	gap: 6px;
	color: #f5d3a8 !important;
	text-decoration: none !important;
	font-family: 'Droid Serif', serif;
	font-size: 18px;
	font-weight: 700;
	white-space: nowrap;
	flex-shrink: 0;
}
.game-title:hover { color: #fff !important; }
.game-title .fa { font-size: 20px; }

/* Stats */
.game-stats {
	display: flex;
	gap: 12px;
	flex: 1;
	justify-content: center;
	white-space: nowrap;
}
.game-stats .stat {
	color: #f5d3a8;
	font-size: 13px;
}
.game-stats .stat i {
	margin-right: 2px;
	font-size: 12px;
}
.game-stats .stat b { color: #f5d3a8; font-weight: 600; }

/* Actions */
.game-actions {
	display: flex;
	gap: 10px;
	flex-shrink: 0;
	align-items: center;
}
.game-actions a {
	color: #f5d3a8 !important;
	text-decoration: none !important;
	font-size: 14px;
	white-space: nowrap;
	padding: 3px 0;
}
.game-actions a:hover { color: #fff !important; }
.game-actions a .fa { font-size: 15px; }

/* ======================
   SETTINGS POPUP
   ====================== */
.settings-overlay {
	display: none;
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.5);
	z-index: 900;
}
.settings-overlay.open { display: block; }

.settings-popup {
	display: none;
	position: fixed;
	z-index: 910;
	background: #5e4f56;
	border: 1px solid #52434a;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0,0,0,0.5);
	width: 280px;
	max-width: 90vw;
	top: 50%; left: 50%;
	transform: translate(-50%, -50%);
}
.settings-popup.open { display: block; }

.settings-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 14px 16px 10px;
	border-bottom: 1px solid rgba(255,255,255,0.1);
	font-family: 'Droid Serif', serif;
	font-size: 18px;
	font-weight: 700;
	color: #eaad7a;
}
.settings-header a { color: rgba(255,255,255,0.5) !important; text-decoration: none !important; font-size: 20px; line-height: 1; }
.settings-header a:hover { color: #fff !important; }

.settings-body { padding: 12px 16px 16px; }

.setting-group {
	display: flex;
	gap: 8px;
	margin-bottom: 10px;
	flex-wrap: wrap;
}

.setting-opt {
	color: #f5d3a8 !important;
	text-decoration: none !important;
	font-size: 14px;
	padding: 6px 12px;
	border-radius: 6px;
	border: 1px solid rgba(255,255,255,0.15);
	transition: all 0.15s ease;
}
.setting-opt:hover { border-color: rgba(255,255,255,0.3); color: #fff !important; }
.setting-opt.active-option {
	background: rgba(255,255,255,0.12);
	border-color: #eaad7a;
	color: #eaad7a !important;
	font-weight: 700;
}
.setting-opt.active-option::before { content: "\f00c "; font-family: FontAwesome; font-size: 11px; }

.settings-about {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid rgba(255,255,255,0.1);
}
.settings-about p { color: rgba(255,255,255,0.45); font-size: 12px; line-height: 1.5; margin: 0 0 6px 0; }
.settings-about a { color: #eaad7a !important; text-decoration: none; }
.settings-about a:hover { color: #fff !important; text-decoration: underline; }
.settings-about .settings-credit { font-size: 11px; color: rgba(255,255,255,0.3); }

/* ======================
   GAME LAYOUT
   ====================== */

/* --- Top Row --- */
.top-row { margin-bottom: 14px; }

.top-row-inner {
	display: flex;
	align-items: flex-start;
	max-width: 980px;
	margin: 0 auto;
	padding: 0 10px;
}

.stock-waste-area { display: flex; gap: 10px; flex-shrink: 0; }
.top-spacer { flex: 1; }
.foundation-area { display: flex; gap: 10px; flex-shrink: 0; }

/* Layout swap: stock on right, foundations on left */
.layout-reversed .top-row-inner { flex-direction: row-reverse; }
.layout-reversed .stock-waste-area { flex-direction: row-reverse; }

/* --- Card Slots --- */
.card-slot {
	position: relative;
	width: 120px;
	min-height: 168px;
	border: 2px dashed rgba(255,255,255,0.22);
	border-radius: 8px;
	background: rgba(60,20,35,0.12);
	box-sizing: border-box;
}

.card-slot .slot-label {
	position: absolute;
	top: 50%; left: 50%;
	transform: translate(-50%,-50%);
	color: rgba(255,255,255,0.18);
	font-size: 13px; font-weight: 700;
	text-transform: uppercase; letter-spacing: 1px;
	pointer-events: none; z-index: 0;
}
.foundation .slot-label { font-size: 26px; }

/* --- Tableau --- */
.tableau-row { margin-top: 6px; }

.tableau-inner {
	display: flex;
	gap: 10px;
	max-width: 980px;
	margin: 0 auto;
	padding: 0 10px;
	justify-content: center;
}

.tableau-col { flex: 1; max-width: 120px; min-height: 168px; }

/* ======================
   CARDS
   ====================== */
.card {
	position: absolute;
	width: 120px; height: 168px;
	border-radius: 8px;
	cursor: pointer;
	user-select: none; -webkit-user-select: none;
	transition: box-shadow .12s ease;
	z-index: 1;
}
.card img {
	width: 100%; height: 100%;
	border-radius: 8px;
	pointer-events: none;
	display: block;
}

/* Face-down back design */
.card.face-down {
	background: linear-gradient(135deg, #8c6474, #6b4455);
	border: 2px solid #b08898;
	box-shadow: inset 0 0 12px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.4);
}
.card.face-down::after {
	content: "";
	position: absolute; top: 6px; left: 6px; right: 6px; bottom: 6px;
	border: 1px solid rgba(234,173,122,0.32);
	border-radius: 4px;
	background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(234,173,122,0.1) 5px, rgba(234,173,122,0.1) 10px);
}

/* Face-up */
.card.face-up {
	background: #fff;
	border: 1px solid #bbb;
	box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.card.face-up:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.35); }



/* Drag */
.card.dragging {
	z-index: 1000 !important;
	box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
	opacity: .92;
	cursor: grabbing;
	transition: none !important;
}

/* Drop highlight */
.card-slot.highlight {
	border-color: #eaad7a !important;
	background: rgba(234,173,122,0.2) !important;
	box-shadow: 0 0 15px rgba(234,173,122,0.4);
}

/* Hint */
.card.hint-highlight { box-shadow: 0 0 12px 4px #eaad7a !important; z-index: 50 !important; }

/* Stock states */
.stock-pile { cursor: pointer; }
.stock-pile.has-cards { border-color: transparent; }
.stock-pile.empty-recycle { cursor: pointer; }
.stock-pile.empty-recycle .slot-label::before {
	content: "\f021"; font-family: FontAwesome;
	font-size: 26px; display: block; margin-bottom: 4px;
}

/* Stacking positions handled by JS */
.waste-pile .card,
.foundation .card,
.tableau-col .card { position: absolute; left: 0; }

/* ======================
   QUOTE PANELS
   ====================== */
.quote-panel {
	pointer-events: none;
	z-index: 1;
}

/* Side panels — disabled, always use bottom */
.quote-left, .quote-right {
	display: none !important;
}

/* Bottom panel — fills all space between game and footer */
.quote-bottom {
	flex: 1 0 0;
	padding: 0 30px;
	text-align: center;
	max-width: 900px;
	width: 100%;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	min-height: 60px;
}

.quote-block {
	margin: 0;
	color: rgba(255,245,235,0.82);
	font-size: 22px;
	line-height: 1.45;
	font-style: italic;
	font-family: 'Droid Serif', Georgia, serif;
	text-shadow: 0 1px 3px rgba(0,0,0,0.35);
	transition: opacity 0.35s ease;
}
.quote-block.fade-out { opacity: 0; }
.quote-block .quote-text { margin-bottom: 10px; }
.quote-block .quote-text::before { content: "\201C"; }
.quote-block .quote-text::after { content: "\201D"; }
.quote-block .quote-source {
	font-style: normal;
	font-size: 14px;
	font-family: 'Open Sans', sans-serif;
	color: #eaad7a;
	opacity: 0.75;
}
.quote-block .quote-source::before { content: "\2014 "; }

/* ======================
   WIN MODAL
   ====================== */
#winModal .modal-header {
	background: #5e4f56; color: #fff;
	border-radius: 4px 4px 0 0;
}
#winModal .modal-title i { color: #eaad7a; margin-right: 8px; }
#winModal h3 { font-size: 34px; margin-bottom: 12px; }
#winModal p { font-size: 15px; color: #555; }

/* ======================
   RESPONSIVE
   ====================== */

/* ---- Tablet ---- */
@media (max-width: 991px) {
	.card-slot { width: 100px; min-height: 140px; }
	.card { width: 100px; height: 140px; }
	.top-row-inner, .tableau-inner { max-width: 820px; }
}

/* ---- Phone landscape / small tablet ---- */
@media (max-width: 767px) {
	/* Header: tighten + camera cutout buffer */
	.header { padding-top: 28px !important; }
	.game-header { padding: 5px 8px; gap: 8px; }
	.game-title { font-size: 15px; }
	.game-title .fa { font-size: 16px; }

	/* Bigger stats in header */
	.game-stats { gap: 12px; }
	.game-stats .stat { font-size: 15px; }
	.game-stats .stat i { font-size: 14px; }
	.game-stats .stat b { font-size: 16px; }

	/* Mobile bottom toolbar */
	.game-actions {
		position: fixed !important;
		bottom: 0; left: 0; right: 0;
		background: #5e4f56;
		display: flex !important;
		justify-content: space-around;
		align-items: center;
		padding: 6px 0;
		padding-bottom: max(6px, env(safe-area-inset-bottom));
		z-index: 500;
		border-top: 2px solid #eaad7a;
		box-shadow: 0 -2px 12px rgba(0,0,0,0.4);
		gap: 0 !important;
	}
	.game-actions a {
		display: flex !important;
		flex-direction: column;
		align-items: center;
		gap: 2px;
		padding: 4px 8px !important;
	}
	.game-actions a .fa { font-size: 22px !important; }
	.action-label { display: block !important; font-size: 10px !important; }

	/* Space for fixed bottom toolbar */
	.wrapper { padding-bottom: 64px; }

	.game-board { padding: 8px 0 12px 0; }

	/* Cards: fill horizontal space */
	.top-row-inner, .tableau-inner {
		max-width: 100%;
		padding: 0 4px;
		gap: 4px;
	}
	.stock-waste-area, .foundation-area { gap: 4px; }

	.card-slot {
		width: calc((100vw - 8px - 24px) / 7);
		min-height: calc((100vw - 8px - 24px) / 7 * 1.4);
		border-radius: 5px;
		border-width: 1px;
	}
	.card {
		width: calc((100vw - 8px - 24px) / 7);
		height: calc((100vw - 8px - 24px) / 7 * 1.4);
		border-radius: 5px;
	}
	.card img { border-radius: 5px; }

	.card-slot .slot-label { font-size: 9px; letter-spacing: 0; }
	.foundation .slot-label { font-size: 16px; }

	.top-row { margin-bottom: 8px; }
	.tableau-row { margin-top: 4px; }

	.card.face-down::after { top: 3px; left: 3px; right: 3px; bottom: 3px; border-radius: 3px; }

}

/* ---- Phone portrait (narrow) ---- */
@media (max-width: 480px) {
	.game-header { padding: 4px 6px; gap: 4px; }
	.game-title { font-size: 0; } /* hide text, keep icon */
	.game-title .fa { font-size: 18px; }
	.title-text { display: none; }
	.game-stats { gap: 8px; }
	.game-stats .stat { font-size: 14px; }
	.game-stats .stat b { font-size: 15px; }

	.top-row-inner, .tableau-inner { padding: 0 3px; gap: 3px; }
	.stock-waste-area, .foundation-area { gap: 3px; }

	.card-slot {
		width: calc((100vw - 6px - 18px) / 7);
		min-height: calc((100vw - 6px - 18px) / 7 * 1.4);
	}
	.card {
		width: calc((100vw - 6px - 18px) / 7);
		height: calc((100vw - 6px - 18px) / 7 * 1.4);
	}
}

/* ---- Wide desktop ---- */
@media (min-width: 1400px) {
	.game-board {
		max-width: 1000px;
		margin: 0 auto;
	}
}
