@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/inter-700.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/geist-mono-600.woff2") format("woff2");
}

:root {
  --ink: #22282c;
  --muted: #5c6468;
  --bg: #eef2ea;
  --card: #ffffff;
  --line: #d4dbd3;
  --black: #161a18;
  --mark: #b8e6c8;
  --teal: #1c6e60;
  --teal-dark: #15574c;
  --green: #1c6e60;
  --green-dark: #15574c;
  --matrix: #b8e6c8;
  --danger: #8b0000;
  --radius: 14px;
  --tabs-h: 72px;
  font-size: 19px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
}
h1 { font-size: 1.7rem; line-height: 1.2; margin: .3rem 0 .4rem; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 .4rem; }
p { margin: 0 0 .8rem; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: .75rem;
  background: var(--black); color: var(--mark); padding: calc(.7rem + env(safe-area-inset-top)) 1rem .7rem;
  border-bottom: 1px solid #2a332e;
}
.logo { color: var(--mark); text-decoration: none; font: 600 1.15rem/1 "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.cursor { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

.app-nav { display: none; }
@media (min-width: 750px) {
  body { padding-bottom: 0; }
  html.boot-app .tabs,
  body.app-view .tabs { display: none; }
  .app-nav { display: flex; gap: .15rem; align-items: center; flex: 1; justify-content: center; }
  .app-nav a {
    color: #c5d0c8; text-decoration: none; font-size: .9rem; font-weight: 700;
    padding: .45rem .85rem; border-radius: 999px; white-space: nowrap;
  }
  .app-nav a:hover { color: #fff; }
  .app-nav a[aria-current=page] { color: var(--black); background: var(--mark); }
}

main { max-width: 720px; margin: 0 auto; padding: 1rem 1rem 2rem; }
main:focus, main:focus-visible { outline: none; }
.lead { color: var(--muted); font-size: 1.05rem; }
.note { color: var(--muted); font-size: .9rem; margin-top: 1rem; }
.empty { padding: 1.5rem 0; color: var(--muted); }
.empty-actions { margin-top: 1rem; max-width: 16rem; }

.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1rem; overflow: hidden; color: inherit; text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card-body { padding: 1rem; }
.cover { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; background: #e8eee6; }
.guide .cover { aspect-ratio: auto; max-height: 240px; width: 100%; object-fit: contain; object-position: top center; }
@media (min-width: 640px) {
  .card.guide { display: grid; grid-template-columns: 200px 1fr; align-items: stretch; }
  .guide .cover { max-height: none; height: 100%; min-height: 200px; object-fit: cover; object-position: top center; }
}
.badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; margin-bottom: .4rem; }
.badge.free { background: #dff5e4; color: var(--teal-dark); border: 1px solid #9fd8ae; }
.badge.ex { background: #fff4d6; color: #5b4300; border: 1px solid #e8cf86; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 52px; padding: .65rem 1.1rem;
  border-radius: 12px; border: 2px solid transparent; font-family: inherit; font-size: 1rem; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; text-align: center;
}
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.secondary { background: #fff; color: var(--teal-dark); border-color: var(--teal); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 44px; padding: .4rem .8rem; font-size: .9rem; }
.btn.ghost-dark { background: transparent; color: var(--mark); border-color: #4a6b58; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.stack { display: grid; gap: .6rem; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.top-align { align-items: flex-start; }
.grow { flex: 1; }

input[type=search], input:not([type]), textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: .75rem .9rem; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px #c9e8df; }
label { display: block; font-weight: 700; margin: .8rem 0 .3rem; }
.hint { font-weight: 400; color: var(--muted); }

.chips { display: flex; gap: .5rem; overflow-x: auto; padding: .8rem 0 .4rem; }
.chip { flex: none; min-height: 44px; padding: .4rem 1rem; border-radius: 999px; border: 2px solid var(--line); background: #fff; font: inherit; font-size: .95rem; cursor: pointer; color: var(--ink); }
.chip[aria-pressed=true] { background: var(--black); color: var(--mark); border-color: var(--black); }
.notice { display: flex; gap: .6rem; align-items: center; justify-content: space-between; background: #fff9e8; border: 1px solid #e8cf86; border-radius: 12px; padding: .6rem .8rem; margin: .6rem 0 1rem; }
.notice p { margin: 0; }
p.notice { display: block; }
.prompt { padding: 1rem; }
.ptext { white-space: pre-wrap; color: var(--ink); background: var(--bg); border-radius: 10px; padding: .7rem .8rem; font-size: .95rem; max-height: 12rem; overflow: auto; }
.tags { color: var(--teal-dark); font-size: .9rem; font-weight: 600; }
.tags span { margin-right: .4rem; }
.backup { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.grid .card { margin: 0; display: flex; flex-direction: column; }
.shop-item h2 { font-size: 1rem; }
.price { font-weight: 800; font-size: 1.15rem; margin: .2rem 0 .6rem; }
.price.free { color: var(--teal); }
.link { color: var(--teal); font-weight: 700; font-size: .9rem; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.owned { display: flex; gap: .2rem; align-items: flex-start; }
.thumb { width: 96px; height: auto; margin: 1rem 0 1rem 1rem; border-radius: 8px; background: var(--black); flex: none; }
.meta { color: var(--muted); font-size: .9rem; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--black); border-top: 1px solid #2a332e; padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tabs-h); color: #c9d3cb; text-decoration: none; font-size: .78rem; font-weight: 600; }
.tabs svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current=page] { color: var(--mark); background: #1d2420; }
.tabs a[aria-current=page] span { text-decoration: underline; text-underline-offset: 3px; }

dialog { width: min(640px, 94vw); max-height: 88dvh; overflow: auto; border: none; border-radius: var(--radius); padding: 1.1rem; }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { font-size: 1.4rem; }
dialog .row { margin-top: 1rem; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 1rem + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--black); color: #fff; padding: .8rem 1.1rem; border-radius: 12px; border: 1px solid var(--mark); transition: .2s; z-index: 20; max-width: 90vw; }
@media (min-width: 750px) {
  .toast { bottom: 1.5rem; }
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.center-msg { text-align: center; padding-top: 30vh; }
.copy-fallback { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }

.mg-banner{display:block;text-decoration:none;color:inherit;border:2px solid var(--teal);margin:0 0 16px}
.mg-banner .card-body{display:flex;flex-direction:column;gap:4px}
.mg-banner strong{font-size:1.1rem}
.shop-item h2 a{color:inherit;text-decoration:none}
.top-actions{display:flex;gap:8px;align-items:center}
.logo { white-space: nowrap; }
.top-actions .btn { white-space: nowrap; }

/* Landing */
html.boot-landing body, body.landing { padding-bottom: 0; background: #f6f4f0; }
html.boot-landing .tabs,
html.boot-landing #main,
html.boot-app #landing { display: none; }
body.landing { padding-bottom: 0; background: #f6f4f0; }
body.landing .tabs,
body.landing #main { display: none; }
body.app-view #landing { display: none; }

.hero {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.1rem 1.2rem .4rem;
  display: grid;
  gap: 1rem;
}
.hero-copy h1 { margin: 0 0 .4rem; font-size: 1.85rem; }
.hero-lead { color: var(--muted); margin: 0; }
.hero-media { min-width: 0; }
.haley-video { margin: 0; }
.haley-frame {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #1a1c1b;
  aspect-ratio: 16 / 9;
  box-shadow: 0 14px 40px rgba(34, 40, 44, .14);
}
.haley-frame img,
.haley-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ai-badge {
  position: absolute; top: .7rem; left: .7rem;
  background: rgba(22, 26, 24, .82); color: #fff;
  font-size: .7rem; font-weight: 700; letter-spacing: .03em;
  padding: .28rem .6rem; border-radius: 999px;
}
.haley-video figcaption { margin: .5rem 0 0; color: var(--muted); font-size: .88rem; }
.vid-btn {
  position: absolute; right: .7rem; bottom: .7rem;
  min-height: 40px; padding: .35rem .75rem;
  border: 0; border-radius: 999px;
  background: rgba(22, 26, 24, .82); color: #fff;
  font: 700 .8rem/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}
.hero-actions {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  max-width: 22rem;
}
.landing-about {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.6rem 1.2rem 3.2rem;
}
.landing-about ul { margin: 0 0 1.4rem; padding-left: 1.2rem; }
.landing-about li { margin: 0 0 .55rem; }
.landing-about-actions { max-width: 22rem; }
.install-tip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem 1rem;
  color: var(--ink);
  font-size: .95rem;
}
@media (min-width: 750px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    grid-template-areas:
      "copy media"
      "actions media";
    align-items: center;
    gap: 1.2rem 2.4rem;
    padding: 2.4rem 1.5rem 1.2rem;
  }
  .hero-copy { grid-area: copy; }
  .hero-media { grid-area: media; }
  .hero-actions { grid-area: actions; max-width: 20rem; }
  .hero-copy h1 { font-size: 2.15rem; }
}

#welcomeDialog { width: min(560px, 94vw); padding: 1.2rem; }
.welcome-sheet { display: grid; gap: .9rem; }
.welcome-sheet h2 { margin: 0; }
.welcome-sheet p { margin: 0; }
.welcome-sheet .btn { width: 100%; }

.section-label { font-size: .95rem; color: var(--muted); margin: 1.4rem 0 .6rem; }
.shop-cta { width: 100%; }

@media (max-width: 749px) {
  .top { gap: .5rem; }
  .logo { font-size: 1.05rem; }
  .top-actions .btn.small { min-height: 40px; padding: .3rem .65rem; font-size: .8rem; }
}
