@import url("https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap");
@import url("https://unpkg.com/normalize.css") layer(normalize);
@layer normalize, base, components, utilities, text-effect, snap, responsive;

@layer base {
  :root {
    --ink: #0f1111;
    --muted: #5c6366;
    --panel: #ffffff;
    --line: rgba(15, 17, 17, 0.12);
    --accent: #0f766e;
    --accent-warm: #c77d1d;
    --accent-red: #7FB3D5;
    --accent-green: #8592CF;
    --accent-teal: #9B8CCF;
    --accent-blue: #B387CC;
    --accent-purple: #C982C2;
    --accent-soft: #D580AD;
    --shadow: 0 20px 40px rgba(15, 17, 17, 0.12);
    --landing-shift-x: 2.5ch;
    --landing-shift-y: 2em;
    --landing-first-hero-height: 60vh;
    --landing-last-hero-height: 50vh;
    --landing-footer-gap: 20vh;
    --list-text-shift-x: 0ch;
    --account-offset-x: 150px;
    --account-offset-y: 18px;
    --account-font-size: 1.5rem;
    --account-icon-size: 28px;
    --list-color-1: oklch(65% 0.15 200);
    --list-color-2: oklch(65% 0.15 220);
    --list-color-3: oklch(65% 0.15 240);
    --list-color-4: oklch(65% 0.15 265);
    --list-color-5: oklch(65% 0.15 290);
    --list-color-6: oklch(65% 0.15 315);
  }

  html,
  body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
  }

  * {
    box-sizing: border-box;
  }

  body {
    margin: 0;
    font-family: "Geist", system-ui, sans-serif;
    color: var(--ink);
    background-color: #f7f6f2;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;

    --dot-color: rgba(0, 0, 0, 0.15);
    --spacing: 24px;
    --dot-size: 1.5px;

    background-image: radial-gradient(
      var(--dot-color) var(--dot-size),
      transparent var(--dot-size)
    );
    background-size: var(--spacing) var(--spacing);
    background-position: top left;
    background-repeat: repeat;

    mask-image: radial-gradient(circle at top left, #000 0%, transparent 75%);
    mask-size: 100% 100%;
    mask-repeat: no-repeat;
  }

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

  [hidden] {
    display: none !important;
  }

  button {
    font-family: inherit;
  }

  img {
    max-width: 100%;
    display: block;
  }

  h1,
  h2,
  h3 {
    margin: 0;
    font-weight: 700;
  }

  body.utility,
  body.vault {
    scroll-snap-type: none;
    scroll-behavior: auto;
  }

  html.landing,
  body.landing {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
  }
}

