/* ==========================================================================
   HeroQuest 3000 - In-Game HUD, Character Card & Action Controls
   ========================================================================== */

#hudLookButton {
	position: fixed !important;
	left: 20px !important;
	right: auto !important;
	bottom: 20px !important;
	z-index: 10000 !important;
	background: #2e6b3b !important;
	color: #fff !important;
	border: 2px solid #2d1f10 !important;
	font-family: 'MedievalSharp', serif !important;
	font-size: 18px !important;
	border-radius: 6px !important;
	padding: 10px 20px !important;
	transition: all 0.2s ease !important;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
	cursor: pointer;
	pointer-events: auto !important;
}

#hudLookButton:hover {
	background: #3e8e4f !important;
	transform: scale(1.05) !important;
}

/* Lower HUD Controls Row */
.hud-controls-row {
	position: fixed !important;
	left: 20px !important;
	bottom: 20px !important;
	z-index: 50000 !important;
	display: flex;
	gap: 12px !important;
	align-items: center !important;
	pointer-events: auto !important;
}

.hud-btn {
	color: #fff !important;
	border: 2px solid #2d1f10 !important;
	font-family: 'MedievalSharp', serif !important;
	font-size: 16px !important;
	border-radius: 6px !important;
	padding: 10px 18px !important;
	transition: all 0.2s ease !important;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
	cursor: var(--gauntlet-cursor, url('/webp/gauntlet_pointer.webp') 0 0, default) !important;
	user-select: none !important;
}

.hud-btn:disabled {
	background: #777777 !important;
	opacity: 0.6 !important;
	cursor: not-allowed !important;
	transform: none !important;
	box-shadow: none !important;
}

.hud-btn:hover:not(:disabled) {
	transform: scale(1.05) !important;
}

.hud-btn-look {
	background: #2e6b3b !important;
}

.hud-btn-look:hover:not(:disabled) {
	background: #3e8e4f !important;
}

.hud-btn-quest-start {
	background: #8c281f !important;
}

.hud-btn-quest-start:hover:not(:disabled) {
	background: #b71c1c !important;
}

.hud-btn-quests,
.hud-btn-options,
.hud-btn-armory,
.hud-btn-monsters {
	background: #5d4037 !important;
}

.hud-btn-quests:hover:not(:disabled),
.hud-btn-options:hover:not(:disabled),
.hud-btn-armory:hover:not(:disabled),
.hud-btn-monsters:hover:not(:disabled) {
	background: #795548 !important;
}

.hud-btn-journal {
	background: #8c6c53 !important;
	color: #ffffff !important;
}

.hud-btn-journal:hover:not(:disabled) {
	background: #a18269 !important;
}

/* Card tabs bar */
.card-tabs-container {
	display: flex;
	flex-direction: row;
	width: 100%;
	border-bottom: 2px solid #5d4037;
	margin-bottom: 10px;
	background: rgba(93, 64, 55, 0.08);
	border-radius: 3px 3px 0 0;
	overflow: hidden;
}

.card-tab {
	flex: 1;
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	padding: 6px 4px;
	font-family: 'Pirata One', serif;
	font-size: 19px;
	font-weight: normal;
	color: #5d4037;
	cursor: pointer;
	text-align: center;
	text-transform: uppercase;
	transition: all 0.2s ease;
	outline: none;
	position: relative;
}

.card-tab:hover {
	background: rgba(93, 64, 55, 0.15);
	color: #8c281f;
}

.card-tab.selected {
	background: #fcf8f0;
	color: #8c281f;
	border-bottom: 3px solid #8c281f;
	font-weight: normal;
}

.card-tab.turn-active {
	box-shadow: inset 0 -3px 0 0 #ffd700;
	font-weight: normal;
}

/* Card tab ragnar default hidden */
.card-tab[data-tab="ragnar"] {
	display: none;
}

/* Zargon sub-tabs */
.zargon-sub-tabs-container {
	display: none;
	flex-direction: row;
	flex-wrap: wrap;
	width: 100%;
	border-bottom: 1px solid rgba(93, 64, 55, 0.3);
	margin-bottom: 12px;
	gap: 6px;
	padding: 4px 8px;
	background: rgba(140, 40, 31, 0.05);
}

.zargon-sub-tab {
	background: rgba(93, 64, 55, 0.1);
	border: 1px solid #5d4037;
	border-radius: 4px;
	padding: 4px 10px;
	font-family: 'MedievalSharp', serif;
	font-size: 13px;
	color: #5d4037;
	cursor: pointer;
	transition: all 0.2s ease;
}

