/* ==========================================================================
   Pathways – Frontend Game Styles
   A biblical journey – warm parchment aesthetic
   ========================================================================== */

:root {
	--pw-parchment:    #f8f1e0;
	--pw-parchment-dk: #ede3c8;
	--pw-border:       #c8a96e;
	--pw-border-dk:    #a07840;
	--pw-ink:          #2c1e0f;
	--pw-ink-light:    #5a3e28;
	--pw-ink-muted:    #8a6e50;
	--pw-accent:       #7b3e19;
	--pw-accent-light: #a0522d;
	--pw-accent-faint: #f3e8da;
	--pw-gold:         #c8941a;
	--pw-gold-light:   #f5d87a;
	--pw-success:      #3a6b35;
	--pw-error:        #8b1a1a;
	--pw-shadow:       rgba(44, 30, 15, 0.15);
	--pw-radius:       6px;
}

/* ---------------------------------------------------------------------------
   Body scroll lock (applied when modal is open)
   --------------------------------------------------------------------------- */
body.pw-body-locked {
	overflow: hidden;
}

/* ---------------------------------------------------------------------------
   Launcher card (shown inline on the page)
   --------------------------------------------------------------------------- */
.pw-launcher {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	background: linear-gradient(135deg, #2c1e0f 0%, #3d2b1f 100%);
	border: 2px solid var(--pw-border-dk);
	border-radius: 8px;
	padding: 28px 32px;
	max-width: 720px;
	margin: 0 auto;
	box-shadow: 0 4px 20px rgba(44, 30, 15, 0.3);
}

.pw-launcher__info {
	flex: 1;
	min-width: 0;
}

.pw-launcher__eyebrow {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	color: var(--pw-gold-light);
	font-family: sans-serif;
	margin-bottom: 6px;
}

.pw-launcher__title {
	margin: 0 0 8px;
	font-size: 24px;
	font-weight: normal;
	color: #f5e6c8;
	letter-spacing: 0.02em;
}

.pw-launcher__desc {
	margin: 0;
	font-size: 14px;
	line-height: 1.65;
	color: rgba(245, 230, 200, 0.65);
}

.pw-launcher a {
	color: var(--pw-gold-light);
	text-decoration: underline;
	text-decoration-style: dashed;
	text-underline-offset: 3px;
}

.pw-launcher a:hover {
	color: #fff;
	text-decoration-style: dashed;
}

.pw-launcher__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--pw-gold);
	color: #2c1e0f;
	border: none;
	border-radius: 6px;
	padding: 13px 26px;
	font-size: 15px;
	font-weight: 700;
	font-family: sans-serif;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
	box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.pw-launcher__btn:hover {
	background: var(--pw-gold-light);
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.pw-launcher__btn:active {
	transform: translateY(0);
}

@media (max-width: 540px) {
	.pw-launcher {
		flex-direction: column;
		align-items: flex-start;
		padding: 20px;
	}
	.pw-launcher__btn {
		width: 100%;
		justify-content: center;
	}
}

/* ---------------------------------------------------------------------------
   Game modal wrapper
   --------------------------------------------------------------------------- */
.pw-game-modal {
	position: fixed;
	inset: 0;
	z-index: 9900;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.pw-game-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 12, 4, 0.78);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	cursor: pointer;
}

.pw-game-modal__dialog {
	position: relative;
	z-index: 1;
	width: min(740px, 100%);
	height: min(92vh, 860px);
	display: flex;
	flex-direction: column;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
	animation: pw-modal-in 0.2s ease;
}

@keyframes pw-modal-in {
	from { opacity: 0; transform: scale(0.97) translateY(8px); }
	to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.pw-game-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	z-index: 20;
	background: rgba(0, 0, 0, 0.4);
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 50%;
	color: #f5e6c8;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.15s;
	padding: 0;
}

.pw-game-modal__close:hover {
	background: rgba(0, 0, 0, 0.65);
}

