:root {
  --bg: #000000;
  --card-bg: #0d0d0d;
  --card-bg-hover: #141414;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.25);
  
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.55);
  --text-sub: rgba(255, 255, 255, 0.35);

  --font-main: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  background: var(--bg);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Base Layout */
.app-layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
}

.brand-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: default;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #ffffff;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  background: #181818;
  color: #ffffff;
  border: 1px solid var(--border);
  letter-spacing: 0.05em;
}

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

/* Address Pill */
.address-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.address-pill:hover {
  background: var(--card-bg-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.address-pill:active {
  transform: scale(0.96);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.addr-text {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.copy-svg {
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.address-pill:hover .copy-svg {
  opacity: 1;
}

/* Circular Icon Buttons */
.btn-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
}

.btn-circle:hover {
  background: #1a1a1a;
  border-color: var(--border-focus);
  transform: scale(1.08);
}

.btn-circle:active {
  transform: scale(0.92);
}

.btn-circle.btn-sm {
  width: 30px;
  height: 30px;
}

/* Monolithic Card */
.monolith-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 28px 24px;
  margin-bottom: 24px;
  transition: border-color 0.25s ease;
}

.monolith-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card-headline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}

.headline-left h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.headline-left .sub-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-sub);
  letter-spacing: 0.02em;
}

/* Input Form */
.target-input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.target-input-row input {
  flex: 1;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  user-select: text;
  -webkit-user-select: text;
}

.target-input-row input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px #ffffff;
}

.target-input-row input::placeholder {
  color: rgba(255, 255, 255, 0.25);
  font-family: var(--font-mono);
}

/* Action Buttons */
.btn-primary-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: 12px;
  padding: 0 24px;
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.btn-primary-white:hover {
  background: #e6e6e6;
  transform: scale(1.02);
}

.btn-primary-white:active {
  transform: scale(0.96);
}

.btn-primary-white:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-outline-dark {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 18px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  width: 100%;
  transition: all 0.2s ease;
}

.btn-outline-dark:hover {
  background: #181818;
  color: #ffffff;
  border-color: var(--border-focus);
}

/* Metrics Summary Bar */
.metrics-bar {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  gap: 16px;
}

.metric-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cell-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-sub);
}

.cell-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
}

.font-mono {
  font-family: var(--font-mono);
}

.metric-cell .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #666;
  margin-right: 4px;
}

.metric-cell .dot.live {
  background: #ffffff;
  box-shadow: 0 0 6px #ffffff;
}

.metric-cell .dot.dead {
  background: #ff4444;
  box-shadow: 0 0 6px rgba(255, 68, 68, 0.6);
}

.metric-action {
  display: flex;
  align-items: center;
}

/* Bottom Split */
.bottom-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 720px) {
  .bottom-split {
    grid-template-columns: 1fr;
  }
  .target-input-row {
    flex-direction: column;
  }
  .btn-primary-white {
    padding: 14px;
  }
  .metrics-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

.sub-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
}

.sub-card-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-item:hover {
  background: #141414;
  border-color: var(--border-focus);
  transform: translateX(2px);
}

.hist-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.hist-raw {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-ip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-sub);
}

.btn-trash {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}

.history-item:hover .btn-trash {
  color: rgba(255, 255, 255, 0.65);
}

.btn-trash:hover {
  color: #ff5555 !important;
  background: rgba(255, 68, 68, 0.12);
  border-color: rgba(255, 68, 68, 0.35);
  transform: scale(1.15);
}

.btn-trash:active {
  transform: scale(0.92);
}

.empty-state {
  color: var(--text-sub);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px 0;
}

/* Connection Steps */
.steps-compact {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-sub);
  background: #000000;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}

.step-text {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.step-text strong {
  color: #ffffff;
}

.code-pill {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: #000000;
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
  color: #ffffff;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-card {
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  width: 100%;
  max-width: 380px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
  animation: modalPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header-simple {
  text-align: center;
  margin-bottom: 24px;
}

.brand-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.modal-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: -14px;
  margin-bottom: 20px;
}

.field-wrap {
  margin-bottom: 12px;
}

.field-wrap input {
  width: 100%;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--font-main);
  font-size: 0.92rem;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s ease;
  user-select: text;
  -webkit-user-select: text;
}

.field-wrap input:focus {
  border-color: #ffffff;
}

.modal-card .btn-primary-white {
  width: 100%;
  padding: 13px;
  margin-top: 6px;
}

.alert-box.error {
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: #ff6666;
  font-size: 0.8rem;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0d0d0d;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  z-index: 2000;
  animation: toastIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
