@charset"UTF-8";
/* --- 手機版介面 --- */
:root { --primary: #6366f1; --success: #10b981; --danger: #ef4444; --warning: #f59e0b; }

body { 
	font-family: "Noto Sans TC", sans-serif; background: #f0f2f5; margin: 0; padding: 10px; 
	overflow: auto; height: 100vh; display: flex; flex-direction: column; 
}

.container { 
	width: 100%; max-width: 500px; margin: 0 auto; background: #fff; padding: 15px; 
	border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); box-sizing: border-box; 
	min-height: 100%; flex: none; overflow: visible;
}

/* --- 遊戲畫面區 (game-canvas) --- */
#game-canvas {
	height: 180px; /* 取自下方縮減後的高度 */
	background: linear-gradient(to bottom, #bae6fd 0%, #e0f2fe 100%); 
	border-radius: 20px; position: relative; overflow: hidden; margin-bottom: 5px; 
	border: 4px solid #f1f5f9; flex-shrink: 0;
}

#game-canvas .customer { will-change: left; }

.road { 
	position: absolute; bottom: 0; width: 100%; height: 40px; 
	background: #94a3b8; border-top: 3px solid #64748b; z-index: 10; 
}

.customer { 
	position: absolute; font-size: 35px; bottom: 10px; left: 110%; 
	z-index: 20; transition: left linear; white-space: nowrap; 
}

.shop-building { position: absolute; bottom: 0px; left: 50%; transform: translateX(-50%); z-index: 100; }

.sub-stores-container {
    position: absolute;
    width: 100%;
    height: 60px;
    bottom: 25px;
    left: 0;
    z-index: 15; /* 同樣介於路與人之間 */
	pointer-events: none;
}

.branch-icon {
    position: absolute;
    font-size: 45px;
	filter: saturate(0.6) brightness(0.9); /* 降低飽和度，顏色較不明顯 */
    transition: all 0.5s ease;
}

.main-store-icon { font-size: 95px; line-height: 1; }

.sub-type-icon { 
	position: absolute; right: -10px; font-size: 22px; background: white; 
	border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; 
	justify-content: center; box-shadow: 0 4px 8px rgba(0,0,0,0.2); border: 3px solid var(--primary); 
}