.zargon-sub-tab:hover {
	background: rgba(140, 40, 31, 0.15);
	color: #8c281f;
}

.zargon-sub-tab.selected {
	background: #8c281f;
	color: #fff;
	border-color: #8c281f;
	font-weight: bold;
}

.zargon-sub-tab.turn-active {
	box-shadow: 0 0 6px #ffd700;
	border-color: #ffd700;
}

/* HTML Character Card HUD */
#characterCardHUD {
	position: absolute;
	bottom: 100px;
	left: 20px;
	z-index: 1000;
	width: 660px;
	background: #fcf8f0;
	border-radius: 3px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
	font-family: 'MedievalSharp', serif;
	color: #3e2723;
	padding: 18px 18px;
	display: none;
	flex-direction: column !important;
	gap: 12px;
	max-height: 85vh;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: #5d4037 rgba(93, 64, 55, 0.1);
}

#characterCardHUD::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

#characterCardHUD::-webkit-scrollbar-track {
	background: rgba(93, 64, 55, 0.1);
	border-radius: 4px;
}

#characterCardHUD::-webkit-scrollbar-thumb {
	background: #5d4037;
	border-radius: 4px;
	border: 1px solid #3e2723;
}

#characterCardHUD::-webkit-scrollbar-thumb:hover {
	background: #8c281f;
	border: 1px solid #5a1a14;
}

/* Card Empty and Fallen States */
.zargon-empty-container,
.hero-dead-container {
	display: none;
	justify-content: center;
	align-items: center;
	width: 100%;
	padding: 10px;
}

.zargon-empty-container img,
.hero-dead-container img {
	max-height: 560px;
	border-radius: 8px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Card Main Body Columns Container */
.card-body-container {
	display: flex;
	flex-direction: row;
	gap: 12px;
	width: 100%;
}

.card-header {
	text-align: center;
	border-bottom: 2px solid rgba(93, 64, 55, 0.2);
	padding-bottom: 6px;
}

.card-title {
	font-family: 'Pirata One', serif;
	font-size: 26px;
	color: #8c281f;
	margin: 0;
	line-height: 1.1;
	letter-spacing: 0.5px;
}

.card-subtitle {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	color: #795548;
	font-weight: bold;
	margin-top: 2px;
}

.card-behavior-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-family: 'Segoe UI', system-ui, sans-serif;
	font-size: 10.5px;
	font-weight: 700;
	color: #fbbf24;
	background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
	border: 1px solid rgba(245, 158, 11, 0.5);
	padding: 2px 8px;
	border-radius: 4px;
	margin-top: 4px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.card-portrait-container {
	width: 100%;
	height: auto;
	min-height: 160px;
	max-height: 280px;
	display: flex;
	justify-content: center;
	align-items: center;
	background: rgba(93, 64, 55, 0.05);
	overflow: hidden;
	box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.15);
	border-radius: 6px;
	padding: 4px;
}

.card-portrait {
	width: 100%;
	max-width: 100%;
	height: auto;
	max-height: 270px;
	object-fit: contain;
	opacity: 1;
	transition: opacity 0.18s ease-in-out;
}

.card-portrait.portrait-fade-out {
	opacity: 0;
}

.card-portrait.portrait-fade-in {
	opacity: 1;
}

.card-portrait-fallback {
	font-size: 14px;
	font-style: italic;
	color: #8d6e63;
	padding: 10px;
	text-align: center;
}

.card-turn-state {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 6px;
}

.card-badge {
	width: 100%;
	font-size: 11px;
	font-weight: bold;
	color: #fff;
	text-align: center;
	padding: 6px 10px;
	border-radius: 6px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
	text-transform: uppercase;
	line-height: 1.3;
	word-break: break-word;
}

.moves-tally-value {
	font-size: 24px;
	font-weight: bold;
	margin-top: 4px;
	letter-spacing: 1px;
	display: block;
	color: #fff;
}

.card-jump-instruction {
	font-size: 11px;
	color: #8d6e63;
	text-align: center;
	line-height: 1.35;
	padding: 2px 4px;
	letter-spacing: 0.2px;
	cursor: var(--gauntlet-cursor, url('/webp/gauntlet_pointer.webp') 0 0, pointer);
	transition: color 0.2s ease, text-shadow 0.2s ease;
}