@layer components {
  .no-offset {
    margin: 0;
  }

  .container {
    width: 100%;
    max-width: 1024px;
    padding: 0 16px;
    margin: 0 auto;
  }

  .shell {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 120px 16px;
  }

  .utility .container,
  .vault .container {
    padding: 80px 16px 120px;
  }

  .hero {
    height: 100vh;
    display: flex;
    align-items: center;
  }

  .landing .hero {
    height: 100vh;
    align-items: center;
    padding-top: 0;
  }

  .landing main > .hero:last-of-type {
    height: var(--landing-last-hero-height);
  }

  .utility .hero,
  .vault .hero {
    height: auto;
    padding: 40px 0 20px;
    align-items: flex-start;
  }

  .hero-text {
    font-size: clamp(4rem, 8vw, 8rem);
    font-weight: 800;
  }

  .landing .hero-text {
    white-space: pre-line;
  }

  .hero-description {
    font-size: clamp(1rem, 3vw, 2rem);
    font-weight: 400;
    margin-top: 16px;
    color: var(--muted);
  }

  .landing .hero-description {
    color: var(--ink);
  }

  .landing main > .hero:first-of-type > div,
  .landing main > .hero:last-of-type > div,
  .landing main > .list-container {
    position: relative;
  }

  .landing main > .hero:first-of-type > div {
    left: calc(-1 * var(--landing-shift-x));
    top: calc(-1 * var(--landing-shift-y));
  }

  .landing .hero-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
  }

  .landing .hero-copy {
    max-width: 640px;
  }

  html[lang="ja"] .landing .hero-copy {
    max-width: 820px;
  }

  html[lang="ja"] .landing .hero-text {
    word-break: keep-all;
    overflow-wrap: normal;
  }

  html[lang="es"] .landing .hero-copy {
    max-width: 992px;
  }

  html[lang="es"] .landing .hero-text {
    font-size: clamp(3.5rem, 7vw, 6.75rem);
  }

  .landing .hero-row .account-ui {
    transform: translate(var(--account-offset-x), var(--account-offset-y));
  }

  .landing main > .hero:first-of-type {
    height: var(--landing-first-hero-height);
  }

  .landing main > .list-container {
    left: calc(-1 * var(--landing-shift-x));
  }

  .landing main > .hero:first-of-type,
  .landing main > .hero:last-of-type {
    scroll-snap-align: start;
  }

  .landing main > .hero:last-of-type > div {
    left: calc(-1 * var(--landing-shift-x));
  }

  .scan-header h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 12px;
  }

  .list-text {
    font-size: clamp(2.5rem, 6vw, 6rem);
    font-weight: 600;
    position: sticky;
    top: calc(50% - 0.5lh);
    align-self: flex-start;
    min-width: max-content;
    transform: translateX(var(--list-text-shift-x));
  }

  .list {
    font-size: clamp(2.5rem, 6vw, 6rem);
    font-weight: 600;
    list-style-type: none;
    padding: 0;
  }

  .list li {
    line-height: 1.25;
    cursor: default;
  }

  .list li.is-active {
    cursor: pointer;
  }

  .list-container {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 48px;
  }

  .topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    position: sticky;
    top: 0;
    background: rgba(247, 246, 242, 0.85);
    backdrop-filter: blur(12px);
    z-index: 20;
  }

  .account-ui {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: var(--account-font-size);
    font-weight: 600;
    color: var(--ink);
  }

  .account-ui[hidden] {
    display: none;
  }

  .account-name {
    font-size: inherit;
    font-weight: 600;
  }

  .account-icon {
    width: var(--account-icon-size);
    height: auto;
    /* 新增下面這兩行來解決模糊 */
    image-rendering: -webkit-optimize-contrast;
    transform: translateZ(0);
    shape-rendering: geometricPrecision;
  }

  .back-link {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
  }

  .card,
  .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 28px;
  }

  .scan-card {
    max-width: 760px;
    margin: 0 auto;
  }

  .upload-form {
    display: grid;
    gap: 18px;
  }

  .field {
    display: grid;
    gap: 8px;
  }

  .label {
    font-weight: 600;
  }

  .text-input {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font-size: 1rem;
  }

  .dropzone {
    border: 2px dashed rgba(15, 17, 17, 0.2);
    border-radius: 18px;
    padding: 24px;
    display: grid;
    gap: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.7);
  }

  .dropzone.is-dragover {
    border-color: var(--ink);
    background: rgba(15, 17, 17, 0.06);
  }

  .dropzone input {
    display: none;
  }

  .file-name {
    color: var(--muted);
    font-family: "Geist", system-ui, sans-serif;
  }

  .expiry-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
  }

  .expiry-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
  }

  .expiry-toggle input {
    width: 16px;
    height: 16px;
  }

  .expiry-inputs {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    transition: box-shadow 0.2s ease;
  }

  .expiry-inputs:focus-within {
    box-shadow: 0 0 0 2px rgba(15, 17, 17, 0.15);
  }

  .expiry-inputs.is-permanent {
    display: none;
  }

  .expiry-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .expiry-field input {
    width: 64px;
    border: 0;
    background: transparent;
    outline: none;
    text-align: right;
    font-family: "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
      monospace;
    font-variant-numeric: tabular-nums;
  }

  .expiry-extra {
    display: inline-flex;
    gap: 10px;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.25s ease, opacity 0.2s ease;
  }

  .expiry-inputs.is-expanded .expiry-extra {
    max-width: 200px;
    opacity: 1;
  }

  .expiry-hint {
    margin: 0;
    font-size: 0.85rem;
  }

  .primary-btn {
    background: var(--ink);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 14px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 17, 17, 0.2);
  }

  .ghost-btn {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
  }

  .select-toggle {
    border-radius: 14px;
    padding: 10px 20px;
    min-width: 110px;
  }

  .select-toggle.is-active {
    border-color: var(--ink);
    box-shadow: 0 0 0 2px var(--ink);
  }

  .result {
    margin-top: 28px;
  }

  .result-card {
    display: grid;
    gap: 16px;
    align-items: center;
    text-align: center;
  }

  .result-card img {
    width: min(320px, 80vw);
    margin: 0 auto;
  }

  .link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }

  .link-row input {
    flex: 1;
    min-width: 240px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
  }

  .form-grid {
    display: grid;
    gap: 16px;
  }

  .field {
    display: grid;
    gap: 8px;
  }

  .field input,
  .field select,
  #access-form input {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font-size: 1rem;
  }

  .status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(15, 17, 17, 0.08);
    font-size: 0.9rem;
    color: var(--muted);
  }

  .spinner {
    display: flex;
    gap: 6px;
  }

  .spinner span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ink);
    opacity: 0.2;
    animation: pulse 1.2s infinite;
  }

  .spinner span:nth-child(2) {
    animation-delay: 0.2s;
  }

  .spinner span:nth-child(3) {
    animation-delay: 0.4s;
  }

  .approved,
  .denied,
  .waiting {
    margin-top: 24px;
    display: grid;
    gap: 12px;
  }

  .zip-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
  }

  .meta {
    color: var(--muted);
  }

  .hint {
    color: var(--muted);
    font-size: 0.9rem;
  }

  .modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 17, 0.35);
    display: grid;
    place-items: center;
    z-index: 50;
  }

  .modal[hidden] {
    display: none;
  }

  .modal-card {
    background: var(--panel);
    border-radius: 22px;
    border: 1px solid var(--line);
    padding: 28px;
    width: min(420px, 90vw);
    display: grid;
    gap: 14px;
    box-shadow: var(--shadow);
  }

  .modal-message {
    white-space: pre-line;
  }

  .modal-card input {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
  }

  .modal-actions {
    display: flex;
    justify-content: flex-end;
  }

  .vault-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    min-height: 70vh;
    margin-bottom: 80px;
  }

  .vault-slot {
    background: linear-gradient(145deg, #f5f4ee, #ffffff);
    border: 1px solid rgba(15, 17, 17, 0.15);
    border-radius: 16px;
    min-height: 110px;
    display: flex;
    align-items: flex-end;
    padding: 14px;
    position: relative;
    box-shadow: inset 0 0 0 2px rgba(15, 17, 17, 0.04);
  }

  .vault-slot.is-filled {
    cursor: pointer;
  }

  .selection-mode .vault-slot.is-filled {
    cursor: pointer;
  }

  .vault-slot.is-selected {
    border-color: var(--ink);
    box-shadow: inset 0 0 0 2px rgba(15, 17, 17, 0.12), 0 0 0 2px var(--ink);
  }

  .vault-slot::before {
    content: "";
    position: absolute;
    top: 12px;
    left: 14px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(15, 17, 17, 0.2);
  }

  .countdown {
    font-family: "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
      monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    letter-spacing: 0.02em;
  }

  .vault-timer {
    position: absolute;
    top: 12px;
    left: 44px;
    color: #000;
    font-size: 0.85rem;
    min-width: 8ch;
  }

  .vault-timer.is-permanent {
    color: #000;
  }

  .scan-countdown {
    margin-top: 10px;
    font-size: 0.95rem;
    color: var(--ink);
  }

  .vault-label {
    font-size: 0.95rem;
    font-weight: 600;
  }

  .language-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
  }

  .language-btn {
    border: 1px solid var(--line);
    background: transparent;
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
  }

  .language-btn.is-active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
  }

  .lang-picker {
    display: none !important;
  }
}