.pw-game-modal__body {
	flex: 1;
	min-height: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

/* Game fills the modal — remove outer rounding since modal provides it */
.pw-game-modal .pw-game {
	max-width: none;
	margin: 0;
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.pw-game-modal .pw-game__header {
	border-radius: 0;
}

.pw-game-modal .pw-game__body {
	border-radius: 0;
}

/* Biblical context sits above the game modal */
.pw-game__context-modal {
	z-index: 9999;
}

/* Full-screen on small devices */
@media (max-width: 540px) {
	.pw-game-modal {
		padding: 0;
	}
	.pw-game-modal__dialog {
		width: 100%;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
	}
}

/* ---------------------------------------------------------------------------
   Container (game itself — inside the modal)
   --------------------------------------------------------------------------- */
.pw-game {
	max-width: 720px;
	margin: 0 auto;
	font-family: Georgia, 'Times New Roman', serif;
	color: var(--pw-ink);
	position: relative;
}

/* ---------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------- */
.pw-game__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	background: var(--pw-ink);
	color: #f5e6c8;
	padding: 16px 20px;
	border-radius: var(--pw-radius) var(--pw-radius) 0 0;
	border: 2px solid var(--pw-border-dk);
	border-bottom: none;
}

.pw-game__eyebrow {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--pw-gold-light);
	margin-bottom: 3px;
	font-family: sans-serif;
}

.pw-game__title {
	margin: 0;
	font-size: 20px;
	font-weight: normal;
	letter-spacing: 0.02em;
	color: #f5e6c8;
}

.pw-game__header-actions {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-shrink: 0;
}

.pw-icon-btn {
	background: rgba(255,255,255,0.1);
	border: 1px solid rgba(255,255,255,0.25);
	border-radius: var(--pw-radius);
	color: #f5e6c8;
	padding: 7px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s;
}

.pw-icon-btn:hover {
	background: rgba(255,255,255,0.2);
}

/* ---------------------------------------------------------------------------
   Loading
   --------------------------------------------------------------------------- */
.pw-game__loading {
	background: var(--pw-parchment);
	border: 2px solid var(--pw-border);
	border-top: none;
	padding: 48px 24px;
	text-align: center;
	color: var(--pw-ink-muted);
}

.pw-game__loading-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid var(--pw-border);
	border-top-color: var(--pw-accent);
	border-radius: 50%;
	animation: pw-spin 0.8s linear infinite;
	margin: 0 auto 16px;
}

@keyframes pw-spin {
	to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------------------
   Body
   --------------------------------------------------------------------------- */
.pw-game__body {
	background: var(--pw-parchment);
	border: 2px solid var(--pw-border);
	border-top: none;
	border-radius: 0 0 var(--pw-radius) var(--pw-radius);
	/* Flex column so location panel + nav are fixed height, log fills the rest */
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

/* ---------------------------------------------------------------------------
   Location Panel
   --------------------------------------------------------------------------- */
.pw-game__location-panel {
	padding: 24px 24px 0;
	border-bottom: 1px solid var(--pw-border);
	flex-shrink: 0;
}

.pw-game__location-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}

.pw-game__location-title {
	margin: 0;
	font-size: 22px;
	font-weight: normal;
	color: var(--pw-accent);
	letter-spacing: 0.02em;
	font-style: italic;
}

.pw-game__btn-context {
	background: none;
	border: 1px solid var(--pw-border);
	border-radius: 20px;
	color: var(--pw-ink-muted);
	font-size: 12px;
	font-family: sans-serif;
	padding: 4px 12px;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.15s;
}

.pw-game__btn-context:hover {
	background: var(--pw-accent-faint);
	border-color: var(--pw-accent);
	color: var(--pw-accent);
}

.pw-game__description {
	font-size: 15px;
	line-height: 1.8;
	color: var(--pw-ink);
	margin-bottom: 16px;
}

/* Objects tray — fixed band at the bottom of the game body */
.pw-game__objects {
	flex-shrink: 0;
	background: var(--pw-parchment-dk);
	border-top: 2px solid var(--pw-border);
	padding: 10px 24px 12px;
	min-height: 58px;
	max-height: 110px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

.pw-game__objects-label {
	margin: 0 0 6px;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--pw-ink-muted);
	font-family: sans-serif;
	flex-shrink: 0;
}

.pw-game__objects-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.pw-game__objects-empty {
	font-size: 13px;
	font-style: italic;
	color: var(--pw-ink-muted);
	font-family: sans-serif;
}

.pw-game__object-item {
	display: flex;
	align-items: center;
	gap: 8px;
}

.pw-game__object-name {
	flex: 1;
	font-size: 14px;
}

.pw-game__object-name::before {
	content: '✦ ';
	color: var(--pw-gold);
	font-size: 10px;
}

.pw-object-btn {
	background: var(--pw-parchment);
	border: 1px solid var(--pw-border);
	border-radius: 20px;
	color: var(--pw-ink-light);
	font-size: 11px;
	font-family: sans-serif;
	padding: 3px 10px;
	cursor: pointer;
	transition: all 0.15s;
}

.pw-object-btn:hover {
	background: var(--pw-accent-faint);
	border-color: var(--pw-accent-light);
	color: var(--pw-accent);
}

.pw-object-btn--take {
	background: var(--pw-accent-faint);
	border-color: var(--pw-accent-light);
	color: var(--pw-accent);
}

.pw-object-btn--take:hover {
	background: var(--pw-accent);
	color: #fff;
}

/* ---------------------------------------------------------------------------
   Navigation (Compass)
   --------------------------------------------------------------------------- */
.pw-game__nav {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 16px 24px;
	border-bottom: 1px solid var(--pw-border);
	flex-shrink: 0;
}

.pw-compass {
	display: grid;
	gap: 4px;
	flex-shrink: 0;
}

.pw-compass__row {
	display: flex;
	justify-content: center;
	gap: 4px;
}

.pw-compass__center {
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--pw-border);
}

