* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  background: #C39A34;
  overflow: hidden;
  font-family: 'Press Start 2P', 'Tilita', monospace;
}

@font-face {
  font-family: 'Tilita';
  src: url('assets/font/tilita.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* Pixel font from Google Fonts */
@font-face {
  font-family: 'PixelFont';
  src: local('Press Start 2P');
}

/* PC端：保持移动端比例居中 */
#app {
  width: 100%;
  height: 100%;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #C39A34;
  position: relative;
  overflow: hidden;
}

/* ===== 标题栏 ===== */
.header {
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #CAA538;
  border-bottom: 2px solid #997823;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  border-radius: 4px;
}

.header-title {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: #ffffff;
  text-shadow: 1px 1px 0 #997823;
  letter-spacing: 1px;
}

.header-wallet {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #8D6E23;
  border: 1px solid #997823;
  border-radius: 9999px;
  padding: 4px 12px;
  cursor: pointer;
}

.wallet-dot {
  width: 6px;
  height: 6px;
  background: #a3e635;
  border-radius: 50%;
  display: inline-block;
}

.wallet-text {
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans TC', sans-serif;
  font-size: 12px;
  color: #ffffff;
}

/* ===== 游戏画布区域 ===== */
.canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #C39A34;
  display: flex;
  justify-content: center;
}

#gameCanvas {
  display: block;
  width: calc(100% - 40px);
  height: 100%;
  touch-action: none;
  background: #C39A34;
}

/* ===== 底部导航栏 ===== */
.tabbar {
  height: 36px;
  min-height: 36px;
  display: flex;
  background: #8D6E23;
  border-top: 1px solid #000000;
  z-index: 10;
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans TC', sans-serif;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
  padding: 4px 0;
}

.tabbar-item.active {
  color: #000000;
  background: #CAA538;
  border: 1px solid #000000;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

.tabbar-item:not(.active) {
  color: #CAA538;
}

.tabbar-item .tab-icon {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
}

/* ===== 倉庫面板 ===== */

.tabbar-item .tab-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* 横屏提示（可选） */
@media (orientation: landscape) and (max-height: 500px) {
  #app {
    max-width: 100%;
  }
}

/* --- 倉庫 (Profile) 面板 --- */

.profile-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  background: #C39A34;
  -webkit-overflow-scrolling: touch;
  font-family: 'Press Start 2P', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 10px;
  color: #ffffff;
  line-height: 1.8;
}

.profile-panel.hidden,
.canvas-wrap.hidden {
  display: none;
}

/* 頂部餘額大卡片 */
.pf-balance-card {
  background: linear-gradient(135deg, #CAA538 0%, #BA922E 50%, #A68227 100%);
  border: 3px solid #000000;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.pf-balance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pf-token-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: #ffffff;
}

.pf-balance-amount {
  font-family: 'Press Start 2P', monospace;
  font-size: 24px;
  color: #ffffff;
  margin-bottom: 8px;
}

.pf-addr {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #ffffff;
  word-break: break-all;
  line-height: 1.6;
  margin-bottom: 12px;
}

/* 充值提现按钮 */
.pf-btn-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.pf-action-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.pf-action-btn:active {
  transform: scale(0.96);
}

.pf-action-btn.deposit {
  background: #967624;
  color: #ffffff;
}

.pf-action-btn.withdraw {
  background: #C39A34;
  color: #FFF246;
  border: 2px solid #967623;
}

.pf-refresh {
  cursor: pointer;
  font-size: 18px;
  transition: transform 0.3s;
  display: inline-block;
  color: #ffffff;
}

.pf-refresh:active {
  transform: rotate(180deg);
}

/* 標籤頁切換 */
.pf-tabs {
  display: flex;
  background: #C39A34;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 2px solid #967623;
}

.pf-tab {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #967624;
  cursor: pointer;
  transition: all 0.2s;
  border-right: 2px solid #967623;
}

.pf-tab:last-child {
  border-right: none;
}

.pf-tab.active {
  background: #A68227;
  color: #FFF246;
}

/* 標籤頁內容 */
.pf-tab-content {
  background: #C39A34;
  border: 2px solid #967623;
  border-radius: 8px;
  overflow: hidden;
}

.pf-tab-pane {
  display: none;
  padding: 12px;
}

.pf-tab-pane.active {
  display: block;
}

/* 日誌卡片列表 */
.pf-log-card {
  background: #A68227;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.pf-log-card:last-child {
  margin-bottom: 0;
}

.pf-log-action {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #ffffff;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pf-log-icon {
  width: 24px;
  height: 24px;
  margin-right: 8px;
  vertical-align: middle;
  image-rendering: pixelated;
  background-size: auto 100%;
  background-repeat: no-repeat;
}

.pf-log-icon.frame-first {
  background-position: 0 0;
}

.pf-log-icon.frame-last {
  background-position: right 0;
}

.pf-log-label {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
}

.pf-log-label.plant {
  background: rgba(83, 83, 40, 0.3);
  color: #ffffff;
}

.pf-log-label.harvest {
  background: rgba(42, 42, 42, 0.3);
  color: #ffffff;
}

.pf-log-item-name {
  color: #ffffff;
  flex: 1;
  font-size: 10px;
}

.pf-log-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pf-log-amount {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #ffffff;
}

.pf-log-time {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #ffffff;
}

.pf-empty {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #ffffff;
  text-align: center;
  padding: 20px 0;
}

/* 提現狀態 */
.pf-claim-status {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 2px 6px;
  border-radius: 4px;
}

.pf-claim-status.confirmed {
  color: #7fff00;
  background: rgba(127, 255, 0, 0.2);
}

.pf-claim-status.pending {
  color: #f0d040;
  background: rgba(240, 208, 64, 0.3);
}

/* 關於項目區塊 */
.pf-about-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #A68227;
  color: #ffffff;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  padding: 14px;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  text-decoration: none;
}

