/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	background: #0a0a0f;
	color: #d4b896;
	font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic Pro', 'Hiragino Sans', 'MS Gothic', 'Meiryo', 'Courier New', Courier, monospace;
	font-size: 14px;
	line-height: 1.6;
	min-height: 100vh;
	padding-top: 52px;
	padding-bottom: 24px;
}

/* ===== STATUS BAR (fixed top) ===== */
#status-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	background: #0d0d18;
	border-bottom: 1px solid #2a2a3e;
	display: flex;
	align-items: center;
	justify-content: space-around;
	padding: 6px 8px;
	font-size: 12px;
	flex-wrap: wrap;
	gap: 4px;
}

.sb-item {
	white-space: nowrap;
}

.sb-label {
	color: #8888aa;
}

.sb-val {
	color: #d4b896;
	font-weight: bold;
}

.sb-debt {
	color: #e05050;
}

.sb-gold {
	color: #d4a050;
}

.sb-hunger {
	color: #e0a050;
}

.sb-stress {
	color: #c06090;
}

/* ===== MAIN CONTAINER ===== */
#app {
	max-width: 640px;
	margin: 0 auto;
	padding: 12px 12px 0;
}

/* ===== PANELS ===== */
.panel {
	background: #12121e;
	border: 1px solid #2a2a3e;
	border-radius: 6px;
	padding: 14px 16px;
	margin-bottom: 12px;
}

.panel-title {
	font-size: 15px;
	color: #a0b8d8;
	border-bottom: 1px solid #2a2a3e;
	padding-bottom: 6px;
	margin-bottom: 10px;
	letter-spacing: 0.05em;
}

.panel-title .sub {
	font-size: 11px;
	color: #6070a0;
	margin-left: 8px;
}

/* ===== TITLE SCREEN ===== */
#title-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 32px 0 20px;
	text-align: center;
}

.game-title-jp {
	font-size: clamp(20px, 5vw, 28px);
	color: #d4a050;
	letter-spacing: 0.1em;
	text-shadow: 0 0 16px #d4a05066;
	margin-bottom: 4px;
}

.game-title-en {
	font-size: 11px;
	color: #6070a0;
	margin-bottom: 24px;
	letter-spacing: 0.15em;
}

.game-desc {
	font-size: 13px;
	color: #9090b0;
	max-width: 400px;
	margin-bottom: 28px;
	line-height: 1.8;
}

/* ===== BUTTONS ===== */
.btn {
	display: inline-block;
	background: #1e1e30;
	border: 1px solid #d4a050;
	color: #d4a050;
	padding: 8px 18px;
	font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic Pro', 'Hiragino Sans', 'MS Gothic', 'Meiryo', 'Courier New', monospace;
	font-size: 13px;
	cursor: pointer;
	border-radius: 4px;
	transition: background 0.15s, color 0.15s;
	text-align: center;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	letter-spacing: 0.03em;
}

.btn:hover,
.btn:active {
	background: #2e2e45;
}

.btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	background: #1e1e30;
}

.btn-block {
	display: block;
	width: 100%;
	margin-bottom: 8px;
	padding: 10px 16px;
}

.btn-danger {
	border-color: #e05050;
	color: #e05050;
}

.btn-danger:hover {
	background: #2e1e1e;
}

.btn-success {
	border-color: #50c878;
	color: #50c878;
}

.btn-success:hover {
	background: #1e2e22;
}

.btn-info {
	border-color: #6090d0;
	color: #6090d0;
}

.btn-info:hover {
	background: #1e2230;
}

.btn-sm {
	padding: 5px 12px;
	font-size: 12px;
}

.btn-group {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 8px;
}

/* ===== LOG ===== */
.log-area {
	background: #0c0c14;
	border: 1px solid #1e1e2e;
	border-radius: 4px;
	padding: 8px 10px;
	font-size: 12px;
	max-height: 120px;
	overflow-y: auto;
}

.log-entry {
	padding: 1px 0;
}

.log-normal {
	color: #d4b896;
}

.log-warn {
	color: #e0a050;
}

.log-danger {
	color: #e05050;
}

.log-good {
	color: #50c878;
}

/* ===== STATS ROW ===== */
.stats-row {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 13px;
	margin-bottom: 8px;
}

.stat-item {
	display: flex;
	align-items: center;
	gap: 4px;
}

.stat-lbl {
	color: #8888aa;
	font-size: 11px;
}

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap {
	background: #1a1a2a;
	border-radius: 3px;
	height: 8px;
	overflow: hidden;
	margin: 4px 0;
}

.progress-bar-fill {
	height: 100%;
	border-radius: 3px;
	transition: width 0.3s;
}

.bar-hunger {
	background: #e0a050;
}

.bar-stress {
	background: #c06090;
}

.bar-risk {
	background: #e05050;
}

/* ===== INVENTORY ===== */
.inv-list {
	font-size: 12px;
}

.inv-item {
	display: flex;
	justify-content: space-between;
	padding: 2px 0;
	border-bottom: 1px solid #1a1a2a;
}

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

.inv-weight {
	color: #8888aa;
}

.inv-empty {
	color: #555570;
	font-style: italic;
}

/* ===== COMPANION ===== */
.companion-card {
	background: #15151f;
	border: 1px solid #2a2a3e;
	border-radius: 5px;
	padding: 10px 12px;
	margin-bottom: 10px;
}

.companion-name {
	font-size: 14px;
	color: #d4a050;
	margin-bottom: 2px;
}