.pw-compass__btn {
	width: 48px;
	height: 48px;
	background: var(--pw-parchment-dk);
	border: 2px solid var(--pw-border);
	border-radius: var(--pw-radius);
	color: var(--pw-ink);
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1px;
	transition: all 0.15s;
	font-family: sans-serif;
}

.pw-compass__btn:not(:disabled):hover {
	background: var(--pw-accent);
	border-color: var(--pw-accent);
	color: #fff;
}

.pw-compass__btn:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.pw-compass__label {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.pw-compass__arrow {
	font-size: 18px;
	line-height: 1;
}

.pw-game__exits-label {
	font-size: 13px;
	color: var(--pw-ink-muted);
	font-style: italic;
	font-family: sans-serif;
	line-height: 1.6;
}

/* ---------------------------------------------------------------------------
   Message Log
   --------------------------------------------------------------------------- */
.pw-game__log-wrap {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	padding: 0 24px 12px;
	overflow: hidden;
}

.pw-game__log-label {
	font-size: 11px;
	font-family: sans-serif;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--pw-ink-muted);
	padding: 10px 0 6px;
	border-top: 1px solid var(--pw-border);
	margin-top: 0;
	flex-shrink: 0;
}

.pw-game__log {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.pw-log-entry {
	font-size: 14px;
	line-height: 1.6;
	padding: 2px 0;
	border-bottom: 1px solid transparent;
	font-family: sans-serif;
}

.pw-log-entry--action {
	color: var(--pw-ink-muted);
	font-style: italic;
}

.pw-log-entry--action::before {
	content: '> ';
	color: var(--pw-gold);
}

.pw-log-entry--result {
	color: var(--pw-ink);
}

.pw-log-entry--error {
	color: var(--pw-error);
}

.pw-log-entry--system {
	color: var(--pw-gold);
	font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Inventory Panel
   --------------------------------------------------------------------------- */
.pw-game__inventory {
	position: absolute;
	top: 60px;
	right: 0;
	width: 280px;
	background: var(--pw-parchment);
	border: 2px solid var(--pw-border-dk);
	border-radius: var(--pw-radius);
	box-shadow: 0 8px 24px var(--pw-shadow);
	z-index: 100;
}

.pw-game__inventory-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border-bottom: 1px solid var(--pw-border);
	background: var(--pw-ink);
	border-radius: var(--pw-radius) var(--pw-radius) 0 0;
}

.pw-game__inventory-header h3 {
	margin: 0;
	font-size: 14px;
	font-weight: normal;
	color: #f5e6c8;
	letter-spacing: 0.04em;
}

.pw-game__inventory-close {
	background: none;
	border: none;
	color: #f5e6c8;
	cursor: pointer;
	font-size: 16px;
	padding: 0;
	line-height: 1;
	opacity: 0.7;
}

.pw-game__inventory-close:hover {
	opacity: 1;
}

.pw-game__inventory-body {
	padding: 12px 16px;
	max-height: 280px;
	overflow-y: auto;
}

.pw-inventory-empty {
	color: var(--pw-ink-muted);
	font-style: italic;
	font-size: 13px;
	text-align: center;
	margin: 12px 0;
}

.pw-inventory-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.pw-inventory-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	border-bottom: 1px solid var(--pw-border);
}

