@layer reset, base, layout, components, motion;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body, h1, h2, p { margin: 0; }
  a { color: inherit; text-decoration: none; }
  button, input, textarea, select { font: inherit; }
}

@layer base {
  :root {
    --ink: #f5f7f8;
    --muted: rgba(235, 243, 246, .62);
    --dim: rgba(222, 234, 239, .40);
    --line: rgba(223, 241, 247, .18);
    --surface: rgba(7, 15, 19, .50);
    --surface-strong: rgba(7, 15, 19, .76);
    --cyan: #9cecf2;
    --cyan-hot: #d8fbff;
    --amber: #f0d88d;
    --violet: #cab7ff;
    --mx: 25vw;
    --my: 50vh;
  }

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

  body {
    min-height: 100svh;
    overflow-x: hidden;
    color: var(--ink);
    background: #071014;
    font-family:
      "Bahnschrift", "DIN Alternate", "Inter",
      "Noto Sans SC", "Microsoft YaHei UI", system-ui, sans-serif;
    letter-spacing: .012em;
    -webkit-font-smoothing: antialiased;
  }

  ::selection { background: rgba(178, 239, 245, .28); color: #fff; }

  .background {
    position: fixed;
    inset: 0;
    z-index: -5;
    background:
      linear-gradient(90deg,
        rgba(4, 10, 13, .96) 0%,
        rgba(4, 10, 13, .88) 19%,
        rgba(4, 10, 13, .48) 40%,
        rgba(4, 10, 13, .05) 57%,
        rgba(4, 10, 13, .00) 73%),
      linear-gradient(0deg,
        rgba(4, 10, 13, .68) 0%,
        rgba(4, 10, 13, .10) 35%,
        rgba(4, 10, 13, .08) 100%),
      url("./bg.png") 50% 50% / cover no-repeat;
    transform: scale(1.012);
    filter: saturate(.92) contrast(1.02);
  }

  .background::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
      radial-gradient(circle at 12% 78%, rgba(126, 227, 239, .09), transparent 28%),
      linear-gradient(115deg, rgba(115, 219, 229, .05), transparent 28%);
    pointer-events: none;
  }

  .grain {
    position: fixed;
    inset: -30%;
    z-index: 10;
    pointer-events: none;
    opacity: .055;
    background-image:
      url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
    animation: noise .28s steps(2) infinite;
    mix-blend-mode: soft-light;
  }

  .scanlines {
    position: fixed;
    inset: 0;
    z-index: 9;
    pointer-events: none;
    opacity: .12;
    background: repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 3px,
      rgba(190, 230, 236, .10) 4px
    );
    mask-image: linear-gradient(to right, rgba(0,0,0,.7), transparent 65%);
  }


  .snow {
    position: fixed;
    inset: 0;
    z-index: 8;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: .82;
    mix-blend-mode: screen;
  }

  .cursor-glow {
    position: fixed;
    inset: 0;
    z-index: -3;
    pointer-events: none;
    background:
      radial-gradient(380px circle at var(--mx) var(--my),
      rgba(175, 241, 246, .09), transparent 70%);
  }
}