@layer utilities {
  .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0 0 10px;
  }

  .subtitle,
  .small {
    color: var(--muted);
  }

  .muted {
    color: var(--muted);
  }

  .error-msg {
    color: #b9473b;
    font-weight: 600;
  }

  .is-error {
    border-color: #b9473b;
  }
}

@layer text-effect {
  :root {
    --count: 6;
    --end: 360;
    --step: calc(var(--end) / var(--count));
  }

  .list li:nth-child(1) {
    color: var(--list-color-1);
  }

  .list li:nth-child(2) {
    color: var(--list-color-2);
  }

  .list li:nth-child(3) {
    color: var(--list-color-3);
  }

  .list li:nth-child(4) {
    color: var(--list-color-4);
  }

  .list li:nth-child(5) {
    color: var(--list-color-5);
  }

  .list li:nth-child(6) {
    color: var(--list-color-6);
  }

  @supports (animation-timeline: scroll()) and (animation-range: 0% 100%) {
    .list li:first-of-type {
      --start-opacity: 1;
    }

    .list li:last-of-type {
      --end-opacity: 1;
    }

    .list li {
      opacity: 0.2;
      animation-name: brighten;
      animation-fill-mode: both;
      animation-timing-function: linear;

      animation-timeline: view();
      animation-range: cover calc(50% - 1lh) calc(50% + 1lh);
    }

    @keyframes brighten {
      0% {
        opacity: var(--start-opacity, 0.2);
      }

      50% {
        opacity: 1;
      }

      100% {
        opacity: var(--end-opacity, 0.2);
      }
    }
  }
}