.pf-btn:active {
  background: #967624;
}

.pf-btn.danger {
  color: #ff6b6b;
}

.pf-btn.active {
  background: #967624;
  color: #ffffff;
}

.pf-btn-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* 動畫 */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --- 錢包連接提示模態框 --- */

.wallet-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.wallet-prompt-modal {
  background: #C39A34;
  border: 3px solid #967623;
  border-radius: 12px;
  padding: 24px;
  max-width: 320px;
  width: 90%;
  text-align: center;
  animation: scaleIn 0.2s ease;
}

.wallet-prompt-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.wallet-prompt-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: #ffffff;
  margin-bottom: 12px;
}

.wallet-prompt-desc {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #ffffff;
  line-height: 1.8;
  margin-bottom: 20px;
}

.deposit-addr {
  background: #A68227;
  padding: 10px;
  border-radius: 6px;
  margin-top: 10px;
  word-break: break-all;
  font-size: 9px;
  color: #ffffff;
  border: 2px solid #967623;
}

.deposit-input {
  width: 100%;
  padding: 12px;
  background: #A68227;
  border: 2px solid #967623;
  border-radius: 8px;
  color: #ffffff;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
  outline: none;
}

.deposit-input:focus {
  border-color: #f0edd0;
}

.deposit-input::placeholder {
  color: #ffffff;
  font-size: 8px;
}

.deposit-presets {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.deposit-preset-btn {
  flex: 1;
  padding: 8px 4px;
  background: #C39A34;
  border: 2px solid #967623;
  border-radius: 6px;
  color: #ffffff;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.deposit-preset-btn:active {
  background: #967624;
  transform: scale(0.95);
}

.deposit-divider {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #ffffff;
  text-align: center;
  margin: 15px 0 10px;
  position: relative;
}

.deposit-divider::before,
.deposit-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: #967623;
}

.deposit-divider::before {
  left: 0;
}

.deposit-divider::after {
  right: 0;
}

.wallet-prompt-btn.small {
  padding: 8px;
  font-size: 9px;
  margin-top: 8px;
}

.wallet-prompt-btn {
  display: block;
  width: 100%;
  background: #967624;
  color: #ffffff;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  padding: 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.2s;
}

.wallet-prompt-btn:active {
  background: #6B5019;
}

.wallet-prompt-btn.secondary {
  background: #C39A34;
  color: #967624;
}

.wallet-prompt-btn.secondary:active {
  background: #967624;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Toast 提示 */
.toast-notification {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #C39A34;
  border: 3px solid #967623;
  border-radius: 8px;
  padding: 12px 20px;
  color: #ffffff;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- 滾動條樣式（Firefox + Chrome/Edge/Safari） --- */
.profile-panel {
  scrollbar-width: thin;
  scrollbar-color: #967623 #C39A34;
}

.profile-panel::-webkit-scrollbar {
  width: 8px;
}

.profile-panel::-webkit-scrollbar-track {
  background: #C39A34;
  border-radius: 4px;
}

.profile-panel::-webkit-scrollbar-thumb {
  background: #967624;
  border-radius: 4px;
}

.profile-panel::-webkit-scrollbar-thumb:hover {
  background: #6B5019;
}
