@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/playfair-800.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --page: #f7f7f2;
  --paper: #fff;
  --ink: #17231d;
  --muted: #587065;
  --line: #dde5df;
  --soft: #edf4ef;
  --shadow: 0 24px 70px -42px rgba(17, 42, 31, .42);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(circle at 8% 4%, color-mix(in srgb, var(--tool-color, #0d9488) 12%, transparent), transparent 26rem), var(--page);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select, input[type="range"] { cursor: pointer; }
a { color: inherit; text-underline-offset: 3px; }
.micro-wrap { width: min(1080px, calc(100% - 36px)); margin-inline: auto; }

.lab-header { position: relative; z-index: 5; border-bottom: 1px solid color-mix(in srgb, var(--line) 74%, transparent); background: color-mix(in srgb, var(--page) 90%, transparent); backdrop-filter: blur(14px); }
.header-row { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.lab-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.lab-brand img { border-radius: 50%; border: 1px solid var(--line); }
.lab-brand span { display: grid; line-height: 1.1; }
.lab-brand strong { font-family: "Playfair Display", Georgia, serif; font-size: 1.02rem; }
.lab-brand small { color: var(--muted); margin-top: 4px; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.lab-header nav, .lab-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.lab-header nav a, .lab-footer nav a { color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 700; }
.lab-header nav a:hover, .lab-footer nav a:hover { color: var(--tool-accent, #0d9488); }

.tool-hero { padding-block: 72px 44px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 48px; }
.crumb, .eyebrow { display: inline-block; margin-bottom: 16px; color: var(--tool-accent, #0d9488); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; text-decoration: none; }
h1, .directory-hero h1 { font-family: "Playfair Display", Georgia, serif; font-size: clamp(2.45rem, 7vw, 5.2rem); line-height: .98; letter-spacing: -.045em; margin: 0 0 22px; max-width: 850px; }
.tool-hero p, .directory-hero > p:last-child { max-width: 690px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.23rem); margin: 0; }
.tool-icon { width: clamp(96px, 15vw, 154px); height: auto; border-radius: 28%; box-shadow: var(--shadow); transform: rotate(3deg); }
.tool-stage { padding-bottom: 34px; }
.tool-card { min-height: 310px; padding: clamp(22px, 4vw, 42px); border: 1px solid var(--line); border-radius: 28px; background: color-mix(in srgb, var(--paper) 96%, var(--tool-color, #fff) 4%); box-shadow: var(--shadow); }
.loading { color: var(--muted); }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tool-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; align-content: start; }
.field.wide { grid-column: 1 / -1; }
.field label, label.field { color: var(--ink); font-size: .83rem; font-weight: 800; }
.field small, .helper { color: var(--muted); font-size: .79rem; }
input, select, textarea { width: 100%; border: 1px solid #cbd8d0; border-radius: 13px; background: #fff; color: var(--ink); padding: 12px 13px; outline: none; }
textarea { min-height: 130px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--tool-color, #0d9488); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tool-color, #0d9488) 16%, transparent); }
.primary-button, .secondary-button, .quiet-button, .choice-button { border: 0; border-radius: 13px; padding: 12px 18px; font-weight: 850; }
.primary-button { background: var(--tool-accent, #174b36); color: #fff; }
.primary-button:hover { filter: brightness(1.11); }
.secondary-button { background: color-mix(in srgb, var(--tool-color, #0d9488) 15%, #fff); color: var(--tool-accent, #174b36); }
.quiet-button { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 9px 13px; font-size: .82rem; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.tool-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 13px; }
.result { margin-top: 24px; padding: 20px; border-radius: 18px; background: color-mix(in srgb, var(--tool-color, #0d9488) 11%, #fff); border: 1px solid color-mix(in srgb, var(--tool-color, #0d9488) 28%, #fff); }
.result:empty { display: none; }
.result-label { margin: 0 0 5px; color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.result-value { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: clamp(1.65rem, 5vw, 2.8rem); line-height: 1.08; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.result-grid > div { padding: 14px; border-radius: 13px; background: rgba(255,255,255,.72); }
.result-grid strong { display: block; font-size: 1.25rem; }
.result-grid span { color: var(--muted); font-size: .78rem; }
.status { min-height: 1.5em; color: var(--muted); }
.notice { padding: 12px 14px; border-left: 4px solid var(--tool-color, #0d9488); background: var(--soft); color: var(--muted); font-size: .85rem; }

.timer-face { display: grid; place-items: center; gap: 8px; min-height: 210px; text-align: center; }
.timer-display { font-family: "Playfair Display", Georgia, serif; font-size: clamp(3.5rem, 15vw, 7rem); line-height: 1; font-variant-numeric: tabular-nums; }
.timer-stage { color: var(--muted); font-weight: 800; }
.progress { width: 100%; height: 13px; border-radius: 999px; overflow: hidden; background: #dce5df; }
.progress > span { display: block; width: 0; height: 100%; background: var(--tool-color, #0d9488); transition: width .25s linear; }
.big-signal { min-height: 230px; display: grid; place-items: center; border-radius: 22px; color: #fff; font-family: "Playfair Display", Georgia, serif; font-size: clamp(2.4rem, 9vw, 5rem); text-align: center; background: #16a34a; transition: background .15s ease; }
.camera-box { position: relative; overflow: hidden; border-radius: 18px; background: #101813; aspect-ratio: 4 / 3; }
.camera-box video, .camera-box canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.camera-crosshair { position: absolute; inset: 50% auto auto 50%; width: 34px; height: 34px; transform: translate(-50%,-50%); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #0005; pointer-events: none; }
.swatch { width: 66px; height: 66px; border-radius: 16px; border: 1px solid #0002; flex: none; }
.swatch-result { display: flex; align-items: center; gap: 16px; }
.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.choice-button { min-height: 62px; background: color-mix(in srgb, var(--tool-color, #0d9488) 15%, #fff); color: var(--tool-accent, #174b36); }
.choice-button:hover { transform: translateY(-2px); }
.bundle-circle { margin: 24px auto 4px; border: 6px solid var(--tool-color, #eab308); border-radius: 50%; max-width: 180px; max-height: 180px; background: repeating-linear-gradient(90deg, transparent 0 4px, #eab308 5px 7px, transparent 8px 11px); }
.planet-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.planet { padding: 15px; border-radius: 15px; background: rgba(255,255,255,.74); }
.planet strong { display: block; font-size: 1.12rem; }
.fortune-shape { width: min(300px, 80vw); aspect-ratio: 1; margin: 0 auto 24px; display: grid; place-items: center; transform: rotate(45deg); border-radius: 25%; background: conic-gradient(#f97316 0 25%, #06b6d4 0 50%, #ec4899 0 75%, #8b5cf6 0); box-shadow: inset 0 0 0 14px #fff9, var(--shadow); }
.fortune-shape span { transform: rotate(-45deg); width: 62%; text-align: center; color: white; font-weight: 900; text-shadow: 0 2px 8px #0005; }

.ad-slot { min-height: 90px; margin-top: 22px; border: 1px dashed var(--line); border-radius: 14px; }
.explanation { padding-block: 48px 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.explanation > div { padding: 22px; border-top: 4px solid color-mix(in srgb, var(--tool-color, #0d9488) 65%, #fff); background: rgba(255,255,255,.54); }
.explanation h2, .related h2 { margin: 0 0 10px; font-family: "Playfair Display", Georgia, serif; font-size: 1.25rem; }
.explanation p { margin: 0; color: var(--muted); }
.related { padding-block: 34px 60px; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.related-card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-decoration: none; font-weight: 800; }
.related-card:hover { border-color: var(--tool-color, #0d9488); }

.directory-main { padding-bottom: 72px; }
.directory-hero { padding-block: 88px 64px; }
.directory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.directory-card { display: flex; align-items: flex-start; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.82); box-shadow: 0 12px 35px -34px #0f2d20; }
.directory-card:hover { border-color: var(--card-color); transform: translateY(-2px); }
.directory-card img { width: 62px; height: 62px; border-radius: 16px; flex: none; }
.directory-card h2 { margin: 0 0 7px; font-family: "Playfair Display", Georgia, serif; font-size: 1.16rem; }
.directory-card h2 a { text-decoration: none; }
.directory-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.lab-footer { padding-block: 32px; background: #15251d; color: #b8c9c0; }
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.lab-footer p { margin: 0; }
.lab-footer a { color: inherit; }

@media (max-width: 760px) {
  .header-row { align-items: flex-start; padding-block: 16px; }
  .lab-header nav { gap: 12px; justify-content: flex-end; }
  .tool-hero { padding-block: 48px 30px; gap: 20px; }
  .tool-icon { width: 86px; }
  .tool-grid, .tool-grid.three, .explanation, .directory-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-row { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 480px) {
  .micro-wrap { width: min(100% - 24px, 1080px); }
  .lab-brand small { display: none; }
  .lab-header nav a:nth-child(2) { display: none; }
  .tool-hero { grid-template-columns: 1fr; }
  .tool-icon { order: -1; }
  .tool-card { border-radius: 20px; }
}

/* Individual microapps use an app-first shell; the directory above remains a website. */
.skip-link { position: fixed; z-index: 100; left: 12px; top: -80px; padding: 10px 14px; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 800; box-shadow: var(--shadow); }
.skip-link:focus { top: calc(10px + env(safe-area-inset-top)); }
.app-shell { min-height: 100dvh; background: linear-gradient(160deg, color-mix(in srgb, var(--tool-color) 11%, #f7faf8) 0, #f4f7f5 42%, #eef3ef 100%); }
.app-bar { position: sticky; z-index: 20; top: 0; padding-top: env(safe-area-inset-top); border-bottom: 1px solid color-mix(in srgb, var(--tool-color) 16%, var(--line)); background: color-mix(in srgb, #fff 91%, var(--tool-color) 9%); box-shadow: 0 8px 32px -28px #10271c; backdrop-filter: blur(18px); }
.app-bar-row { width: min(860px, calc(100% - 24px)); min-height: 68px; margin-inline: auto; display: grid; grid-template-columns: 40px 44px minmax(0, 1fr) auto; align-items: center; gap: 11px; }
.app-back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); text-decoration: none; font-size: 2rem; line-height: 1; }
.app-back:hover { background: color-mix(in srgb, var(--tool-color) 12%, #fff); }
.app-bar-icon { width: 44px; height: 44px; border-radius: 13px; box-shadow: 0 7px 18px -12px #000; }
.app-identity { min-width: 0; line-height: 1.15; }
.app-identity h1 { overflow: hidden; margin: 0; font: 850 1rem/1.15 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: -.015em; text-overflow: ellipsis; white-space: nowrap; }
.app-identity p { display: flex; align-items: center; gap: 6px; margin: 5px 0 0; color: var(--muted); font-size: .7rem; font-weight: 750; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px #16a34a1c; }
.app-shell.is-offline .online-dot { background: #d97706; box-shadow: 0 0 0 3px #d977061c; }
.app-bar-actions { display: flex; align-items: center; gap: 7px; }
.app-action { min-height: 38px; border: 0; border-radius: 12px; padding: 8px 13px; background: var(--tool-accent); color: #fff; font-size: .78rem; font-weight: 850; }
.app-action.icon-only { width: 38px; padding: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--tool-color) 16%, #fff); color: var(--tool-accent); font-size: 1.05rem; }
.app-action:hover { filter: brightness(1.08); }
.app-main { width: min(820px, 100%); min-height: calc(100dvh - 68px); margin-inline: auto; padding: 28px 18px 60px; }
.app-surface { overflow: hidden; border: 1px solid color-mix(in srgb, var(--tool-color) 15%, var(--line)); border-radius: 28px; background: #fff; box-shadow: 0 28px 70px -48px #153927; }
.app-lede { margin: 0; padding: 24px 28px 0; color: var(--muted); font-size: .94rem; }
.app-shell .tool-card { min-height: 390px; padding: 24px 28px 30px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.app-shell .result-value, .app-shell .timer-display { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 880; letter-spacing: -.04em; }
.app-shell .tool-actions { display: none; }
.app-info { margin-top: 14px; }
.app-info details { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.76); }
.app-info summary { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; cursor: pointer; color: var(--ink); font-size: .86rem; font-weight: 850; list-style: none; }
.app-info summary::-webkit-details-marker { display: none; }
.app-info summary span { color: var(--tool-accent); font-size: 1.1rem; transition: transform .2s ease; }
.app-info details[open] summary span { transform: rotate(45deg); }
.app-shell .explanation { width: auto; padding: 0 16px 16px; grid-template-columns: 1fr; gap: 8px; }
.app-shell .explanation > div { padding: 15px 16px; border-top-width: 2px; border-radius: 12px; background: #fff; }
.app-shell .explanation h2 { font: 850 .9rem/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.app-shell .explanation p { font-size: .83rem; }
.app-related { width: auto; padding: 30px 0 0; }
.app-related h2 { font: 850 .82rem/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.app-shell .related-card { box-shadow: 0 10px 30px -28px #000; font-size: .84rem; }
.app-footer { padding: 0 18px calc(28px + env(safe-area-inset-bottom)); color: var(--muted); text-align: center; font-size: .72rem; }
.app-footer p { margin: 5px 0; }
.app-footer p:first-child { display: flex; justify-content: center; gap: 9px; }
.app-footer a { color: inherit; text-decoration: none; font-weight: 750; }
.install-dialog { width: min(390px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 24px; color: var(--ink); box-shadow: 0 30px 90px -35px #000; }
.install-dialog::backdrop { background: #0d1f1685; backdrop-filter: blur(4px); }
.install-dialog form { position: relative; padding: 28px; text-align: center; }
.install-dialog img { border-radius: 20px; }
.install-dialog h2 { margin: 14px 0 8px; font-size: 1.3rem; }
.install-dialog p { margin: 0 0 20px; color: var(--muted); }
.dialog-close { position: absolute; right: 13px; top: 10px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--soft); color: var(--muted); font-size: 1.4rem; }
.pwa-toast { position: fixed; z-index: 40; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); margin: 0; padding: 11px 16px; border-radius: 999px; background: #17231d; color: #fff; box-shadow: var(--shadow); font-size: .78rem; font-weight: 750; opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: opacity .2s ease, transform .2s ease; }
.pwa-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .app-bar-row { grid-template-columns: 34px 40px minmax(0, 1fr) auto; min-height: 62px; gap: 8px; }
  .app-back { width: 34px; height: 38px; font-size: 1.8rem; }
  .app-bar-icon { width: 40px; height: 40px; border-radius: 12px; }
  .app-identity h1 { font-size: .9rem; }
  .app-identity p { margin-top: 3px; font-size: .64rem; }
  .app-action { min-height: 36px; padding-inline: 10px; }
  .app-action.icon-only { width: 36px; }
  .app-main { padding: 12px 10px 44px; }
  .app-surface { border-radius: 20px; }
  .app-lede { padding: 16px 17px 0; font-size: .84rem; }
  .app-shell .tool-card { min-height: calc(100dvh - 190px); padding: 18px 17px 22px; }
  .app-shell .related-grid { grid-template-columns: 1fr; }
}

@media (display-mode: standalone) {
  .app-related, .app-info, .app-footer { display: none; }
  .app-main { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .app-surface { min-height: calc(100dvh - 96px - env(safe-area-inset-top)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