.pw-inventory-item:last-child {
	border-bottom: none;
}

.pw-inventory-item__icon {
	color: var(--pw-gold);
	font-size: 16px;
	flex-shrink: 0;
}

.pw-inventory-item__name {
	flex: 1;
	font-size: 14px;
}

.pw-inventory-drop-btn {
	background: none;
	border: 1px solid var(--pw-border);
	border-radius: 20px;
	color: var(--pw-ink-muted);
	font-size: 11px;
	font-family: sans-serif;
	padding: 2px 9px;
	cursor: pointer;
	transition: all 0.15s;
	flex-shrink: 0;
}

.pw-inventory-drop-btn:hover {
	background: var(--pw-error);
	border-color: var(--pw-error);
	color: #fff;
}

/* ---------------------------------------------------------------------------
   Biblical Context Modal
   --------------------------------------------------------------------------- */
.pw-game__context-modal .pw-modal__box--context {
	max-width: 560px;
	width: 90%;
	padding: 0;
	overflow: hidden;
	background: var(--pw-parchment);
	border: 2px solid var(--pw-border-dk);
}

.pw-modal__context-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	background: var(--pw-ink);
	color: #f5e6c8;
}

.pw-modal__context-header h3 {
	margin: 0;
	font-size: 18px;
	font-weight: normal;
}

.pw-modal__close-btn {
	background: none;
	border: none;
	color: #f5e6c8;
	font-size: 20px;
	cursor: pointer;
	padding: 0;
	line-height: 1;
	opacity: 0.7;
}

.pw-modal__close-btn:hover {
	opacity: 1;
}

.pw-modal__context-body {
	padding: 20px;
	font-size: 15px;
	line-height: 1.8;
	max-height: 50vh;
	overflow-y: auto;
	color: var(--pw-ink);
}

.pw-modal__context-footer {
	padding: 12px 20px 16px;
	border-top: 1px solid var(--pw-border);
	text-align: right;
}

/* Generic modal base */
.pw-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pw-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(44, 30, 15, 0.6);
}

.pw-modal__box {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: var(--pw-radius);
	box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.pw-btn {
	display: inline-flex;
	align-items: center;
	padding: 8px 18px;
	border-radius: var(--pw-radius);
	font-size: 13px;
	font-family: sans-serif;
	font-weight: 600;
	cursor: pointer;
	border: 1px solid transparent;
	text-decoration: none;
	transition: background 0.15s, color 0.15s;
	line-height: 1.4;
}

.pw-btn--secondary {
	background: var(--pw-parchment-dk);
	color: var(--pw-ink);
	border-color: var(--pw-border);
}

.pw-btn--secondary:hover {
	background: var(--pw-accent-faint);
	border-color: var(--pw-accent-light);
	color: var(--pw-accent);
}

/* ---------------------------------------------------------------------------
   Error state
   --------------------------------------------------------------------------- */
.pw-error {
	color: var(--pw-error);
	font-style: italic;
	font-size: 14px;
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 540px) {
	.pw-game__nav {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}
	.pw-game__inventory {
		width: calc(100% - 2px);
		right: 0;
		left: 0;
	}
	.pw-game__location-header {
		flex-direction: column;
		align-items: flex-start;
	}
}
