:root {
  --duck-yellow: #ffd23f;
  --duck-orange: #ff8c1a;
  --pond-1: #56c5e6;
  --pond-2: #2a9fc4;
  --ink: #23303a;
  --card: #ffffff;
  --soft: #f3fbff;
  --shadow: 0 10px 30px rgba(20, 80, 110, 0.15);
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Nunito", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #aee9f7 0%, #7fd1e0 45%, #56c5e6 100%);
  min-height: 100vh;
  /* disable double-tap-to-zoom (keeps scrolling & pinch-zoom) */
  touch-action: manipulation;
}
/* touch-action isn't inherited, so set it on the tap targets too */
.duck, .stat, .stat-head, .copy-btn, .detail-copy, .ip-grid, button {
  touch-action: manipulation;
}

/* floating bubbles */
.pond-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.bubble {
  position: absolute;
  bottom: -60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  animation: rise linear infinite;
}
.b1 { left: 12%; width: 26px; height: 26px; animation-duration: 14s; }
.b2 { left: 38%; width: 16px; height: 16px; animation-duration: 11s; animation-delay: 2s; }
.b3 { left: 67%; width: 34px; height: 34px; animation-duration: 17s; animation-delay: 1s; }
.b4 { left: 85%; width: 20px; height: 20px; animation-duration: 13s; animation-delay: 4s; }
@keyframes rise {
  to { transform: translateY(-110vh); opacity: 0; }
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* hero */
.hero { text-align: center; margin-bottom: 24px; }

/* pond scene holds the duck + ripples */
.pond-scene {
  position: relative;
  width: 300px;
  max-width: 90vw;
  margin: 0 auto 6px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* expanding ripple rings on the water surface */
.ripple {
  position: absolute;
  left: 50%;
  bottom: 46px;
  width: 120px;
  height: 26px;
  margin-left: -60px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.4);
  animation: ripple 4s ease-out infinite;
  pointer-events: none;
}
.ripple.r2 { animation-delay: 1.3s; }
.ripple.r3 { animation-delay: 2.6s; }
@keyframes ripple {
  0% { opacity: 0.7; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.9); }
}
/* extra splash ripple injected on click */
.ripple.splash {
  animation: ripple 1s ease-out forwards;
  border-color: rgba(255, 255, 255, 0.85);
}

/* the float wrapper bobs up/down + sways = "floating in water" */
.duck-float {
  position: relative;
  z-index: 2;
  animation: floaty 4.5s ease-in-out infinite;
  transform-origin: 50% 80%;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-2.5deg); }
  50% { transform: translateY(-14px) rotate(2.5deg); }
}

.duck {
  display: inline-block;
  cursor: pointer;
  filter: drop-shadow(0 10px 8px rgba(20, 80, 110, 0.22));
  -webkit-tap-highlight-color: transparent;
}
.duck svg { display: block; overflow: visible; }
.duck:focus-visible { outline: 3px dashed #fff; outline-offset: 6px; border-radius: 16px; }

/* squish/quack reaction on click */
.duck.quacking { animation: squish 0.45s ease; }
@keyframes squish {
  0%, 100% { transform: scale(1, 1); }
  35% { transform: scale(1.12, 0.9); }
  70% { transform: scale(0.94, 1.08); }
}

/* gentle independent head bob */
.head { transform-box: fill-box; transform-origin: 60% 100%; animation: headbob 3.2s ease-in-out infinite; }
@keyframes headbob {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(2deg); }
}

/* eyes stay fully visible — pupils gently "look around" (no fading!) */
.pupil {
  transform-box: fill-box;
  transform-origin: center;
  animation: lookaround 6s ease-in-out infinite;
}
@keyframes lookaround {
  0%, 18% { transform: translate(0, 0); }
  30%, 45% { transform: translate(2.5px, 0.5px); }
  60%, 75% { transform: translate(-2px, 1px); }
  88%, 100% { transform: translate(0, 0); }
}
/* twinkling glint in the eyes */
.sparkle {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 3.5s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.4); }
}

/* tiny tuft wiggle + wing flutter */
.tuft { transform-box: fill-box; transform-origin: bottom center; animation: tuft 4s ease-in-out infinite; }
@keyframes tuft { 0%,100%{transform:rotate(-4deg);} 50%{transform:rotate(6deg);} }
.wing { transform-box: fill-box; transform-origin: 30% 40%; }
.duck.flap .wing { animation: flap 0.5s ease; }
@keyframes flap { 0%,100%{transform:rotate(0);} 50%{transform:rotate(-16deg) translateY(-4px);} }

/* waterline gently shimmies */
.waterline { transform-box: view-box; animation: waterwave 6s ease-in-out infinite; }
.waterline2 { animation-duration: 8s; animation-direction: reverse; }
@keyframes waterwave {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-18px); }
}

