@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&display=swap');

:root {
  color-scheme: light;
  --base-100: #ffffff;
  --base-200: #f2f2f2;
  --base-300: #e5e6e6;
  --base-content: #1b1b1b;
  --neutral: #2a303c;
  --neutral-content: #a6adbb;
  --primary: oklch(15.906% 0 0);
  --primary-content: oklch(100% 0 0);
  --ok: #16a34a;
  --err: #dc2626;
  --warn: #d97706;
  --radius-box: 1rem;
  --radius-field: 0.5rem;
  --font-serif: 'IM Fell English', Georgia, serif;
  --text-fill-color: transparent;
}

[data-theme="dark"] {
  color-scheme: dark;
  --base-100: #1d232a;
  --base-200: #191e24;
  --base-300: #15191e;
  --base-content: #a6adbb;
  --neutral: #2a323c;
  --neutral-content: #a6adbb;
  --primary: oklch(58% 0.233 277.117);
  --primary-content: oklch(96% 0.018 272.314);
  --ok: #34d399;
  --err: #f87171;
  --warn: #fbbf24;
  --text-fill-color: rgb(152, 159, 171, 0.3);
}

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

html {
  scroll-behavior: smooth;
  font-family: "IM Fell English", serif;
}

body {  
  background: var(--base-200);
  color: var(--base-content);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;  
}
/* ---- Navbar ---- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--base-100);
  border-bottom: 1px solid var(--base-300);
}

.brand {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  border-radius: var(--radius-field);
  padding: 0.25rem 0.5rem;
  transition: background-color 0.2s ease;
}

.brand:hover {
  background: var(--base-200);
}

.swap input {
  display: none;
}

.navbar-end {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.flag {
  display: inline-flex;
  width: 1.75rem;
  height: 1.25rem;
  padding: 0;
  border: 1px solid var(--base-300);
  border-radius: 0.25rem;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  opacity: 0.45;
  transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.flag:hover {
  opacity: 0.8;
}

.flag.active {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--neutral);
}

.flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

.swap svg {
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  color: var(--base-content);
}

.swap .swap-on {
  display: none;
}

.swap input:checked ~ .swap-on {
  display: block;
}

.swap input:checked ~ .swap-off {
  display: none;
}

/* ---- Hero ---- */
.hero {
  flex: 1;
  background: var(--base-200);
  padding: 3rem 1.5rem 4rem;
}

.title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 1.5rem;
  word-break: break-word;
}

.ar-bg-img {
  background: url(/assets/img/grunge-wall-texture-freepick-kues1.webp);
  background-size: cover;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: var(--text-fill-color);
}

[data-theme="dark"] .title {
  backdrop-filter: blur(8px);
}

.subtitle {
  font-size: 1.5rem;
  line-height: 1.25;
  margin-bottom: 2rem;
  max-width: 42rem;
}

.subtitle a {
  text-decoration: none;
  background: linear-gradient(to left, var(--base-300) 50%, var(--neutral) 50%) right;
  background-size: 200%;
  transition: background-position 0.5s ease-out, color 0.5s ease-out;
}

.subtitle a:hover {
  background-position: left;
  color: var(--base-100);
}

@media (min-width: 1024px) {
  .title {
    font-size: 8rem;
  }
}

@media (max-width: 640px) {
  .title {
    font-size: 3.75rem;
  }
  .subtitle {
    font-size: 1.25rem;
  }
}

/* ---- Toolbar ---- */
.toolbar {
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: var(--base-100);
  border: 1px solid var(--base-300);
  border-radius: var(--radius-box);
  padding: 1rem;  
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
}

.input,
.select {
  height: 2.5rem;
  font-size: 0.875rem;
  background: var(--base-100);
  color: var(--base-content);
  border: 1px solid var(--neutral);
  border-radius: var(--radius-field);
  padding: 0 0.75rem;
  outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.input {
  flex: 1 1 220px;
  min-width: 0;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(1px + 50%), calc(100% - 14px) calc(1px + 50%);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 2.25rem;
  cursor: pointer;
}

.input::placeholder {
  color: var(--base-content);
  opacity: 0.5;
}

.input:focus,
.select:focus {
  box-shadow: 0 0 0 2px var(--neutral);
}

/* ---- Button ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--base-content);
  background: var(--base-200);
  border: 2px solid var(--neutral);
  border-radius: var(--radius-field);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--neutral);
  color: var(--neutral-content);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

/* ---- Results ---- */
#results {  
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--base-100);
  border: 1px solid var(--base-300);
  border-radius: var(--radius-box);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--base-300);
}