.card-jump-instruction:hover {
	color: #e65100;
	text-shadow: 0 0 6px rgba(230, 81, 0, 0.5);
}

.card-badge.bg-green {
	background: #2e6b3b;
	border: 1px solid #1b4d22;
}

.card-badge.bg-dark-green {
	background: #1b4d22;
	border: 1px solid #0e2e13;
}

.card-badge.bg-red {
	background: #c62828;
	border: 1px solid #8e0000;
}

.card-badge.bg-dark-red {
	background: #8b0000;
	border: 1px solid #5a0000;
}

.card-badge.bg-grey {
	background: #616161;
	border: 1px solid #424242;
}

.card-stats-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}

.stat-box {
	background: #e8e1c5;
	border: 1px solid #5d4037;
	border-radius: 6px;
	padding: 6px 10px;
	display: flex;
	align-items: center;
	gap: 6px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
	font-size: 16px;
}

.stat-label {
	font-size: 10px;
	font-weight: bold;
	color: #5d4037;
	flex-grow: 1;
}

.stat-value {
	font-size: 13px;
	font-weight: bold;
	color: #3e2723;
}

.card-inventory {
	display: flex;
	flex-direction: row;
	gap: 10px;
	border-top: 1px dashed rgba(93, 64, 55, 0.3);
	padding-top: 6px;
}

.card-inventory-left {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.card-inventory-right {
	display: flex;
	flex-direction: column;
	gap: 6px;
	align-items: center;
	border-left: 1px dashed rgba(93, 64, 55, 0.2);
	padding-left: 10px;
	min-width: 48px;
}

.card-inventory-right.two-columns {
	min-width: 86px;
}

.card-inventory-right.three-columns {
	min-width: 128px;
}

.spells-thumbnail-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.spells-thumbnail-list.two-columns {
	display: grid;
	grid-template-columns: repeat(2, 39px);
	gap: 4px;
	justify-content: center;
}

.spells-thumbnail-list.three-columns {
	display: grid;
	grid-template-columns: repeat(3, 39px);
	gap: 4px;
	justify-content: center;
}

.spell-thumb-img {
	width: 39px;
	height: auto;
	cursor: pointer;
	border-radius: 3px;
	transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.spell-thumb-img:hover {
	transform: scale(1.1);
	box-shadow: 0 0 5px rgba(230, 81, 0, 0.6);
}

.inventory-section {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.inventory-header {
	font-size: 10px;
	font-weight: bold;
	color: #8c281f;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.inventory-list {
	background: rgba(93, 64, 55, 0.04);
	border: 1px solid rgba(93, 64, 55, 0.15);
	border-radius: 4px;
	padding: 6px 8px;
	font-size: 11px;
	line-height: 1.3;
	color: #4e342e;
	min-height: 18px;
}

#cardInvBackpackSection {
	display: none;
}

#cardInvBackpackSection .inventory-header {
	color: #8d6e63;
}

#cardInvBackpack {
	background: rgba(141, 110, 99, 0.08);
	border: 1px dashed rgba(141, 110, 99, 0.3);
}

#cardInvSpellsContainer {
	display: none;
}

/* Character Card Inventory Item Tokens */
.hud-inventory-item {
	cursor: pointer;
	display: inline-block;
}

.hud-inventory-item.item-standard {
	color: #e65100;
}

.hud-inventory-item.item-artifact {
	color: #e040fb;
}

.hud-inventory-item.item-potion {
	color: #00b0ff;
}

.hud-inventory-item.item-affliction {
	color: #e040fb;
}

.hud-inventory-item.item-backpack {
	color: #8d6e63;
}

.hud-inventory-item.item-equipped {
	color: #4caf50;
}