/* easter egg: King Ducky crown (eyes stay visible!) */
.duck.smitten .crown {
  opacity: 1;
  transform-box: fill-box;
  transform-origin: bottom center;
  animation: crownpop 0.5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes crownpop {
  0% { opacity: 0; transform: translateY(14px) scale(0.4); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
/* hide the little tuft while wearing the crown so they don't overlap */
.duck.smitten .tuft { opacity: 0; transition: opacity 0.2s ease; }
/* a touch rosier cheeks when smitten */
.duck.smitten .blush { opacity: 0.85 !important; }

/* easter egg: party / disco mode */
body.party { animation: party 0.6s linear infinite; }
@keyframes party {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* floating emoji that pop off the duck on click */
.poof {
  position: fixed;
  z-index: 50;
  font-size: 1.6rem;
  pointer-events: none;
  animation: poof 1.2s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes poof {
  0% { opacity: 1; transform: translateY(0) scale(0.6) rotate(0); }
  100% { opacity: 0; transform: translateY(-90px) scale(1.3) rotate(var(--spin, 20deg)); }
}

/* raining ducks easter egg */
.rain-duck {
  position: fixed;
  top: -50px;
  z-index: 40;
  font-size: 2rem;
  pointer-events: none;
  animation: raindown linear forwards;
}
@keyframes raindown {
  0% { transform: translateY(-60px) rotate(0); opacity: 1; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .duck-float, .head, .pupil, .sparkle, .tuft, .waterline, .ripple, .bubble { animation: none; }
}
h1 {
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  margin: 4px 0 6px;
  color: #fff;
  text-shadow: 0 3px 0 var(--duck-orange), 0 6px 14px rgba(0,0,0,0.15);
  letter-spacing: 1px;
}
.tagline {
  margin: 0;
  font-size: 1.05rem;
  color: #0d4a5e;
  font-weight: 600;
}

/* IP card */
.ip-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 26px;
  border: 3px solid var(--duck-yellow);
}
/* mute / unmute speaker toggle, on the IP-address label row,
   horizontally centered over the copy column */
.mute-btn {
  position: absolute;
  top: 22px;
  right: 48px;                /* horizontally centered on the 76px copy column */
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: #8b9aa3;            /* medium gray */
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}
.mute-btn:hover { color: #5e7480; background: rgba(20, 80, 110, 0.08); }
.mute-btn:active { transform: scale(0.9); }
.mute-btn .spk-off { display: none; }
.mute-btn.muted { color: #647782; }
.mute-btn.muted .spk-on { display: none; }
.mute-btn.muted .spk-off { display: inline-block; }
.ip-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #6a8a99;
  font-weight: 700;
}
.ip-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px 12px;
  margin: 14px 0;
}
/* explicit columns so a hidden copy button never shifts the layout */
.ip-grid .ip-tag { grid-column: 1; }
.ip-grid .ip-value { grid-column: 2; }
.ip-grid .copy-btn { grid-column: 3; }
.ip-tag {
  background: var(--pond-2);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 9px;
  border-radius: 6px;
  text-align: center;
}
.ip-tag.v6 { background: #6a4fc4; }
.ip-value {
  font-size: clamp(1.2rem, 4.5vw, 2rem);
  font-weight: 800;
  color: var(--ink);
  word-break: break-all;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  text-align: left;
}
.ip-value.error { color: #d6453a; font-size: 1.1rem; }
.ip-value.muted { color: #9bb3bf; font-weight: 600; font-size: 1.05rem; }
.ip-meta {
  color: #6a8a99;
  font-weight: 600;
  min-height: 1.2em;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px dashed #e3eef3;
}
.copy-btn {
  background: var(--duck-yellow);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--duck-orange);
  transition: transform 0.1s, box-shadow 0.1s;
}
.copy-btn.mini {
  padding: 6px 10px;
  font-size: 0.78rem;
  flex: 0 0 auto;
  /* fixed width so "Copy" -> "Copied!" doesn't widen the column and
     squeeze the IP value (which was cutting off an IPv6 character) */
  min-width: 76px;
  text-align: center;
  box-sizing: border-box;
}
.copy-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--duck-orange);
}
.copy-btn.copied { background: #8de08d; box-shadow: 0 4px 0 #4caf50; }

/* loading dots */
.loading-dots span {
  animation: blink 1.2s infinite;
  font-weight: 900;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

/* stats */
.stats-title {
  text-align: center;
  color: #0d4a5e;
  font-size: 1.4rem;
  margin: 0 0 16px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 14px;
}
.stat {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease;
  /* reset button defaults for the expandable variant */
  border: none;
  margin: 0;
  width: 100%;
  min-width: 0;        /* let the card shrink instead of forcing the grid wide */
  max-width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
.stat:hover { transform: translateY(-4px); }
.stat.expandable > .stat-head { cursor: pointer; }
.stat-head:focus-visible { outline: 3px solid var(--pond-2); outline-offset: 2px; border-radius: 8px; }

.stat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;          /* the toggle row isn't meant to be selected */
  -webkit-user-select: none;
}
.stat .icon { font-size: 1.3rem; line-height: 1; flex: 0 0 auto; }
.stat .icon .flag {
  display: block;
  width: 28px;
  height: 21px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(20, 80, 110, 0.18);
}
.stat .body {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
}
.stat .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6a8a99;
  font-weight: 700;
  flex: 0 0 auto;
}
.stat .v {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.stat .chev {
  flex: 0 0 auto;
  color: #b6cdd8;
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

/* the expanding detail panel */
.stat .detail {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.28s ease, opacity 0.2s ease, margin-top 0.28s ease;
}
.stat .detail-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: pre-line;
  word-break: break-word;
  overflow-wrap: anywhere;    /* break long tokens so they never overflow */
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a6675;
  line-height: 1.45;
  /* freely selectable so you can highlight & copy */
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}
.detail-copy {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(20, 80, 110, 0.08);
  color: #4a6675;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.detail-copy:hover { background: rgba(20, 80, 110, 0.16); }
.detail-copy:active { transform: translateY(1px); }
.detail-copy .ck { display: none; font-weight: 900; }
.detail-copy.copied { background: #d7f5e3; color: #2e9e63; }
.detail-copy.copied .ci { display: none; }
.detail-copy.copied .ck { display: inline; }
.stat.expanded {
  grid-column: 1 / -1;            /* take the full row when open */
  background: var(--soft);
  box-shadow: 0 10px 26px rgba(20, 80, 110, 0.22);
}
.stat.expanded .detail {
  max-height: 320px;
  opacity: 1;
  margin-top: 12px;
}
.stat.expanded .chev { transform: rotate(90deg); }
.stat.expanded .v { white-space: normal; }

/* map */
.map-section { margin-top: 30px; }
#map {
  width: 100%;
  height: 320px;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.map-note {
  text-align: center;
  color: #0d4a5e;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 8px;
}

/* FAQ */
.faq { margin-top: 34px; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq details {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  padding: 4px 18px;
  transition: border-color 0.15s ease;
}
.faq details[open] { border-color: var(--duck-yellow); }
.faq summary {
  cursor: pointer;
  font-weight: 700;
  color: #0d4a5e;
  padding: 12px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  color: var(--duck-orange);
  font-weight: 900;
  font-size: 1.3rem;
  line-height: 1;
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p {
  margin: 0 0 14px;
  color: #4a6675;
  font-weight: 600;
  line-height: 1.55;
}
.faq code {
  background: var(--soft);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.92em;
}

/* footer */
.footer {
  text-align: center;
  margin-top: 40px;
  color: #0d4a5e;
  font-size: 0.85rem;
  font-weight: 600;
}
.footer p { margin: 4px 0; }
.quack { font-style: italic; opacity: 0.8; }
.page-links {
  margin: 10px 0;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.page-links a {
  color: #0d4a5e;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid rgba(13, 74, 94, 0.25);
  padding-bottom: 1px;
}
.page-links a:hover { color: var(--duck-orange); border-bottom-color: var(--duck-orange); }
.page-links span { opacity: 0.4; }
.copyright { opacity: 0.75; margin-top: 8px; }

/* ---- content sub-pages (privacy / disclaimer / philosophy) ---- */
.page-wrap { max-width: 720px; }
.page-head { text-align: center; margin-bottom: 22px; }
.page-head .duck-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 1.4rem;
  text-shadow: 0 2px 0 var(--duck-orange);
}
.page-head .duck-link .emoji { font-size: 1.8rem; }
.content-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 3px solid var(--duck-yellow);
  padding: 28px 28px 24px;
  color: #2c4450;
  line-height: 1.6;
}
.content-card h1 {
  font-size: 1.9rem;
  margin: 0 0 4px;
  color: #0d4a5e;
  text-shadow: none;
  letter-spacing: 0;
}
.content-card .lede { color: #6a8a99; font-weight: 700; margin-top: 0; }
.content-card h2 {
  font-size: 1.15rem;
  color: var(--duck-orange);
  margin: 22px 0 6px;
}
.content-card p { margin: 8px 0; }
.content-card a { color: #1f8fb0; font-weight: 600; }
.content-card ul { margin: 8px 0; padding-left: 22px; }
.content-card li { margin: 5px 0; }
.content-card .updated { color: #9bb3bf; font-size: 0.85rem; font-weight: 600; }
.home-btn {
  display: inline-block;
  margin-top: 22px;
  background: var(--duck-yellow);
  color: var(--ink);
  text-decoration: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 700;
  box-shadow: 0 4px 0 var(--duck-orange);
}
.home-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--duck-orange); }

@media (max-width: 480px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .content-card { padding: 22px 18px; }
}