.card-head h2 {
  font-size: 0.875rem;
  font-weight: 600;
}

.time {
  color: var(--base-content);
  opacity: 0.6;
  font-size: 0.75rem;
}

.card-body {
  padding: 1rem;
}

.skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.skeleton-line {
  height: 1rem;
  border-radius: 0.375rem;
  background: linear-gradient(90deg, var(--base-200) 25%, var(--base-300) 50%, var(--base-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-line.short {
  width: 30%;
}

.skeleton-line.med {
  width: 60%;
}

.skeleton-line.long {
  width: 100%;
}

.skeleton-line.skeleton-ip {
  width: 55%;
  height: 2.25rem;
  margin: 0 auto;
  border-radius: 0.5rem;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line {
    animation: none;
  }
}

.ip-view {
  text-align: center;
  padding: 0.5rem 0;
}

.ip-grid {
  text-align: left;
  margin-top: 1rem;
  padding-top: 0.25rem;
}

.speed-view {
  text-align: center;
  padding: 0.5rem 0;
}

.speed-stats {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.speed-stat {
  flex: 1;
  max-width: 14rem;
  padding: 1rem;
  border: 1px solid var(--base-300);
  border-radius: var(--radius-box);
  background: var(--base-200);
}

.speed-value {
  font-size: 2rem;
  font-weight: 800;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  color: var(--primary);
  word-break: break-all;
}

.speed-unit {
  font-size: 0.875rem;
  opacity: 0.7;
  margin-left: 0.25rem;
}

.speed-label {
  font-size: 0.75rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.speed-status {
  margin-top: 0.75rem;
}

.speed-view > .btn {
  margin-top: 1rem;
}

.ip-big {
  font-size: 2.25rem;
  font-weight: 800;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  color: var(--primary);
  word-break: break-all;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

th,
td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--base-300);
  vertical-align: middle;
  word-break: break-all;
}

thead th {
  color: var(--base-content);
  opacity: 0.6;
  font-weight: 600;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

.field {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--base-300);
  font-size: 0.875rem;
}

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

.field .label {
  flex: 0 0 130px;
  color: var(--base-content);
  opacity: 0.6;
}

.field .value {
  flex: 1;
  word-break: break-all;
}

.status-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
}

.status-pill.ok {
  background: color-mix(in oklab, var(--ok) 15%, transparent);
  color: var(--ok);
}

.status-pill.bad {
  background: color-mix(in oklab, var(--err) 15%, transparent);
  color: var(--err);
}

.error {
  color: var(--err);
  font-size: 0.875rem;
}

.muted {
  color: var(--base-content);
  opacity: 0.7;
  font-size: 0.875rem;
}

details.raw {
  border-top: 1px solid var(--base-300);
}

details.raw summary {
  padding: 0.625rem 1rem;
  font-size: 0.75rem;
  opacity: 0.6;
  cursor: pointer;
  user-select: none;
}

details.raw pre {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-x: auto;
  background: var(--base-200);
  color: var(--base-content);
}

/* ---- Modal ---- */
.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
}

.modal[open] {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-box {
  position: relative;
  background: var(--base-100);
  color: var(--base-content);
  border: 1px solid var(--base-300);
  border-radius: var(--radius-box);
  max-width: 32rem;
  width: 90%;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.4);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--base-content);
  background: transparent;
  border: 1px solid var(--base-300);
  border-radius: var(--radius-field);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.modal-close:hover {
  opacity: 1;
  background: var(--base-200);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding-right: 2.5rem;
}

.modal-desc {
  font-size: 0.875rem;
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.credit-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--base-300);
}

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

.credit-name {
  display: inline-block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  text-decoration: none;
}

.credit-name:hover {
  text-decoration: underline;
}

.credit-desc {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.15rem;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  background: var(--base-200);
  border-top: 4px solid var(--neutral);
  padding: 2rem;
  font-size: 0.875rem;
  opacity: 0.8;
}
