@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/inter.woff2') format('woff2');
}

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --border-color: #2a2a2a;
  --accent: #ffffff;
  --error: #ff4444;
  --success: #22c55e;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand img {
  width: 36px;
  height: 36px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.probe-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s;
}

.flag-emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

/* Twemoji flag styling */
.twemoji {
  height: 1.2em;
  width: 1.2em;
  vertical-align: -0.2em;
  display: inline-block;
}

.flag-emoji .twemoji {
  height: 1.1em;
  width: 1.1em;
  vertical-align: -0.1em;
}

.probe-badge:hover {
  border-color: var(--text-muted);
}

.probe-separator {
  color: var(--text-muted);
}

.probe-id {
  color: var(--text-secondary);
}

.probe-chevron {
  margin-left: 0.25rem;
  color: var(--text-secondary);
  transition: transform 0.2s;
}

.probe-selector.open .probe-chevron {
  transform: rotate(180deg);
}

/* Probe Region Selector */
.probe-selector {
  position: relative;
  display: flex;
  align-items: center;
}

.probe-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 280px;
  max-height: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 100;
  overflow: hidden;
  /* Optimize hidden dropdown - skip rendering until needed */
  content-visibility: hidden;
}

.probe-menu-inner {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.probe-selector.open .probe-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  content-visibility: visible;
}

.probe-menu-group {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.probe-menu-group:not(:first-child) {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.probe-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s;
}

.probe-menu-item:hover {
  background: var(--bg-tertiary);
}

.probe-menu-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

/* Info Cards */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.info-value {
  font-size: 0.9375rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* IPv6 specific styling for long addresses */
.info-card-ipv6 .info-value {
  flex-wrap: wrap;
}

.ipv6-value {
  font-size: 0.75rem;
  word-break: break-all;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

.copy-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.copy-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.copy-btn svg {
  width: 16px;
  height: 16px;
}

/* Tool Section */
.tool-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.tool-header {
  margin-bottom: 1.25rem;
}

.tool-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.tool-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.tool-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Tool Selector Dropdown */
.tool-selector {
  position: relative;
  flex: 0 0 auto;
}

.tool-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 140px;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s;
}

.tool-toggle:hover {
  border-color: var(--text-muted);
}

.tool-toggle:focus {
  outline: none;
  border-color: var(--accent);
}

.tool-current {
  flex: 1;
  text-align: left;
}

.tool-chevron {
  color: var(--text-secondary);
  transition: transform 0.2s;
}

.tool-selector.open .tool-chevron {
  transform: rotate(180deg);
}

.tool-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 100;
  overflow: hidden;
  padding: 0.375rem 0;
}

.tool-selector.open .tool-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tool-menu-item {
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
}

.tool-menu-item:hover {
  background: var(--bg-tertiary);
}

.tool-input {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
}

.tool-input::placeholder {
  color: var(--text-muted);
}

.tool-input:focus {
  outline: none;
  border-color: var(--accent);
}

.tool-submit {
  padding: 0.75rem 1.5rem;
  background: var(--text-primary);
  border: none;
  border-radius: 0.5rem;
  color: var(--bg-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.tool-submit:hover {
  opacity: 0.9;
}

.tool-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Output */
.output-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  margin-bottom: 2rem;
  overflow: hidden;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.output-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.output-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.output-status.running {
  color: var(--success);
}

.output-content {
  padding: 1rem;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.output-content:empty::before {
  content: 'Output will appear here...';
  color: var(--text-muted);
}

/* Download Section */
.download-section {
  margin-bottom: 2rem;
  /* Optimize rendering for below-the-fold content */
  content-visibility: auto;
  contain-intrinsic-size: 0 100px;
}

.download-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.download-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.2s, background 0.2s;
}

.download-btn:hover {
  border-color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.download-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

/* Footer */
.footer {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  /* Optimize rendering for below-the-fold content */
  content-visibility: auto;
  contain-intrinsic-size: 0 80px;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer a:hover {
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 1.5rem 1rem;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tool-form {
    flex-direction: column;
  }

  .tool-select,
  .tool-input {
    width: 100%;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Selection */
::selection {
  background: rgba(255, 255, 255, 0.2);
}

/* Geometric Background Pattern */
.bg-pattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.bg-shape {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.shape-1 {
  width: 200px;
  height: 200px;
  top: 10%;
  right: 15%;
  transform: rotate(45deg);
}

.shape-2 {
  width: 300px;
  height: 300px;
  bottom: 20%;
  right: 25%;
  transform: rotate(12deg);
}

.shape-3 {
  width: 150px;
  height: 150px;
  bottom: 35%;
  left: 10%;
  transform: rotate(-12deg);
}

.bg-dot {
  position: absolute;
  background: white;
  border-radius: 50%;
}

.dot-1 {
  width: 4px;
  height: 4px;
  top: 5%;
  left: 10%;
  opacity: 0.15;
}

.dot-2 {
  width: 2px;
  height: 2px;
  top: 8%;
  left: 25%;
  opacity: 0.1;
}

.dot-3 {
  width: 4px;
  height: 4px;
  top: 3%;
  right: 40%;
  opacity: 0.12;
}

.dot-4 {
  width: 2px;
  height: 2px;
  top: 12%;
  right: 55%;
  opacity: 0.08;
}

.dot-5 {
  width: 4px;
  height: 4px;
  top: 6%;
  right: 20%;
  opacity: 0.15;
}

.dot-6 {
  width: 2px;
  height: 2px;
  bottom: 15%;
  left: 35%;
  opacity: 0.1;
}

.dot-7 {
  width: 4px;
  height: 4px;
  bottom: 10%;
  right: 30%;
  opacity: 0.12;
}

.dot-8 {
  width: 2px;
  height: 2px;
  top: 50%;
  left: 5%;
  opacity: 0.08;
}

.container {
  position: relative;
  z-index: 1;
}
