:root {
  --primary: #3861fb;
  --accent: #36e4da;
  --page-bg: #f9fafb;
  --text: #1f2937;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-width: 320px; }

body {
  color: var(--text);
  background: var(--page-bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  overflow-x: hidden;
}

button, a { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.page { min-height: 100vh; display: flex; flex-direction: column; background: var(--page-bg); }
.container { width: 100%; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

.header { position: relative; z-index: 2; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 5%); }
.header__inner { height: 60px; display: flex; align-items: center; gap: 8px; }
.header__title { color: #1f2937; font-size: 20px; line-height: 28px; font-weight: 700; }

.icon { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon--brand { width: 24px; height: 24px; color: var(--primary); }
.icon--button { width: 20px; height: 20px; }
.icon--button polygon { fill: none; }
.icon--download { width: 16px; height: 16px; }
.icon--server { width: 20px; height: 20px; color: var(--primary); flex: 0 0 auto; }

.main { position: relative; z-index: 1; flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { width: 100%; max-width: 896px; overflow: hidden; background: #fff; border-radius: 8px; box-shadow: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -4px rgb(0 0 0 / 10%); transition: all .5s; }

.test-panel { min-height: 280px; }
.state { min-height: 280px; padding: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.state--idle h2 { margin: 0 0 24px; color: #1f2937; font-size: 24px; line-height: 32px; font-weight: 700; text-align: center; }
.state--idle p { max-width: 448px; margin: 0 0 32px; color: #4b5563; font-size: 16px; line-height: 24px; text-align: center; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: #fff; font-weight: 700; background: linear-gradient(-45deg, #3861fb, #36e4da, #2d4ccc, #2bbeb5); background-size: 400% 400%; animation: gradient 15s ease infinite; transition: opacity .15s, transform .15s, box-shadow .15s; }
.button:hover { opacity: .9; }
.button--round { padding: 16px 32px; border-radius: 999px; box-shadow: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -4px rgb(0 0 0 / 10%); }
.button--round:hover { opacity: 1; transform: translateY(-4px); box-shadow: 0 20px 25px -5px rgb(0 0 0 / 10%), 0 8px 10px -6px rgb(0 0 0 / 10%); }

.manual { min-height: 164px; padding: 32px; border-top: 1px solid #f3f4f6; }
.manual h3 { margin: 0 0 24px; color: #1f2937; font-size: 20px; line-height: 28px; font-weight: 600; text-align: center; }
.manual__links { display: flex; justify-content: center; gap: 16px; }
.button--file { padding: 12px 24px; border-radius: 8px; font-weight: 600; }

.server { width: 100%; max-width: 448px; margin-bottom: 32px; padding: 16px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid #f3f4f6; border-radius: 8px; background: #f9fafb; box-shadow: 0 1px 2px rgb(0 0 0 / 5%); }
.server strong, .server small { display: block; }
.server small { color: #4b5563; margin-top: 2px; }
.meters { display: flex; align-items: center; justify-content: center; gap: 32px; width: 100%; }
.ping, .speed { display: flex; flex-direction: column; align-items: center; }
.ping span, .speed > span { color: #374151; font-weight: 500; margin-bottom: 8px; }
.ping strong { color: #22c55e; font-size: 30px; }
.gauge { width: 200px; height: 100px; padding-top: 34px; text-align: center; border-radius: 200px 200px 0 0; background: conic-gradient(from 270deg at 50% 100%, #e5e7eb 0 50%, transparent 50%); }
.gauge div { font-size: 30px; line-height: 36px; font-weight: 700; }
.gauge small { color: #4b5563; }
.status { margin: 32px 0 0; color: #4b5563; text-align: center; }

.state--error h2 { margin: 0 0 16px; color: #ef4444; font-size: 20px; }
.state--error p { margin: 0 0 32px; color: #374151; text-align: center; }
.button--retry { padding: 12px 24px; border-radius: 999px; background: #3861fb; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 10%); }

.footer { position: relative; z-index: 1; flex: 0 0 auto; min-height: 193px; padding: 32px 0; color: #d1d5db; background: #1f2937; }
.footer__company { text-align: center; }
.footer h3 { margin: 0 0 12px; font-size: 18px; line-height: 28px; font-weight: 600; }
.footer p { margin: 0; font-size: 14px; line-height: 20px; }
.footer__copyright { margin-top: 32px; padding-top: 16px; border-top: 1px solid #374151; font-size: 14px; line-height: 20px; text-align: center; }

.emoji-layer { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.floating-emoji { position: fixed; font-size: 32px; opacity: .7; animation: float 3s ease-in-out infinite; }
.floating-emoji:nth-child(2n) { animation-duration: 3.5s; animation-delay: .3s; }
.floating-emoji:nth-child(3n) { animation-duration: 4s; animation-delay: .7s; }
.floating-emoji:nth-child(4n) { animation-duration: 4.5s; animation-delay: 1s; }

@keyframes gradient { 0% { background-position: 0 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-20px) rotate(10deg); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 640px) { .container { max-width: 640px; } }
@media (min-width: 768px) { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }

@media (max-width: 639px) {
  .main { align-items: flex-start; }
  .state, .manual { padding: 32px 20px; }
  .state--idle h2 { font-size: 22px; line-height: 29px; }
  .manual__links, .meters { flex-direction: column; }
  .button--file { width: 100%; }
  .footer { min-height: 193px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
