:root {
  --bg: #eaf6ff;
  --panel: rgba(255, 255, 255, 0.84);
  --text: #102033;
  --muted: #6d7f92;
  --line: rgba(133, 181, 224, 0.24);
  --green: #27c93f;
  --icon-gray: #7b8998;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(90, 160, 220, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 160, 220, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, #f8fcff 0%, var(--bg) 48%, #ffffff 100%);
  background-size:
    42px 42px,
    42px 42px,
    auto;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  letter-spacing: 0;
}

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

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  height: 58px;
  display: grid;
  grid-template-columns: 220px minmax(220px, 470px) 220px;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  background: rgba(244, 250, 255, 0.86);
  border-bottom: 1px solid rgba(127, 174, 216, 0.22);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 18px;
  font-weight: 800;
}

.brand-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow:
    0 0 0 4px rgba(39, 201, 63, 0.1),
    inset 0 -1px 1px rgba(0, 0, 0, 0.12);
}

.search {
  position: relative;
  justify-self: center;
  width: 100%;
}

.search input {
  width: 100%;
  height: 38px;
  padding: 0 44px 0 16px;
  border: 0;
  border-radius: 20px;
  outline: 0;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  box-shadow:
    inset 0 0 0 1px rgba(117, 166, 210, 0.18),
    0 10px 30px rgba(88, 152, 210, 0.08);
}

.search input::placeholder {
  color: #9aabba;
}

.search input:focus {
  box-shadow:
    inset 0 0 0 1px rgba(52, 126, 224, 0.28),
    0 0 0 3px rgba(52, 126, 224, 0.14);
}

.search svg {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 23px;
  height: 23px;
  color: #52687d;
  transform: translateY(-50%);
  pointer-events: none;
}

.tagline {
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
}

.shell {
  width: min(1540px, calc(100% - 14px));
  min-height: calc(100vh - 66px);
  margin: 0 auto 8px;
  padding: 56px clamp(24px, 8vw, 148px) 44px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background:
    linear-gradient(rgba(72, 144, 210, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 144, 210, 0.045) 1px, transparent 1px),
    var(--panel);
  background-size:
    34px 34px,
    34px 34px,
    auto;
  box-shadow: 0 24px 70px rgba(76, 139, 194, 0.12);
  backdrop-filter: blur(18px);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(92px, 1fr));
  gap: 38px 44px;
  align-items: start;
}

.tool-app {
  display: grid;
  justify-items: center;
  gap: 11px;
  min-width: 0;
  padding: 6px 2px;
  border-radius: 10px;
  text-align: center;
}

.tool-app:focus-visible {
  outline: 3px solid rgba(39, 201, 63, 0.28);
  outline-offset: 4px;
}

.tool-app:hover .tool-icon {
  transform: translateY(-3px);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.12);
}

.tool-icon {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(110, 160, 205, 0.18);
  border-radius: 18px;
  background: linear-gradient(145deg, #f7fbff, #ffffff);
  color: var(--icon-gray);
  box-shadow: 0 8px 22px rgba(79, 138, 190, 0.08);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.tool-icon svg {
  width: 43px;
  height: 43px;
}

.is-featured .tool-icon {
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.13);
}

.icon-tdee {
  background: linear-gradient(145deg, #111111, #3b3b3b);
}

.icon-rm {
  background: linear-gradient(145deg, #246bff, #76a7ff);
}

.icon-maxhr {
  background: linear-gradient(145deg, #ff4b3e, #ff9a5a);
}

.tool-name {
  max-width: 112px;
  overflow: hidden;
  color: #17283a;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  display: none;
  margin-top: 100px;
  color: var(--muted);
  font-size: 16px;
  text-align: center;
}

.no-results .empty {
  display: block;
}

.no-results .tool-grid {
  display: none;
}

.coming-soon {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
  text-align: center;
}

.coming-soon-card {
  width: min(760px, 100%);
  padding: clamp(42px, 9vw, 88px) 28px;
  border: 1px solid rgba(110, 160, 205, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 24px 70px rgba(76, 139, 194, 0.12);
  backdrop-filter: blur(18px);
}

.coming-soon-card h1 {
  margin: 0 0 18px;
  font-size: clamp(34px, 7vw, 64px);
  line-height: 1.08;
}

.coming-soon-card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 700;
  line-height: 1.6;
}

.back-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 30px;
  padding: 0 18px;
  border: 1px solid rgba(52, 126, 224, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #245fba;
  font-size: 15px;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .tool-grid {
    grid-template-columns: repeat(6, minmax(90px, 1fr));
    gap: 34px 32px;
  }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px 16px 14px;
  }

  .brand,
  .search {
    justify-self: stretch;
  }

  .tagline {
    display: none;
  }

  .shell {
    width: 100%;
    min-height: calc(100vh - 112px);
    padding: 36px 18px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .tool-grid {
    grid-template-columns: repeat(4, minmax(72px, 1fr));
    gap: 30px 18px;
  }

  .tool-icon {
    width: 66px;
    height: 66px;
    border-radius: 16px;
  }

  .tool-icon svg {
    width: 36px;
    height: 36px;
  }

  .tool-name {
    max-width: 86px;
    font-size: 14px;
  }
}

@media (max-width: 460px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