@layer layout {
  .topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 30;
    height: 76px;
    padding: 0 clamp(20px, 3vw, 52px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(226, 241, 246, .12);
    background: linear-gradient(to bottom, rgba(4, 10, 13, .58), rgba(4, 10, 13, .18));
    backdrop-filter: blur(10px) saturate(120%);
  }

  .topbar::after {
    content: "";
    position: absolute;
    left: clamp(20px, 3vw, 52px);
    bottom: -1px;
    width: 132px;
    height: 2px;
    background: var(--cyan);
    box-shadow: 0 0 16px rgba(156, 236, 242, .35);
  }

  .shell {
    width: min(100%, 1800px);
    min-height: 100svh;
    margin: 0 auto;
    padding: 124px clamp(24px, 5vw, 88px) 100px;
    display: flex;
    align-items: center;
  }

  .hero {
    width: min(640px, 45vw);
    margin-top: 3vh;
  }

  .footer {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    min-height: 46px;
    padding: 0 clamp(20px, 3vw, 52px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: rgba(239, 247, 249, .48);
    font-size: 10px;
    letter-spacing: .14em;
    text-transform: uppercase;
    border-top: 1px solid rgba(226, 241, 246, .10);
    background: linear-gradient(to top, rgba(4, 10, 13, .60), rgba(4, 10, 13, .10));
    backdrop-filter: blur(8px);
  }

  .footer > div { display: flex; align-items: center; gap: 10px; }
  .footer-right { font-variant-numeric: tabular-nums; }
}

@layer components {
  .brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
  .brand-icon {
    width: 35px;
    height: 35px;
    display: block;
    flex: 0 0 35px;
    object-fit: contain;
    image-rendering: auto;
    filter: drop-shadow(0 0 10px rgba(156, 236, 242, .18));
  }
  .brand-copy { display: grid; gap: 2px; }
  .brand-copy strong {
    font-family: "Arial Narrow", "Bahnschrift SemiCondensed", sans-serif;
    font-size: 13px;
    letter-spacing: .11em;
    font-weight: 700;
  }
  .brand-copy small {
    color: rgba(232, 243, 246, .43);
    font-size: 8px;
    letter-spacing: .17em;
  }

  .top-status {
    display: flex;
    align-items: center;
    gap: 9px;
    color: rgba(235, 247, 249, .47);
    font-size: 9px;
    letter-spacing: .16em;
  }
  .top-status b { color: rgba(216, 251, 255, .83); font-weight: 600; }
  .status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 12px rgba(156, 236, 242, .8);
    animation: pulse 1.8s ease-in-out infinite;
  }

  .eyebrow {
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(100%, 420px);
    margin-bottom: 18px;
    color: rgba(224, 241, 244, .55);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .22em;
  }
  .eyebrow i {
    height: 1px;
    flex: 1;
    background: linear-gradient(to right, rgba(219, 242, 245, .35), transparent);
  }

  h1 { display: grid; line-height: .95; }
  .title-cn {
    width: fit-content;
    font-family: "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
    font-size: clamp(42px, 5.2vw, 78px);
    font-weight: 700;
    letter-spacing: -.05em;
    text-shadow: 0 3px 30px rgba(0,0,0,.22);
  }
  .title-cn::after {
    content: "";
    display: block;
    width: 74px;
    height: 5px;
    margin-top: 16px;
    background: var(--cyan);
    clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%);
    box-shadow: 0 0 20px rgba(156, 236, 242, .25);
  }
  .title-en {
    margin-top: 13px;
    color: rgba(236, 246, 248, .45);
    font-family: "Arial Narrow", "Bahnschrift SemiCondensed", sans-serif;
    font-size: clamp(13px, 1.1vw, 17px);
    font-weight: 700;
    letter-spacing: .20em;
  }

  .lede {
    margin-top: 25px;
    max-width: 540px;
    color: rgba(239, 247, 249, .72);
    font-size: clamp(13px, .95vw, 16px);
    line-height: 1.9;
    text-shadow: 0 2px 20px rgba(0,0,0,.45);
  }

  .micro-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 18px;
    color: rgba(231, 242, 245, .36);
    font-size: 8px;
    letter-spacing: .18em;
  }
  .micro-meta span:not(:first-child)::before {
    content: "/";
    margin-right: 18px;
    color: rgba(156, 236, 242, .45);
  }

  .tool-grid {
    display: grid;
    gap: 8px;
    margin-top: 34px;
    perspective: 1100px;
  }

  .tool-card {
    --accent: var(--cyan);
    position: relative;
    isolation: isolate;
    min-height: 118px;
    padding: 14px 16px 12px;
    overflow: hidden;
    border: 1px solid rgba(225, 243, 246, .14);
    border-radius: 2px;
    background:
      linear-gradient(96deg, rgba(9, 19, 24, .83), rgba(9, 19, 24, .50) 70%, rgba(9, 19, 24, .25)),
      radial-gradient(340px circle at var(--lx, 20%) var(--ly, 50%), rgba(205, 247, 250, .08), transparent 62%);
    backdrop-filter: blur(12px) saturate(125%);
    box-shadow:
      0 12px 34px rgba(0,0,0,.12),
      inset 0 1px rgba(255,255,255,.025);
    transform:
      perspective(950px)
      rotateX(var(--rx, 0deg))
      rotateY(var(--ry, 0deg))
      translate3d(0, 0, 0);
    transition:
      transform .25s cubic-bezier(.2,.8,.2,1),
      border-color .25s ease,
      background .25s ease,
      box-shadow .25s ease;
    will-change: transform;
  }

  .tool-card[data-accent="amber"] { --accent: var(--amber); }
  .tool-card[data-accent="violet"] { --accent: var(--violet); }

  .tool-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0;
    background:
      radial-gradient(260px circle at var(--lx, 20%) var(--ly, 50%),
      color-mix(in srgb, var(--accent) 16%, transparent), transparent 64%);
    transition: opacity .25s ease;
  }

  .tool-card::after {
    content: attr(data-code);
    position: absolute;
    right: 12px;
    bottom: -14px;
    z-index: -2;
    color: rgba(255,255,255,.025);
    font-family: "Arial Narrow", sans-serif;
    font-size: 82px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -.08em;
    pointer-events: none;
  }

  .tool-card:hover,
  .tool-card:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 50%, transparent);
    box-shadow:
      0 18px 48px rgba(0,0,0,.22),
      0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent),
      inset 0 1px rgba(255,255,255,.04);
    transform:
      perspective(950px)
      rotateX(var(--rx, 0deg))
      rotateY(var(--ry, 0deg))
      translate3d(4px, -2px, 0);
  }
  .tool-card:hover::before,
  .tool-card:focus-visible::before { opacity: 1; }

  .card-border {
    position: absolute;
    inset: 0;
    pointer-events: none;
    padding: 1px;
    opacity: 0;
    background:
      radial-gradient(180px circle at var(--lx, 20%) var(--ly, 50%),
      color-mix(in srgb, var(--accent) 80%, white 10%), transparent 75%);
    -webkit-mask:
      linear-gradient(#fff 0 0) content-box,
      linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: opacity .2s ease;
  }
  .tool-card:hover .card-border,
  .tool-card:focus-visible .card-border { opacity: .8; }

  .card-head, .card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .card-head {
    color: rgba(236, 247, 249, .36);
    font-size: 8px;
    letter-spacing: .17em;
  }
  .arrow {
    color: rgba(241, 249, 250, .52);
    font-size: 17px;
    line-height: 1;
    transform: translate(-1px, 1px);
    transition: transform .22s ease, color .22s ease;
  }
  .tool-card:hover .arrow { transform: translate(2px, -2px); color: var(--accent); }

  .card-body {
    display: grid;
    grid-template-columns: 44px 1fr;
    align-items: center;
    gap: 14px;
    margin: 10px 0 11px;
  }
  .card-body h2 {
    font-size: clamp(15px, 1.05vw, 18px);
    font-weight: 600;
    letter-spacing: .015em;
  }
  .card-body p {
    margin-top: 4px;
    color: rgba(229, 243, 246, .42);
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 9px;
    letter-spacing: .08em;
  }

  .icon {
    position: relative;
    width: 42px; height: 42px;
    border: 1px solid rgba(228, 244, 247, .15);
    background: rgba(220, 247, 250, .025);
    transition: border-color .22s ease, background .22s ease;
  }
  .tool-card:hover .icon {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
  }

  .icon-stream span {
    position: absolute; left: 9px; right: 9px;
    height: 1px; background: var(--accent);
    transform-origin: left;
  }
  .icon-stream span:nth-child(1) { top: 12px; width: 17px; }
  .icon-stream span:nth-child(2) { top: 20px; width: 23px; opacity: .72; }
  .icon-stream span:nth-child(3) { top: 28px; width: 12px; opacity: .46; }

  .icon-map span { position: absolute; border: 1px solid var(--accent); }
  .icon-map span:nth-child(1) { inset: 9px 14px 14px 9px; transform: skewY(-13deg); }
  .icon-map span:nth-child(2) { width: 5px; height: 5px; border-radius: 50%; right: 8px; top: 8px; background: var(--accent); }
  .icon-map span:nth-child(3) { width: 13px; height: 1px; border: 0; background: var(--accent); right: 8px; bottom: 9px; opacity: .6; }

  .icon-factory span {
    position: absolute;
    bottom: 9px;
    width: 6px;
    border: 1px solid var(--accent);
    border-bottom: 0;
  }
  .icon-factory span:nth-child(1) { left: 9px; height: 12px; }
  .icon-factory span:nth-child(2) { left: 18px; height: 19px; }
  .icon-factory span:nth-child(3) { left: 27px; height: 26px; }

  .card-foot {
    padding-top: 10px;
    border-top: 1px solid rgba(226, 243, 247, .08);
    color: rgba(232, 244, 247, .38);
    font-size: 8px;
    letter-spacing: .12em;
  }
  .open-label {
    position: relative;
    padding-left: 14px;
    color: color-mix(in srgb, var(--accent) 77%, white 10%);
  }
  .open-label::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    width: 8px; height: 1px;
    background: currentColor;
    transform: translateY(-50%);
  }

  .hint {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 16px;
    color: rgba(234, 245, 247, .32);
    font-size: 8px;
    letter-spacing: .10em;
  }
  .hint span { margin-left: 5px; }
  kbd {
    min-width: 19px;
    height: 19px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(227, 244, 247, .15);
    color: rgba(231, 244, 246, .50);
    background: rgba(10, 18, 22, .38);
    font: 8px/1 Consolas, monospace;
  }

  .crosshair {
    width: 11px; height: 11px;
    display: inline-block;
    background:
      linear-gradient(90deg, transparent 45%, rgba(157, 236, 242, .65) 45% 55%, transparent 55%),
      linear-gradient(transparent 45%, rgba(157, 236, 242, .65) 45% 55%, transparent 55%);
  }

  .toast {
    position: fixed;
    z-index: 50;
    left: 50%;
    bottom: 66px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    padding: 12px 15px 12px 12px;
    border: 1px solid rgba(224, 244, 247, .20);
    background: rgba(5, 12, 15, .86);
    backdrop-filter: blur(16px);
    color: rgba(242, 249, 250, .82);
    font-size: 10px;
    letter-spacing: .08em;
    opacity: 0;
    transform: translate(-50%, 16px);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }
  .toast-bar { width: 2px; height: 20px; background: var(--cyan); box-shadow: 0 0 10px rgba(156,236,242,.5); }

  :focus-visible {
    outline: 1px solid var(--cyan-hot);
    outline-offset: 3px;
  }
}

