/* Silk by Ghost Labs, LLC. Colors from the Silk icon: Night Navy, Deep Teal, Glow Silk (the web's mint light), Weaver
   Blue (the fur) and Cap Tan. Dark is the house look (the icon's own); light is for daylight use. */

:root {
  --navy: #0B1A33;
  --teal: #17484F;
  --silk: #6FE8C8;
  --weaver: #5F86A8;
  --tan: #D4A866;

  --bg: #0B1A33;
  --bg-2: #0F2340;
  --panel: #132B4A;
  --panel-2: #183559;
  --line: rgba(220, 240, 236, 0.13);
  --line-strong: rgba(220, 240, 236, 0.28);
  --text: #E9F3F2;
  --text-2: rgba(233, 243, 242, 0.76);
  --text-3: rgba(233, 243, 242, 0.58);
  --accent: #6FE8C8;        /* fills, rules, focus */
  --accent-text: #8DF0D6;   /* mint words on navy: 12.9 to 1 */
  --on-accent: #0B1A33;
  --warm: #D4A866;
  --bad: #F2A08F;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #EEF5F3;
    --bg-2: #E2EEEB;
    --panel: #FFFFFF;
    --panel-2: #F2F8F6;
    --line: rgba(11, 26, 51, 0.13);
    --line-strong: rgba(11, 26, 51, 0.28);
    --text: #0B1A33;
    --text-2: rgba(11, 26, 51, 0.78);
    --text-3: rgba(11, 26, 51, 0.62);
    --accent: #0B6B58;
    --accent-text: #0B6B58;   /* deep teal words and buttons on white: 6.5 to 1 */
    --on-accent: #FFFFFF;
    --warm: #8A5F1C;
    --bad: #9B2C1A;
    --shadow: 0 8px 24px rgba(11, 26, 51, 0.12);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #EEF5F3; --bg-2: #E2EEEB; --panel: #FFFFFF; --panel-2: #F2F8F6; --line: rgba(11, 26, 51, 0.13); --line-strong: rgba(11, 26, 51, 0.28);
  --text: #0B1A33; --text-2: rgba(11, 26, 51, 0.78); --text-3: rgba(11, 26, 51, 0.62); --accent: #0B6B58; --accent-text: #0B6B58; --on-accent: #FFFFFF;
  --warm: #8A5F1C; --bad: #9B2C1A; --shadow: 0 8px 24px rgba(11, 26, 51, 0.12); color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% -10%, var(--bg-2), var(--bg)) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-2); }
.small { font-size: 0.875rem; color: var(--text-3); }

/* ---------- the opening ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; cursor: pointer; text-align: center;
  background: radial-gradient(900px 600px at 50% 40%, #17484F, #0B1A33 70%);
  color: #E9F3F2; transition: opacity 0.6s ease, visibility 0.6s;
}
.splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-stage { position: relative; width: min(52vw, 300px); aspect-ratio: 1; margin: 8vh 0 3vh; }
.splash-web { position: absolute; inset: -42%; width: 184%; height: 184%; }
.splash-web .threads path {
  fill: none; stroke: #6FE8C8; stroke-width: 1.4; stroke-linecap: round; opacity: 0.55;
  stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: weave 1.8s ease-out forwards;
  filter: drop-shadow(0 0 4px rgba(111, 232, 200, 0.7));
}
.splash-web .threads path:nth-child(2) { animation-delay: 0.35s; }
.splash-web .threads path:nth-child(3) { animation-delay: 0.55s; }
.splash-web .threads path:nth-child(4) { animation-delay: 0.75s; }
@keyframes weave { to { stroke-dashoffset: 0; } }
.splash-art {
  position: absolute; inset: 0; border-radius: 22%; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(111, 232, 200, 0.25), 0 18px 60px rgba(0, 0, 0, 0.5), 0 0 60px rgba(111, 232, 200, 0.18);
  animation: drop 1.1s cubic-bezier(0.2, 1.4, 0.4, 1) 0.2s both;
}
.splash-art img { width: 100%; height: 100%; display: block; }
@keyframes drop { from { transform: translateY(-38%) scale(0.86); opacity: 0; } to { transform: none; opacity: 1; } }
.splash-motes i {
  position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #9FF5DE;
  box-shadow: 0 0 10px #6FE8C8; opacity: 0; animation: twinkle 2.4s ease-in-out infinite;
}
.splash-motes i:nth-child(1) { left: -8%; top: 18%; animation-delay: 0.6s; }
.splash-motes i:nth-child(2) { right: -6%; top: 10%; animation-delay: 1.1s; }
.splash-motes i:nth-child(3) { right: -10%; bottom: 22%; animation-delay: 1.5s; }
.splash-motes i:nth-child(4) { left: -12%; bottom: 12%; animation-delay: 0.9s; }
.splash-motes i:nth-child(5) { left: 46%; top: -12%; animation-delay: 1.8s; }
.splash-motes i:nth-child(6) { left: 30%; bottom: -10%; animation-delay: 2.1s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.6); } 50% { opacity: 0.9; transform: scale(1); } }
.splash-word { animation: rise 0.9s ease-out 0.9s both; }
.splash-name { font-weight: 800; letter-spacing: 0.32em; font-size: clamp(2rem, 7vw, 3.2rem); padding-left: 0.32em; text-shadow: 0 0 24px rgba(111, 232, 200, 0.35); }
.splash-sub { color: rgba(233, 243, 242, 0.78); letter-spacing: 0.04em; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.splash-continue {
  margin-top: 6px; padding: 10px 18px; border-radius: 999px; border: 1px solid rgba(111, 232, 200, 0.45);
  color: #8DF0D6; font-weight: 600; animation: rise 0.8s ease-out 1.5s both, pulse 2.4s ease-in-out 2.4s infinite;
}
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(111, 232, 200, 0); } 50% { box-shadow: 0 0 0 6px rgba(111, 232, 200, 0.12); } }
.splash-version { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); font-size: 0.8rem; color: rgba(233, 243, 242, 0.6); }
@media (prefers-reduced-motion: reduce) {
  .splash *, .splash { animation: none !important; transition: none !important; }
  .splash-web .threads path { stroke-dashoffset: 0; }
}

/* ---------- the app ---------- */
.app { max-width: 1080px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 32px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: 0.24em; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.btn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  font: inherit; font-weight: 600; padding: 9px 14px; border-radius: 10px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; z-index: 10; padding: 6px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow);
}
.menu-list button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.menu-list button:hover { background: var(--panel-2); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

.hero { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: center; padding: 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.hero img { width: 120px; height: 120px; border-radius: 24px; }
.hero h1 { margin: 0 0 4px; font-size: 1.5rem; }
.hero p { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.card { padding: 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.card h2 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0 0 10px; color: var(--text-2); }
.tag { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: var(--warm); border: 1px solid currentColor; }
.foot { margin-top: 26px; text-align: center; font-size: 0.85rem; color: var(--text-3); }
.foot a { color: var(--text-2); }

.center { min-height: 78vh; display: grid; place-items: center; }
.panel { width: min(100%, 460px); padding: 26px 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; }
.panel img.mark { width: 84px; height: 84px; border-radius: 20px; }
.panel h1 { margin: 10px 0 6px; font-size: 1.4rem; }
.check { display: flex; gap: 10px; align-items: flex-start; text-align: left; margin: 16px 0; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.error { color: var(--bad); }

dialog { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 22px; width: min(92vw, 420px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(5, 12, 26, 0.6); }
dialog h2 { margin-top: 0; }

/* ---------- sign-in page (served by the Worker) ---------- */
body.page { min-height: 100vh; }
main.signin { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 18px; }
.signin-card { width: min(100%, 420px); padding: 26px 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; }
.signin-mark { border-radius: 18px; }
.signin-card h1 { margin: 10px 0 4px; font-size: 1.35rem; }
.sso { display: grid; gap: 10px; margin: 18px 0 10px; }
.sso-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text); text-decoration: none; font-weight: 600; }
.sso-btn:hover { border-color: var(--accent); }
.sso-note { font-size: 0.85rem; color: var(--text-3); }
.legal { font-size: 0.82rem; color: var(--text-3); text-align: center; }
.legal a { color: var(--text-2); }

@media (max-width: 560px) {
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}