/* 2-Column Character Card HUD Column Styles */
.hud-card-column {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.card-col-info {
	flex: 1.1;
	min-width: 180px;
}

.card-col-stats {
	flex: 2;
	min-width: 380px;
	border-left: 1px dashed rgba(93, 64, 55, 0.3);
	padding-left: 12px;
}

.card-actions-container {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	margin-top: 12px;
	border-top: 2px solid rgba(93, 64, 55, 0.2);
	padding-top: 10px;
}

/* HTML Card HUD Action Buttons */
.hud-action-btn {
	border: none !important;
	border-radius: 6px;
	color: #fff;
	font-family: 'MedievalSharp', serif;
	font-size: 14px;
	font-weight: bold;
	padding: 8px 6px;
	cursor: pointer;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
	transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
	outline: none !important;
	text-transform: uppercase;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	white-space: nowrap;
}

.hud-action-btn:hover:not(:disabled) {
	transform: scale(1.04);
	filter: brightness(1.15);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
	border: none !important;
}

.hud-action-btn:active:not(:disabled) {
	transform: scale(0.96);
	filter: brightness(0.9);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	border: none !important;
}

.hud-action-btn:focus {
	border: none !important;
	outline: none !important;
}

.hud-action-btn:disabled {
	background: #777777 !important;
	cursor: var(--gauntlet-cursor, url('/webp/gauntlet_pointer.webp') 0 0, default) !important;
	opacity: 0.6;
	box-shadow: none;
	border: none !important;
}

@keyframes btn-breathing-pulse {
	0% {
		box-shadow: 0 0 4px rgba(255, 235, 59, 0.6), 0 0 10px rgba(255, 193, 7, 0.4);
		transform: scale(1);
		filter: brightness(1.0);
	}

	50% {
		box-shadow: 0 0 16px rgba(255, 235, 59, 0.95), 0 0 26px rgba(255, 193, 7, 0.85);
		transform: scale(1.05);
		filter: brightness(1.25);
	}

	100% {
		box-shadow: 0 0 4px rgba(255, 235, 59, 0.6), 0 0 10px rgba(255, 193, 7, 0.4);
		transform: scale(1);
		filter: brightness(1.0);
	}
}

.btn-breathing:not(:disabled) {
	animation: btn-breathing-pulse 1.6s infinite ease-in-out !important;
}

/* Action Button Color-Coding */
.hud-action-btn.color-search {
	background-color: #5a483a;
}

.hud-action-btn.color-search:hover:not(:disabled) {
	background-color: #7d6552;
}

.hud-action-btn.color-door {
	background-color: #8c6d31;
}

.hud-action-btn.color-door:hover:not(:disabled) {
	background-color: #bfa04a;
}

.hud-action-btn.color-give {
	background-color: #2c5270;
}

.hud-action-btn.color-give:hover:not(:disabled) {
	background-color: #41739c;
}

.hud-action-btn.color-pass {
	background-color: #d84315;
}

.hud-action-btn.color-pass:hover:not(:disabled) {
	background-color: #f4511e;
}

.hud-action-btn.color-roll {
	background-color: #2e6b3b;
}

.hud-action-btn.color-roll:hover:not(:disabled) {
	background-color: #419653;
}

.hud-action-btn.color-attack {
	background-color: #8c281f;
}

.hud-action-btn.color-attack:hover:not(:disabled) {
	background-color: #b71c1c;
}

.hud-action-btn.color-spell {
	background-color: #2c5270;
}

.hud-action-btn.color-spell:hover:not(:disabled) {
	background-color: #41739c;
}

.hud-action-btn.color-slay {
	background-color: #800000;
	border: 1px solid #5a0000 !important;
	letter-spacing: 1px;
	margin-top: auto;
	width: 100%;
}

.hud-action-btn.color-slay:hover:not(:disabled) {
	background-color: #b71c1c;
	box-shadow: 0 0 8px rgba(183, 28, 28, 0.6);
}

/* Item Element Popup Color-Coding */
.hud-action-btn.item-color-weapon {
	background-color: #c85a17;
	border-color: #f39c12;
}

.hud-action-btn.item-color-weapon:hover:not(:disabled) {
	background-color: #e67e22;
	border-color: #ffd54f;
}

.hud-action-btn.item-color-spell,
.hud-action-btn.item-color-magic {
	background-color: #6a1b9a;
	border-color: #ba68c8;
}

.hud-action-btn.item-color-spell:hover:not(:disabled),
.hud-action-btn.item-color-magic:hover:not(:disabled) {
	background-color: #8e24aa;
	border-color: #e1bee7;
}

.hud-action-btn.item-color-armor {
	background-color: #2c5270;
	border-color: #5dade2;
}

.hud-action-btn.item-color-armor:hover:not(:disabled) {
	background-color: #41739c;
	border-color: #aed6f1;
}

.hud-action-btn.item-color-gold {
	background-color: #b8860b;
	border-color: #ffd700;
	color: #ffffff;
}

.hud-action-btn.item-color-gold:hover:not(:disabled) {
	background-color: #d4af37;
	border-color: #fff9c4;
}

.hud-action-btn.item-color-artifact {
	background-color: #c2185b;
	border-color: #ff6090;
}

.hud-action-btn.item-color-artifact:hover:not(:disabled) {
	background-color: #e91e63;
	border-color: #f8bbd0;
}

.hud-action-btn.item-color-potion {
	background-color: #283593;
	border-color: #7986cb;
}

.hud-action-btn.item-color-potion:hover:not(:disabled) {
	background-color: #3f51b5;
	border-color: #c5cae9;
}

.hud-action-btn.item-color-equipment {
	background-color: #5a483a;
	border-color: #8c6c53;
}

.hud-action-btn.item-color-equipment:hover:not(:disabled) {
	background-color: #7d6552;
	border-color: #d7ccc8;
}

/* ==========================================================================
   Character Card Dark Mode
   ========================================================================== */
#characterCardHUD.dark-mode {
	background: #2d2825;
	color: #ede6dc;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75);
	border: 1px solid #4a3e36;
	scrollbar-color: #544941 rgba(0, 0, 0, 0.3);
}