@layer motion {
  .reveal {
    opacity: 0;
    transform: translateY(10px);
    animation: enter .85s cubic-bezier(.16, 1, .3, 1) forwards;
  }
  .reveal-delay-1 { animation-delay: .08s; }
  .reveal-delay-2 { animation-delay: .16s; }
  .reveal-delay-3 { animation-delay: .24s; }
  .reveal-delay-4 { animation-delay: .32s; }

  @keyframes enter {
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes pulse {
    0%, 100% { opacity: .55; transform: scale(.82); }
    50% { opacity: 1; transform: scale(1); }
  }
  @keyframes noise {
    0% { transform: translate3d(0,0,0); }
    25% { transform: translate3d(2%, -1%, 0); }
    50% { transform: translate3d(-1%, 2%, 0); }
    75% { transform: translate3d(1%, 1%, 0); }
    100% { transform: translate3d(-2%, -1%, 0); }
  }

  @media (max-width: 900px) {
    .background {
      background:
        linear-gradient(90deg,
          rgba(4, 10, 13, .94) 0%,
          rgba(4, 10, 13, .76) 42%,
          rgba(4, 10, 13, .16) 76%),
        linear-gradient(0deg,
          rgba(4, 10, 13, .78) 0%,
          rgba(4, 10, 13, .13) 48%),
        url("./bg.png") 58% 50% / cover no-repeat;
    }
    .shell { align-items: flex-end; padding-top: 110px; padding-bottom: 82px; }
    .hero { width: min(620px, 73vw); margin-top: 0; }
    .top-status { display: none; }
  }

  @media (max-width: 620px) {
    .topbar { height: 64px; }
    .brand-copy small { display: none; }
    .shell {
      padding: 92px 16px 76px;
      align-items: flex-end;
    }
    .hero { width: 100%; }
    .background {
      background:
        linear-gradient(0deg,
          rgba(4, 10, 13, .96) 0%,
          rgba(4, 10, 13, .88) 41%,
          rgba(4, 10, 13, .20) 70%,
          rgba(4, 10, 13, .05) 100%),
        linear-gradient(90deg, rgba(4,10,13,.20), transparent 80%),
        url("./bg.png") 58% 30% / auto 74vh no-repeat,
        #071014;
    }
    .hero { padding-top: 46vh; }
    .title-cn { font-size: clamp(38px, 12vw, 56px); }
    .lede br { display: none; }
    .tool-grid { margin-top: 24px; gap: 7px; }
    .tool-card { min-height: 110px; padding: 12px 13px 10px; }
    .card-body { grid-template-columns: 38px 1fr; gap: 12px; margin-block: 9px; }
    .icon { width: 36px; height: 36px; transform: scale(.9); transform-origin: left center; }
    .footer { min-height: 40px; padding-inline: 16px; }
    .footer > div:first-child span:last-child { display: none; }
    .micro-meta span:nth-child(3) { display: none; }
    .hint { display: none; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      scroll-behavior: auto !important;
      animation-duration: .001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .001ms !important;
    }
    .grain { animation: none; }
    .tool-card { transform: none !important; }
  }
}