.companion-desc {
	font-size: 12px;
	color: #9090b0;
	margin-bottom: 6px;
}

.companion-effect {
	font-size: 11px;
	color: #6090d0;
	margin-bottom: 6px;
}

.companion-hired {
	color: #50c878;
	font-size: 12px;
}

/* ===== SHOP ===== */
.shop-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid #1a1a2a;
}

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

.shop-item-info {
	flex: 1;
}

.shop-item-name {
	font-size: 13px;
	color: #d4b896;
}

.shop-item-desc {
	font-size: 11px;
	color: #7070a0;
}

.shop-item-cost {
	color: #d4a050;
	font-size: 12px;
	margin-right: 10px;
}

/* ===== MINIGAME ===== */
#mine-grid {
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	gap: 3px;
	margin-bottom: 12px;
	user-select: none;
}

.wall-cell {
	aspect-ratio: 1;
	border-radius: 3px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 14px;
	border: 1px solid #2a2a3e;
	transition: background 0.1s;
	-webkit-tap-highlight-color: transparent;
	position: relative;
	min-height: 38px;
}

.wall-cell.hp3 {
	background: #2a1a0a;
	border-color: #5a3a1a;
}

.wall-cell.hp2 {
	background: #1e1e10;
	border-color: #4a4a20;
}

.wall-cell.hp1 {
	background: #141420;
	border-color: #3a3a50;
}

.wall-cell.cleared {
	background: #06060c;
	border-color: #1a1a2a;
	cursor: default;
}

.wall-cell:not(.cleared):hover {
	filter: brightness(1.3);
}

.cell-hp {
	position: absolute;
	bottom: 2px;
	right: 4px;
	font-size: 10px;
	color: #888;
}

.cell-item-icon {
	font-size: 16px;
}

.hits-bar {
	margin-bottom: 10px;
}

.hits-bar-label {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	margin-bottom: 3px;
}

/* ===== ENDING ===== */
.ending-wrap {
	text-align: center;
	padding: 16px 0;
}

.ending-title {
	font-size: 22px;
	color: #d4a050;
	margin-bottom: 12px;
	letter-spacing: 0.1em;
}

.ending-type-good .ending-title {
	color: #50c878;
}

.ending-type-angel .ending-title {
	color: #a070e0;
}

.ending-type-bad .ending-title {
	color: #e05050;
}

.ending-flavor {
	font-size: 13px;
	color: #9090b0;
	line-height: 2;
	margin-bottom: 20px;
	text-align: left;
}

.ending-stats {
	font-size: 12px;
	color: #7070a0;
	margin-bottom: 20px;
	text-align: left;
}

/* ===== SETTLEMENT ===== */
.settlement-panel {
	border-color: #50c878;
}

.settlement-row {
	display: flex;
	justify-content: space-between;
	padding: 3px 0;
	font-size: 13px;
}

.settlement-label {
	color: #9090b0;
}

.settlement-val {
	color: #d4b896;
}

.settlement-total {
	color: #50c878;
	font-weight: bold;
}

.settlement-deduct {
	color: #e05050;
}

/* ===== DIVIDER ===== */
.divider {
	border: none;
	border-top: 1px solid #2a2a3e;
	margin: 10px 0;
}

/* ===== MISC ===== */
.text-danger {
	color: #e05050;
}

.text-warn {
	color: #e0a050;
}

.text-good {
	color: #50c878;
}

.text-info {
	color: #6090d0;
}

.text-muted {
	color: #606080;
}

.text-angel {
	color: #a070e0;
}

.mt8 {
	margin-top: 8px;
}

.mt12 {
	margin-top: 12px;
}

.small {
	font-size: 11px;
}

/* ===== TUNNEL SELECT ===== */
.tunnel-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 8px;
}

.tunnel-card {
	background: #1a1a2e;
	border: 1px solid #2a2a3e;
	border-radius: 6px;
	padding: 12px 16px;
	transition: border-color 0.15s, background 0.15s;
}

.tunnel-card.affordable:hover {
	border-color: #d4a050;
	background: #20203a;
	cursor: pointer;
}

.tunnel-card.unaffordable {
	opacity: 0.45;
}

.tunnel-name {
	font-weight: bold;
	color: #d4b896;
	margin-bottom: 4px;
	font-size: 15px;
}

.tunnel-desc {
	font-size: 12px;
	color: #9090a8;
	margin-bottom: 8px;
	line-height: 1.5;
}

.tunnel-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 11px;
	margin-bottom: 10px;
}

.tunnel-stat {
	background: #0d0d18;
	border: 1px solid #2a2a3e;
	padding: 2px 8px;
	border-radius: 3px;
}

.tunnel-tag {
	font-weight: bold;
}

.tunnel-fee {
	color: #e0a050;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
	width: 4px;
	height: 4px;
}

::-webkit-scrollbar-track {
	background: #0a0a0f;
}

::-webkit-scrollbar-thumb {
	background: #2a2a3e;
	border-radius: 2px;
}

/* ===== MODAL OVERLAY ===== */
#modal-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 200;
	background: rgba(0, 0, 0, 0.75);
	align-items: center;
	justify-content: center;
}

#modal-overlay.active {
	display: flex;
}

.modal-box {
	background: #12121e;
	border: 2px solid #d4a050;
	border-radius: 8px;
	padding: 20px 24px;
	max-width: 380px;
	width: 90%;
}

.modal-msg {
	margin-bottom: 16px;
	line-height: 1.7;
}

.modal-btn-row {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
}