/* ============================================================
   style.css — ダークモード + グラスモーフィズム
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #0a0b1e;
  --bg-secondary: #111233;
  --bg-card: rgba(20, 22, 60, 0.6);
  --bg-card-hover: rgba(30, 33, 80, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #e8eaff;
  --text-secondary: #9ca3c7;
  --text-muted: #5c6190;
  --accent-color: #627EEA;
  --accent-gradient: linear-gradient(135deg, #627EEA, #3B4CCA);
  --success: #00d68f;
  --warning: #ffaa00;
  --error: #ff4757;
  --info: #4e9fff;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-glow: 0 0 40px rgba(98, 126, 234, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Animated Background --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(98, 126, 234, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(130, 71, 229, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(240, 185, 11, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* --- Layout --- */
.app-container {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  position: relative;
  z-index: 1;
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 24px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.settings-btn:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: rotate(45deg);
}

.settings-btn:active {
  transform: scale(0.95) rotate(45deg);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 15px rgba(98, 126, 234, 0.3);
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Connect Button --- */
.connect-btn {
  padding: 10px 20px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.connect-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--accent-color);
  box-shadow: 0 0 20px rgba(98, 126, 234, 0.2);
  transform: translateY(-1px);
}

.connect-btn.connected {
  border-color: var(--success);
  color: var(--success);
}

.connect-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* --- Account Display --- */
.account-display {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -16px;
  margin-bottom: 20px;
  opacity: 0;
  transition: var(--transition);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.account-display.active {
  opacity: 1;
}

/* --- Chain Tabs --- */
.chain-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.chain-tab {
  flex: 1;
  padding: 12px 8px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.chain-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.chain-tab:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
  transform: translateY(-2px);
}

.chain-tab.active {
  background: var(--bg-card);
  border-color: var(--accent-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-glow);
}

.chain-tab.active::before {
  transform: scaleX(1);
}

.chain-tab.loading {
  pointer-events: none;
  opacity: 0.7;
}

.chain-icon {
  display: block;
  font-size: 22px;
  margin-bottom: 4px;
}

.chain-name {
  display: block;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* --- Standard Selector --- */
.standard-selector {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.standard-btn {
  flex: 1;
  padding: 10px 6px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.standard-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.standard-btn.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(98, 126, 234, 0.3);
}

/* --- Form Card --- */
.form-section {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: var(--transition);
}

.form-section.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.form-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-glow);
  transition: var(--transition);
}

.form-card:hover {
  border-color: var(--border-glass-hover);
}

/* --- Input Groups --- */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', 'Inter', monospace;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(98, 126, 234, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

.input-with-button {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.input-with-button input {
  flex: 1;
}

.input-action-btn {
  padding: 10px 16px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-action-btn:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.input-action-btn:active {
  transform: scale(0.95);
}

/* --- Token Info Badge --- */
.token-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: var(--transition);
}

.token-info.active {
  opacity: 1;
  max-height: 50px;
}

.token-badge {
  background: var(--accent-gradient);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
}

.token-name {
  color: var(--text-secondary);
  font-size: 12px;
}

.token-balance {
  margin-left: auto;
  color: var(--success);
  font-weight: 600;
  font-size: 12px;
}

.token-error {
  color: var(--error);
  font-size: 12px;
}

/* --- NFT Preview --- */
#nftPreview {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.3s ease;
  opacity: 0;
  margin-bottom: 0;
}

#nftPreview.active {
  max-height: 500px;
  opacity: 1;
  margin-bottom: 16px;
}

.nft-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.nft-image-wrapper {
  width: 100%;
  aspect-ratio: 1;
  max-height: 280px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
}

.nft-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nft-info {
  padding: 14px 16px;
}

.nft-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.nft-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.nft-balance {
  font-size: 13px;
  color: var(--text-primary);
  padding: 8px 12px;
  background: rgba(0, 214, 143, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 214, 143, 0.2);
}

.balance-value {
  font-weight: 700;
  color: var(--success);
  font-size: 16px;
}

.nft-no-image {
  width: 100%;
  aspect-ratio: 1;
  max-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
  font-size: 14px;
}

.nft-loading {
  padding: 32px;
  text-align: center;
  color: var(--text-secondary);
}

.nft-error {
  padding: 16px;
  text-align: center;
  color: var(--error);
  font-size: 13px;
}

.error-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Gas Display --- */
#gasDisplay {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 0;
  margin-bottom: 0;
}

#gasDisplay.active {
  max-height: 200px;
  opacity: 1;
  margin-bottom: 16px;
}

.gas-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
}

.gas-total {
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border: 1px solid var(--border-glass);
}

.gas-total .gas-label {
  font-weight: 600;
  color: var(--text-primary);
}