#characterCardHUD.dark-mode::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.3);
}

#characterCardHUD.dark-mode::-webkit-scrollbar-thumb {
	background: #544941;
	border-color: #2d2825;
}

#characterCardHUD.dark-mode .card-tabs-container {
	border-bottom: 2px solid #4a3e36;
	background: rgba(0, 0, 0, 0.25);
}

#characterCardHUD.dark-mode .card-tab {
	color: #c2b4a3;
}

#characterCardHUD.dark-mode .card-tab:hover {
	background: rgba(255, 255, 255, 0.08);
	color: #ff8a80;
}

#characterCardHUD.dark-mode .card-tab.selected {
	background: #2d2825;
	color: #ff8a80;
	border-bottom: 3px solid #b71c1c;
}

#characterCardHUD.dark-mode .zargon-sub-tabs-container {
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(0, 0, 0, 0.25);
}

#characterCardHUD.dark-mode .zargon-sub-tab {
	background: rgba(255, 255, 255, 0.05);
	border-color: #544941;
	color: #c2b4a3;
}

#characterCardHUD.dark-mode .zargon-sub-tab:hover {
	background: rgba(183, 28, 28, 0.3);
	color: #ff8a80;
}

#characterCardHUD.dark-mode .card-header {
	border-bottom-color: rgba(255, 255, 255, 0.1);
}

#characterCardHUD.dark-mode .card-title {
	color: #ff8a80;
}

#characterCardHUD.dark-mode .card-subtitle {
	color: #bcaaa4;
}

#characterCardHUD.dark-mode .card-portrait-container {
	background: rgba(0, 0, 0, 0.25);
	box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
}

#characterCardHUD.dark-mode .card-portrait-fallback {
	color: #a89f91;
}

#characterCardHUD.dark-mode .card-jump-instruction {
	color: #bcaaa4;
}

#characterCardHUD.dark-mode .card-jump-instruction:hover {
	color: #ffb74d;
	text-shadow: 0 0 6px rgba(255, 183, 77, 0.5);
}

#characterCardHUD.dark-mode .stat-box {
	background: #3d3632;
	border-color: #544941;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#characterCardHUD.dark-mode .stat-label {
	color: #bfaea0;
}

#characterCardHUD.dark-mode .stat-value {
	color: #fff4ea;
}

#characterCardHUD.dark-mode .card-inventory {
	border-top-color: rgba(255, 255, 255, 0.15);
}

#characterCardHUD.dark-mode .card-inventory-right {
	border-left-color: rgba(255, 255, 255, 0.15);
}

#characterCardHUD.dark-mode .inventory-header {
	color: #ff8a80;
}

#characterCardHUD.dark-mode .inventory-list {
	background: rgba(0, 0, 0, 0.25);
	border-color: rgba(255, 255, 255, 0.1);
	color: #d7cec7;
}

#characterCardHUD.dark-mode #cardInvBackpackSection .inventory-header {
	color: #bcaaa4;
}

#characterCardHUD.dark-mode #cardInvBackpack {
	background: rgba(0, 0, 0, 0.35);
	border-color: rgba(255, 255, 255, 0.15);
}

#characterCardHUD.dark-mode .card-col-stats {
	border-left-color: rgba(255, 255, 255, 0.15);
}

#characterCardHUD.dark-mode .card-actions-container {
	border-top-color: rgba(255, 255, 255, 0.1);
}