/* --- 數據統計與按鈕 --- */
.header-stats { display: grid; grid-template-columns: 0.8fr 1.2fr 1fr; gap: 5px; margin-bottom: 5px; }
.stat-card { background: #f8fafc; padding: 3px 5px 0px 5px; border-radius: 12px; text-align: center; border: 1px solid #e2e8f0; display: flex; flex-direction: column; justify-content: center; }
.stat-val { font-size: 16px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 11px; color: #64748b; margin-bottom: 2px; }
.stat-hint { font-size: 8px; color: #64748b; margin-top: 5px; display: block; line-height: 1.4; }
.btn-reset { font-size: 10px; padding: 3px; cursor: pointer; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff; color: #64748b; transition: all 0.2s ease; font-weight: 500; margin:5px;}  
.btn-reset:hover { background: #f1f5f9; border-color: #cbd5e1; color: var(--danger); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }  
.btn-reset:active { transform: scale(0.95); } 
#ui-money,#ui-shop-name { font-size:16px;}
.setup-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 4px; margin-bottom: 5px; flex: 0 0 auto; }
.card { border: 1px solid #e5e7eb; padding: 5px; border-radius: 12px; background: #fafbfc; }
.card h3 { font-size: 12px; margin: 0 0 5px 0; }
.card div { font-size: 12px !important; line-height: 1.2 !important; }

#active-buffs-list, #history-buffs-inline, #event-impact-list, #history-events-inline { font-size: 10px !important; }

.Buff-detail {font-size: 12px; padding: 0px 6px; cursor: pointer; border-radius: 6px; border: 1px solid var(--primary); background: #f5f3ff; color: var(--primary);}
.settle-Buff-detail {font-size: 14px; margin-left:10px; padding: 0px 8px; cursor: pointer; border-radius: 6px; border: 1px solid var(--primary); background: #f5f3ff; color: var(--primary);}

.btn-main { background: linear-gradient(135deg, #6366f1, #4338ca); color: white; width: 100%; padding: 12px; border-radius: 12px; font-size: 18px; font-weight: bold; border: none; cursor: pointer; margin-bottom: 5px; }
.btn-main:active {transform: scale(0.98); opacity: 0.9; }
.btn-main:disabled {background: #94a3b8 !important; cursor: not-allowed; transform: none; opacity: 0.7; }



.speed-controls { margin-top: 5px; display: flex; gap: 5px; justify-content: center; }
.btn-speed { background: #e2e8f0; border: none; padding: 2px 8px; border-radius: 6px; font-size: 12px; cursor: pointer; transition: 0.2s; font-weight: bold; }
.btn-speed:hover { background: #cbd5e1; }
.btn-speed.active { background: var(--primary); color: white; }

/* --- 彈窗與結算 (保留最底部的優化設定) --- */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.8); z-index: 1000; justify-content: center; align-items: center; }

/* 這裡合併了 .modal-content 與 #settle-modal .modal-content 的最終寬度 */
.modal-content { 
	background: white; padding: 10px 12px; border-radius: 20px; width: 75%; max-width: 320px; 
	max-height: 85vh; overflow-y: auto; 
}

.type-grid, .diff-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.btn-type, .btn-diff {font-size:14px;width: 100%; text-align: left; padding: 6px !important; border-radius: 12px !important; display: block !important; }

#settle-title { font-size: 20px !important; margin-bottom: 10px !important; }
#settle-report { 
	font-size: 14px !important; padding: 10px !important; margin-bottom: 5px !important; 
	background:#f8fafc; border-radius: 15px; line-height: 1.4 !important; border: 2px solid #e2e8f0; text-align:center;
}

#settle-report b, #settle-report span { font-size: 18px !important; }
#settle-modal h3 { font-size: 16px !important; margin-bottom: 10px !important; margin:5px;}
#settle-modal .btn-main { margin-top: 10px !important; padding: 10px !important; font-size: 15px !important; width: 100% !important; }

#settle-detail-stats div {display: flex; flex-direction: column; justify-content: center; align-items: center; font-size:14px;}
#settle-detail-stats span {font-size: 18px;}
#settle-detail-stats {margin:-5px 0px;}
.settle-detail-block {padding: 5px; border-radius: 12px;}

.settle-stats-container { display: grid; grid-template-columns: 1.4fr 1fr;  gap: 1px; margin-bottom: 5px; } 
.card-ops { border-radius: 12px; display: grid; grid-template-columns: 1fr 1fr 1fr; overflow: hidden; background: #eff6ff; border: 1px solid #dbeafe; }
.card-exp { border-radius: 12px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; background: #fff1f2; border: 1px solid #ffe4e6; }
.settle-grid-item { text-align: center; padding: 5px 5px; }
.card-ops .border-right { border-right: 1px solid #dbeafe; }
.card-exp .border-right { border-right: 1px solid #ffe4e6; }
.settle-stat-card small { color: #64748b; display: block; margin-bottom: 4px; font-size: 10px; } 
.settle-stat-card b { font-size: 12px; }
.card-ops b { color: var(--primary); }
.card-exp b { color: var(--danger); }



#buff-options { display: flex !important; flex-direction: column !important; gap: 10px; width: 100%; }
.btn-buff-card {display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: flex-start !important; width: 100% !important; margin: 0 auto !important; padding: 10px 15px !important; border: 2px solid #e5e7eb;border-radius: 15px; background: #fff; cursor: pointer; box-sizing: border-box; text-align: left !important; }

.buff-name-label { font-size: 15px !important; font-weight: 800; color: #1f2937; margin: 0 10px 0 0 !important; white-space: nowrap; }
.buff-desc-label { font-size: 12px !important; color: #64748b; flex: 1; margin: 0 !important;line-height: 1.2;}
.buff-cost-label { font-size: 12px !important; font-weight: 800; color: var(--danger); background: #fee2e2; padding: 4px 8px !important; border-radius: 6px; margin-left: 10px !important;white-space: nowrap; }

.btn-buff-card:hover { border-color: var(--primary); background: #f5f3ff; }
/* --- Log 與 其他區域 --- */
.log { 
	background: #0f172a; color: #cbd5e1; padding: 10px; border-radius: 10px; 
	height: 120px; overflow-y: auto !important; font-family: monospace; font-size: 12px; 
	border-left: 5px solid var(--primary); margin-top: 10px; flex: none; 
}
#game-log.fully-visible { height: auto; max-height: none; overflow-y: visible; }

.strategy-history-area { max-height: 60px; overflow-y: auto; }
.status-tag { display: inline-block; background: #fee2e2; color: #991b1b; padding: 3px 3px; border-radius: 8px; margin: 1px; font-size: 10px; border: 1px solid #fecaca; }
.expanded-card { max-height: 60px !important; height: auto !important; }
.hidden-area { display: none !important; }

/* --- 動畫特效 --- */
.coin-pop {
	position: absolute; top: -20px; left: 50%; transform: translateX(-50%); z-index: 150; 
	font-weight: 800; font-size: 20px; color: #f59e0b; display: flex; align-items: center; 
	white-space: nowrap; animation: popUp 1s ease-out forwards;
}
@keyframes popUp {
	0% { opacity: 0; transform: translate(-50%, 0); }
	30% { opacity: 1; }
	100% { opacity: 0; transform: translate(-50%, -100px); }
}

.insufficient-funds-toast {
	position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%);
	background: rgba(239, 68, 68, 0.95); color: white; padding: 20px 40px;
	border-radius: 20px; font-size: 32px; font-weight: 900; z-index: 2000;
	box-shadow: 0 10px 30px rgba(0,0,0,0.3); pointer-events: none; animation: fadeOutUp 1.5s ease-out forwards;
}
@keyframes fadeOutUp {
	0% { opacity: 0; transform: translate(-50%, -20%); }
	20% { opacity: 1; transform: translate(-50%, -50%); }
	70% { opacity: 1; }
	100% { opacity: 0; transform: translate(-50%, -80%); }
}

#chart-container {
    background: white;
    padding: 5px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

#chart-container canvas {
    min-height: 150px; /* 確保在手機上不會太扁 */
}
#businessChart {
    width: 100% !important;
    height: auto !important;
}