:root {
  --bg-primary: #f8fafc; /* Slate-50 */
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --border-color: #e2e8f0; /* Slate-200 */
  --text-primary: #1e293b; /* Slate-800 */
  --text-secondary: #64748b; /* Slate-500 */
  --accent-ton: #0088cc; /* TON Blue */
  --accent-green: #15803d;
  --accent-red: #b91c1c;
  --font-family-ui: 'Outfit', sans-serif;
  --font-family-mono: 'Roboto Mono', monospace;
}

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

body {
  font-family: var(--font-family-ui);
  background-color: #f1f5f9;
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

.tracker-app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Header */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.logo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-row h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.network-badge {
  font-size: 10px;
  background: rgba(0, 136, 204, 0.1);
  color: var(--accent-ton);
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.search-container {
  display: flex;
  gap: 8px;
}

.search-container input {
  flex-grow: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-family-ui);
  outline: none;
  font-size: 14px;
}

.search-container input:focus {
  border-color: var(--accent-ton);
}

.search-container button {
  background: var(--accent-ton);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-family: var(--font-family-ui);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* Viewport and screens */
.app-viewport {
  flex-grow: 1;
  position: relative;
  overflow: hidden;
}

.tracker-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.tracker-view.active {
  opacity: 1;
  pointer-events: auto;
}

/* Watchlist layout */
.watchlist-section {
  padding: 16px;
  flex-shrink: 0;
}

.watchlist-section h3, .live-feed-header h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.watchlist-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watch-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.watch-card:active {
  transform: scale(0.98);
}

.watch-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.watch-info strong {
  font-size: 14px;
}

.watch-info span {
  font-family: var(--font-family-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.watch-balance {
  font-family: var(--font-family-mono);
  font-weight: 700;
  color: var(--accent-ton);
}

.delete-watch-btn {
  background: none;
  border: none;
  color: var(--accent-red);
  font-size: 16px;
  cursor: pointer;
  padding-left: 10px;
}

.add-wallet-row {
  margin-top: 10px;
  display: flex;
}

.action-btn-small {
  background: rgba(0, 136, 204, 0.08);
  border: 1px solid rgba(0, 136, 204, 0.2);
  color: var(--accent-ton);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-family-ui);
  font-size: 12px;
  cursor: pointer;
}

/* Live transaction stream */
.live-feed-section {
  padding: 0 16px 20px 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.live-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live-status {
  font-size: 9px;
  background: rgba(21, 128, 61, 0.1);
  color: var(--accent-green);
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 700;
}

.live-stream-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.live-tx-row {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  animation: slide-in-row 0.3s ease-out;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.live-tx-hash {
  font-family: var(--font-family-mono);
  color: var(--text-secondary);
}

.live-tx-val {
  font-family: var(--font-family-mono);
  font-weight: 700;
  color: var(--accent-green);
}

.live-tx-val.negative-val {
  color: var(--accent-red);
}

/* Details Screen */
.details-header-actions {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
}

.hud-back-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.details-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.details-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.detail-row-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
}

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

.detail-lbl {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
}

.detail-val-mono {
  font-family: var(--font-family-mono);
  font-size: 13px;
  word-break: break-all;
}

.success-badge {
  color: var(--accent-green);
  font-weight: 700;
}

/* Visual Fund Flow Chart graph */
.flow-graph-section {
  padding: 0 16px 20px 16px;
  display: flex;
  flex-direction: column;
}

.flow-graph-section h4 {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.flow-chart-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.flow-node {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  width: 90px;
  text-align: center;
}

.node-title {
  font-size: 9px;
  color: var(--text-secondary);
}

.node-val {
  font-family: var(--font-family-mono);
  font-size: 11px;
  font-weight: 700;
}

.flow-arrow {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.flow-arrow-line {
  width: 80%;
  height: 2px;
  background: var(--accent-ton);
  position: relative;
}

.flow-arrow-line::after {
  content: '';
  position: absolute;
  right: 0;
  top: -4px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--accent-ton);
}

.flow-arrow-val {
  font-family: var(--font-family-mono);
  font-size: 10px;
  color: var(--accent-ton);
  margin-top: 4px;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  width: 100%;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.1, 0.76, 0.55, 0.94);
  box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
}

.modal.active .modal-content {
  transform: translateY(0);
}

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

.close-btn {
  background: var(--bg-primary);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.input-group label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 700;
}

.input-group input {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  font-family: var(--font-family-ui);
  font-size: 14px;
  outline: none;
}

.action-btn {
  width: 100%;
  background: var(--accent-ton);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

/* Animations */
@keyframes slide-in-row {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
