:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #334155;
  --radius: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "Noto Sans", sans-serif;
  background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 60%, #0f172a 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 20px 14px 40px;
  line-height: 1.6;
}

.container {
  max-width: 780px;
  margin: 0 auto;
}

/* Header */
.header-area {
  text-align: center;
  margin-bottom: 28px;
  position: relative;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(90deg, #38bdf8, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.92rem;
}

.lang-switch {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 6px;
}

.lang-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.lang-btn.active,
.lang-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.card h2 {
  font-size: 1.08rem;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2 .icon {
  font-size: 1.2rem;
}

/* Rows */
.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

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

.label {
  color: var(--muted);
  font-size: 0.88rem;
  flex-shrink: 0;
  min-width: 120px;
}

.value {
  font-weight: 500;
  text-align: right;
  word-break: break-all;
  flex: 1;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-info {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

/* Loading */
.loading {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 16px;
}

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

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, #0ea5e9, #6366f1);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  width: 100%;
  margin-top: 6px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Notes */
.note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

.note strong {
  color: var(--text);
}

/* Signals */
.signals {
  margin-top: 12px;
  font-size: 0.84rem;
}

.signal-item {
  padding: 5px 0;
  color: var(--muted);
  border-bottom: 1px dashed var(--border);
}

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

/* WebRTC */
.webrtc-list {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
}

.webrtc-item {
  margin: 3px 0;
}

/* Map */
#map {
  height: 280px;
  width: 100%;
  border-radius: 12px;
  margin-top: 8px;
  border: 1px solid var(--border);
  z-index: 1;
}

.map-placeholder {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
}

/* Prediction section */
.prediction-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
}

.prediction-box h3 {
  font-size: 0.95rem;
  color: var(--danger);
  margin-bottom: 8px;
}

.prediction-ip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--warning);
  margin: 4px 0;
}

/* Footer */
.footer-area {
  text-align: center;
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.78rem;
}

.footer-area a {
  color: var(--accent);
  text-decoration: none;
}

/* Responsive */
@media (max-width: 520px) {
  h1 {
    font-size: 1.4rem;
  }

  .lang-switch {
    position: static;
    justify-content: center;
    margin-bottom: 12px;
  }

  .row {
    flex-direction: column;
    gap: 3px;
  }

  .value {
    text-align: left;
  }

  .label {
    min-width: auto;
  }

  #map {
    height: 220px;
  }
}