.gas-total .gas-value {
  font-weight: 700;
  color: var(--warning);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.gas-detail .gas-label {
  color: var(--text-muted);
  font-size: 12px;
}

.gas-detail .gas-value {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* --- Buttons --- */
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(98, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(98, 126, 234, 0.4);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

/* --- Transaction Status --- */
.tx-status {
  display: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 16px;
  animation: slideIn 0.3s ease;
}

.tx-status.pending {
  background: rgba(78, 159, 255, 0.1);
  border: 1px solid rgba(78, 159, 255, 0.2);
  color: var(--info);
}

.tx-status.success {
  background: rgba(0, 214, 143, 0.1);
  border: 1px solid rgba(0, 214, 143, 0.2);
  color: var(--success);
}

.tx-status.error {
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.2);
  color: var(--error);
}

.tx-status a {
  color: inherit;
  text-decoration: underline;
}

/* --- History Section --- */
.history-section {
  margin-top: 24px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: var(--transition);
}

.history-section.active {
  opacity: 1;
  max-height: 1000px;
}

.history-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 12px;
  animation: slideIn 0.3s ease;
}

.history-status {
  font-size: 14px;
}

.history-desc {
  color: var(--text-secondary);
  flex: 1;
}

.history-hash {
  color: var(--accent-color);
  text-decoration: none;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
}

.history-hash:hover {
  text-decoration: underline;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 400px;
  width: 100%;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-body p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.modal-body p strong {
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

/* --- Mobile Wallet Modal --- */
.mobile-modal .modal {
  text-align: center;
}

.mobile-wallet-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.mobile-wallet-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
}

.mobile-wallet-link.metamask {
  background: linear-gradient(135deg, #E2761B, #CD6116);
  color: white;
}

.mobile-wallet-link.safepal {
  background: linear-gradient(135deg, #4A6CF7, #3757D9);
  color: white;
}

.mobile-wallet-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 350px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  background: rgba(0, 214, 143, 0.15);
  border: 1px solid rgba(0, 214, 143, 0.3);
  color: var(--success);
}

.toast-error {
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid rgba(255, 71, 87, 0.3);
  color: var(--error);
}

.toast-warning {
  background: rgba(255, 170, 0, 0.15);
  border: 1px solid rgba(255, 170, 0, 0.3);
  color: var(--warning);
}

.toast-info {
  background: rgba(78, 159, 255, 0.15);
  border: 1px solid rgba(78, 159, 255, 0.3);
  color: var(--info);
}

/* --- Spinner --- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Portfolio Section --- */
.portfolio-section {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s ease, opacity 0.3s ease, margin 0.3s ease;
  margin-bottom: 0;
}

.portfolio-section.active {
  max-height: 2000px;
  opacity: 1;
  margin-bottom: 20px;
}

.portfolio-loading {
  text-align: center;
  padding: 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.portfolio-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.portfolio-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0.6;
}

.portfolio-card:hover {
  border-color: var(--border-glass-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.portfolio-icon {
  display: block;
  font-size: 22px;
  margin-bottom: 6px;
}

.portfolio-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}

.portfolio-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.portfolio-error {
  text-align: center;
  color: var(--error);
  font-size: 13px;
  padding: 12px;
}

/* --- Token List (Portfolio) --- */
.token-list {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
}

.token-list-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.token-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.token-row:last-of-type {
  border-bottom: none;
}

.token-row-symbol {
  background: var(--accent-gradient);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10px;
  min-width: 48px;
  text-align: center;
}

.token-row-name {
  flex: 1;
  color: var(--text-secondary);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-row-balance {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.token-list-more {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* --- NFT Gallery (Portfolio) --- */
.nft-gallery {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 10px;
}

.nft-gallery-section {
  margin-bottom: 14px;
}

.nft-gallery-section:last-child {
  margin-bottom: 0;
}

.nft-gallery-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nft-gallery-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 10px;
}

.nft-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.nft-gallery-item {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition);
}

.nft-gallery-item:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(98, 126, 234, 0.2);
}

.nft-gallery-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.nft-gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.nft-gallery-item:hover .nft-gallery-img {
  transform: scale(1.05);
}

.nft-gallery-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
}

.nft-type-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: var(--accent-color);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.nft-qty-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 214, 143, 0.85);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 24px;
  text-align: center;
}

.nft-gallery-meta {
  padding: 6px 8px;
}

.nft-gallery-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.nft-gallery-id {
  display: block;
  font-size: 9px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  margin-top: 1px;
}

.nftscan-limit-note {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

/* --- Responsive --- */
@media (max-width: 540px) {
  .app-container {
    padding: 12px 12px 40px;
  }

  .header {
    padding: 12px 0;
    flex-wrap: wrap;
    gap: 8px;
  }

  .connect-btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  .chain-tabs {
    gap: 6px;
  }

  .chain-tab {
    padding: 10px 6px;
  }

  .chain-icon {
    font-size: 18px;
  }

  .form-card {
    padding: 18px;
  }

  .portfolio-grid {
    gap: 6px;
  }

  .portfolio-card {
    padding: 12px 8px;
  }

  .portfolio-value {
    font-size: 16px;
  }

  .toast-container {
    top: auto;
    bottom: 16px;
    right: 8px;
    left: 8px;
  }

  .toast {
    max-width: 100%;
  }
}