@layer snap {
  html,
  body {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
  }

  .list li {
    scroll-snap-align: center;
  }

  html.landing .list li,
  body.landing .list li {
    scroll-snap-align: center;
  }
}

@layer responsive {
  @media (max-width: 600px) {
    .list-container {
      column-gap: 12px;
    }
  }
}

.landing footer {
  text-align: center;
  margin-top: var(--landing-footer-gap);
  padding-bottom: 24px;
  scroll-snap-align: end;
  scroll-snap-stop: normal;
}

.landing .footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-contact {
  margin: 0;
}

.security-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.security-link:hover,
.security-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.security-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 17, 17, 0.25);
}

.security-modal[hidden] {
  display: none;
}

.security-card {
  position: relative;
  width: min(720px, 100%);
  padding: 28px 28px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  max-height: min(80vh, 860px);
  overflow: auto;
}

.security-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: none;
  font-size: 1.4rem;
  color: var(--muted);
  cursor: pointer;
}

.security-title {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
}

.security-content {
  display: grid;
  gap: 16px;
}

.security-block {
  display: grid;
  gap: 6px;
  padding: 2px 0;
}

.security-subtitle {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}

.security-text {
  margin: 0;
  line-height: 1.55;
  color: var(--ink);
}

.security-text + .security-text {
  margin-top: 2px;
}

.security-tagline {
  margin: 0;
  color: #000;
}

body.modal-open {
  overflow: hidden;
}

body.demo-active * {
  pointer-events: none;
}

body.demo-active .demo-allow,
body.demo-active .demo-allow * {
  pointer-events: auto;
}

body.demo-darken::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(15, 17, 17, 0.68);
  pointer-events: none;
}

.demo-focus {
  position: relative;
  z-index: 1002;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(15, 17, 17, 0.7);
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 6px;
  opacity: 1;
  filter: saturate(1.05) brightness(1.02);
  background: rgba(247, 246, 242, 0.95);
}

.demo-focus.demo-force-ink {
  color: #000;
  background: #fff;
  border-color: #000;
}

.demo-focus.demo-force-ink * {
  color: #000 !important;
}

.demo-hint {
  position: fixed;
  z-index: 1004;
  max-width: min(320px, 78vw);
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.demo-hint[hidden] {
  display: none;
}

.demo-hint-text {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: pre-line;
  color: var(--ink);
}

.demo-login-actions {
  display: grid;
  gap: 8px;
}

.demo-provider {
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(15, 17, 17, 0.06);
}

.demo-continue {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.demo-continue:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 17, 17, 0.2);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.8;
  }
}
