* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  line-height: 1.5;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 24px;
  padding: 22px 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.header {
  text-align: center;
  margin-bottom: 18px;
}

.header h1 {
  margin: 0 0 6px 0;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 800;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header p {
  margin: 0;
  font-size: 14px;
  color: #94a3b8;
}

.connect {
  margin-bottom: 14px;
  display: flex;
  justify-content: center;
}

/* TON Connect UI button override */
.connect button, .connect > div > button {
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 14px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  padding: 12px !important;
  height: auto !important;
}

.settings-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-btn:active {
  background: rgba(245, 158, 11, 0.22);
  transform: scale(0.98);
}

.wallet-info {
  margin-top: 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 16px;
  padding: 16px;
}

.wallet-info .label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.wallet-info .address {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 13px;
  word-break: break-all;
  color: #f8fafc;
  line-height: 1.4;
}

.wallet-info .ip {
  font-size: 12px;
  color: #64748b;
  margin-top: 8px;
}

.token-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.token-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 10px 12px;
  background: rgba(51, 65, 85, 0.4);
  border-radius: 10px;
}

.token-row span:first-child {
  color: #cbd5e1;
}

.token-row span:last-child {
  color: #f8fafc;
  font-weight: 600;
  font-family: 'SF Mono', monospace;
  font-size: 13px;
}

.nft-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nft-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 8px 12px;
  background: rgba(71, 85, 105, 0.4);
  border-radius: 10px;
}

.nft-row span:first-child {
  color: #cbd5e1;
}

.nft-row span:last-child {
  color: #94a3b8;
  font-size: 12px;
}

.actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.action-btn {
  padding: 14px 6px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.action-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.logs {
  margin-top: 18px;
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 16px;
  padding: 14px;
}

.logs-title {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.logs-content {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 11px;
  color: #94a3b8;
  max-height: 170px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.log-line {
  line-height: 1.4;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  opacity: 0;
  animation: fadeIn 0.2s ease forwards;
}

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

.modal-content {
  width: 100%;
  max-width: 400px;
  max-height: 88vh;
  overflow-y: auto;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  animation: scaleIn 0.2s ease forwards;
}

@keyframes scaleIn {
  to { transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: #f8fafc;
}

.close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.close-btn:active {
  background: rgba(148, 163, 184, 0.15);
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section h3 {
  font-size: 12px;
  color: #fbbf24;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.toggle:active {
  background: rgba(15, 23, 42, 0.8);
}

.toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #10b981;
  cursor: pointer;
}

.input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(2, 6, 23, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  color: #f8fafc;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: #fbbf24;
}

.preset-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.preset-btn {
  flex: 1;
  min-width: 70px;
  padding: 8px 10px;
  background: rgba(2, 6, 23, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  color: #38bdf8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.preset-btn:hover,
.preset-btn:active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

.fake-amount-preview {
  margin: 10px 0 0 0;
  font-size: 12px;
  color: #34d399;
  line-height: 1.4;
}

.status {
  text-align: center;
  font-size: 13px;
  color: #fbbf24;
  margin-top: 14px;
  font-weight: 600;
}

/* Mobile adaptations */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  .card {
    padding: 18px 14px;
    border-radius: 20px;
  }
  .actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .action-btn {
    padding: 14px;
    font-size: 15px;
  }
  .modal-content {
    padding: 18px;
    max-height: 92vh;
  }
}

@media (max-width: 360px) {
  .header h1 {
    font-size: 20px;
  }
  .settings-btn {
    font-size: 14px;
  }
}
