:root {
  --brand-blue: #075da9;
  --brand-blue-dark: #064a86;
  --brand-blue-soft: #eaf4fc;
  --page-background: #f4f8fb;
  --surface: #ffffff;
  --text-primary: #12233a;
  --text-secondary: #647287;
  --border: rgba(31, 70, 107, 0.1);
  --shadow-soft: 0 10px 30px rgba(22, 61, 96, 0.07);
  --shadow-card: 0 8px 22px rgba(22, 61, 96, 0.075);
  --radius-panel: 26px;
  --radius-card: 22px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--page-background);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -70px, rgba(37, 161, 210, 0.1), transparent 330px),
    var(--page-background);
  color: var(--text-primary);
  font-family: Tahoma, Arial, "Segoe UI", sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.page-shell {
  display: flex;
  width: min(100%, 820px);
  min-height: 100svh;
  margin-inline: auto;
  padding:
    max(10px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  flex-direction: column;
}

.site-header {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 12px 14px 20px;
  border: 1px solid rgba(33, 105, 155, 0.1);
  border-radius: var(--radius-panel);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(237, 247, 253, 0.94));
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.site-header::before,
.site-header::after {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.site-header::before {
  inset-block-start: -78px;
  inset-inline-start: -54px;
  width: 170px;
  height: 170px;
  background: rgba(31, 168, 210, 0.09);
}

.site-header::after {
  inset-block-end: -92px;
  inset-inline-end: -68px;
  width: 190px;
  height: 190px;
  border: 28px solid rgba(11, 92, 171, 0.045);
}

.brand-logo {
  display: block;
  width: clamp(104px, 29vw, 138px);
  height: auto;
  margin: 0 auto 5px;
  object-fit: contain;
}

h1 {
  margin: 0;
  font-size: clamp(1.27rem, 5.7vw, 1.78rem);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.018em;
}

.intro {
  max-width: 520px;
  margin: 7px auto 0;
  color: var(--text-secondary);
  font-size: clamp(0.78rem, 3.4vw, 0.9rem);
  line-height: 1.75;
}

main {
  width: 100%;
  margin-block: 16px 18px;
}

.launcher {
  width: 100%;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tool-link {
  display: flex;
  min-width: 0;
  min-height: 160px;
  padding: 13px 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-card);
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  --tool-accent: var(--brand-blue);
  --tool-accent-2: #27a5ce;
  --tool-soft: #edf7fe;
  --tool-soft-2: #dceefa;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease,
    background-color 170ms ease;
}

.tool-icon {
  position: relative;
  display: grid;
  width: clamp(72px, 24vw, 88px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--tool-accent) 12%, white);
  border-radius: 23px;
  background: linear-gradient(145deg, var(--tool-soft), var(--tool-soft-2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 7px 16px color-mix(in srgb, var(--tool-accent) 13%, transparent);
  color: var(--tool-accent);
  place-items: center;
  transition: transform 170ms ease, box-shadow 170ms ease;
}

.tool-icon::after {
  position: absolute;
  inset-block-start: -16px;
  inset-inline-end: -15px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tool-accent-2) 15%, transparent);
  content: "";
}

.tool-icon svg {
  position: relative;
  z-index: 1;
  width: 66%;
  height: 66%;
  overflow: visible;
}

.tool-icon .icon-primary {
  fill: var(--tool-accent);
}

.tool-icon .icon-secondary {
  fill: var(--tool-accent-2);
}

.tool-icon .icon-surface {
  fill: rgba(255, 255, 255, 0.96);
}

.tool-icon .icon-line {
  fill: none;
  stroke: var(--tool-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.tool-name {
  max-width: 152px;
  min-height: 43px;
  margin-block-start: 9px;
  color: var(--text-primary);
  font-size: clamp(0.8rem, 3.7vw, 0.92rem);
  font-weight: 800;
  line-height: 1.5;
}

.tool-name span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
}

.tool-link:focus-visible {
  outline: 3px solid rgba(11, 92, 171, 0.24);
  outline-offset: 3px;
}

.tool-link:active {
  border-color: color-mix(in srgb, var(--tool-accent) 26%, white);
  background: color-mix(in srgb, var(--tool-soft) 36%, white);
  box-shadow: 0 3px 10px rgba(22, 61, 96, 0.06);
  transform: scale(0.97);
}

.tool-link:active .tool-icon {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 3px 8px color-mix(in srgb, var(--tool-accent) 11%, transparent);
  transform: scale(0.96);
}

.community-footer {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-block-start: 0;
  padding: 18px 14px;
  border: 1px solid rgba(33, 105, 155, 0.11);
  border-radius: var(--radius-card);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 252, 0.95));
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.community-footer h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.96rem;
  line-height: 1.55;
}

.community-footer p {
  max-width: 520px;
  margin: 6px auto 0;
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.7;
}

.community-button {
  display: inline-flex;
  width: min(100%, 320px);
  min-height: 44px;
  margin-block-start: 12px;
  padding: 9px 18px;
  border: 1px solid var(--brand-blue);
  border-radius: 13px;
  background: linear-gradient(135deg, #0b67b7, var(--brand-blue-dark));
  box-shadow: 0 7px 16px rgba(8, 73, 133, 0.18);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 700;
  gap: 7px;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.community-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.community-button:focus-visible {
  outline: 3px solid rgba(11, 92, 171, 0.24);
  outline-offset: 3px;
}

.community-button:active {
  box-shadow: 0 3px 8px rgba(8, 73, 133, 0.16);
  transform: scale(0.98);
}

.noscript-message {
  padding: 12px;
  border-radius: 12px;
  background: #fff4e5;
  color: #704d15;
  text-align: center;
  font-size: 0.9rem;
}

@media (hover: hover) and (pointer: fine) {
  .tool-link:hover {
    border-color: color-mix(in srgb, var(--tool-accent) 22%, white);
    box-shadow: 0 13px 30px rgba(22, 61, 96, 0.1);
    transform: translateY(-3px);
  }

  .tool-link:hover .tool-icon {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.82),
      0 10px 20px color-mix(in srgb, var(--tool-accent) 17%, transparent);
    transform: translateY(-1px);
  }

  .community-button:hover {
    box-shadow: 0 9px 19px rgba(8, 73, 133, 0.23);
    filter: brightness(1.04);
    transform: translateY(-1px);
  }
}

@media (min-width: 680px) {
  .page-shell {
    padding-inline: 22px;
  }

  .site-header {
    padding-block: 14px 22px;
  }

  .tools-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }

  .tool-link {
    min-height: 174px;
  }

  main {
    margin-block: 18px 20px;
  }
}

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