/* ============================================================
   junia lab(junia2009 の個人開発アプリ)
   色はダークが基本。明るい設定の端末では明るくする。
   動きは「視差効果を減らす」設定の人には出さない(いちばん下)。
   ============================================================ */
:root {
  --bg: #0b1020;
  --bg-2: #111832;
  --card: #151d3a;
  --card-hover: #1b2550;
  --line: rgba(255, 255, 255, 0.09);
  --text: #e8ecf8;
  --muted: #9aa6c8;
  --accent: #7dd3fc;
  --accent-2: #a78bfa;
  --btn: #f5c451;
  --btn-text: #1a1300;
  --chip: rgba(255, 255, 255, 0.06);
  --chip-on: #e8ecf8;
  --chip-on-text: #0b1020;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --orb-a: 0.38;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fc;
    --bg-2: #e9edf8;
    --card: #ffffff;
    --card-hover: #f8faff;
    --line: rgba(15, 23, 42, 0.1);
    --text: #111827;
    --muted: #5b6478;
    --accent: #0369a1;
    --accent-2: #6d28d9;
    --btn: #f2b630;
    --chip: rgba(15, 23, 42, 0.06);
    --chip-on: #111827;
    --chip-on-text: #ffffff;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --orb-a: 0.22;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; position: relative; overflow-x: hidden;
  background: var(--bg); color: var(--text);
  font-family: "M PLUS Rounded 1c", system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-weight: 500; line-height: 1.75;
}
a { color: var(--accent); }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; position: relative; z-index: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- 背景でゆっくり漂う光 ---- */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: var(--orb-a); will-change: transform; }
.o1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -16vmax; background: var(--accent-2); animation: drift1 22s ease-in-out infinite alternate; }
.o2 { width: 40vmax; height: 40vmax; right: -14vmax; top: 10vh; background: var(--accent); animation: drift2 26s ease-in-out infinite alternate; }
.o3 { width: 34vmax; height: 34vmax; left: 20vw; bottom: -20vmax; background: var(--c, #f5c451); opacity: calc(var(--orb-a) * 0.6); animation: drift3 30s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(14vw, 10vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-12vw, 18vh) scale(0.9); } }
@keyframes drift3 { to { transform: translate(-10vw, -14vh) scale(1.2); } }

/* ---- ボタン ---- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 9px 18px; border-radius: 12px; border: 0; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 14px; text-decoration: none;
  background: var(--btn); color: var(--btn-text);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px color-mix(in srgb, var(--btn) 40%, transparent); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn.big { padding: 13px 26px; font-size: 17px; border-radius: 14px; }
.btn.ghost { background: var(--chip); color: var(--text); border: 1px solid var(--line); }
/* きらっと光が走る */
.shine::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.55) 48%, transparent 66%);
  transform: translateX(-120%); animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
/* 押したときの波紋(main.js が .ripple を差し込む) */
.ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.55); transform: scale(0); animation: ripple 0.6s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.more { font: inherit; font-size: 14px; color: var(--muted); text-decoration: none; background: none; border: 0; border-bottom: 1px dashed currentColor; padding: 0; cursor: pointer; }
.more:hover { color: var(--text); }

/* ============================ トップ ============================ */
.hero { padding: calc(52px + env(safe-area-inset-top)) 0 30px; position: relative; z-index: 1; }
.eyebrow { margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: 0.1em; animation: fadeUp 0.6s 0.1s both; }
.title { margin: 4px 0 10px; font-size: clamp(40px, 9vw, 72px); line-height: 1.1; font-weight: 900; letter-spacing: 0.02em; }
.title span {
  display: inline-block; transform-origin: 50% 100%;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent) 60%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pop 0.7s calc(0.15s + var(--i) * 0.07s) cubic-bezier(.34, 1.56, .64, 1) both, bob 4s calc(1.5s + var(--i) * 0.2s) ease-in-out infinite;
}
@keyframes pop { from { opacity: 0; transform: translateY(40px) rotate(-12deg) scale(0.6); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
.ask { margin: 6px 0 10px; font-size: clamp(22px, 5.6vw, 34px); font-weight: 900; line-height: 1.35; animation: fadeUp 0.7s 0.6s both; }
.ask-q {
  color: var(--c); text-decoration: none;
  background: linear-gradient(transparent 70%, color-mix(in srgb, var(--c) 28%, transparent) 0);
  transition: color 0.3s;
}
.ask-q::after { content: ''; display: inline-block; width: 3px; height: 1em; margin-left: 3px; vertical-align: -0.12em; background: currentColor; border-radius: 2px; animation: caret 1s steps(1) infinite; }
.ask-q.typing::after { animation: none; }
.ask-q:hover { filter: brightness(1.15); }
@keyframes caret { 50% { opacity: 0; } }
/* 長い問いかけは2行になるので、狭い画面では2行分を取っておく(打ち直すたびに下が跳ねないように) */
@media (max-width: 600px) { .ask { min-height: 2.7em; } }
.lead { margin: 0; max-width: 42em; color: var(--muted); line-height: 1.8; animation: fadeUp 0.7s 0.8s both; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; animation: fadeUp 0.7s 0.9s both; }
.links a {
  padding: 6px 16px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); text-decoration: none; font-size: 14px; font-weight: 700; background: var(--chip);
  transition: transform 0.15s, border-color 0.15s;
}
.links a:hover { border-color: var(--accent); transform: translateY(-2px); }
.links .go { animation: nudge 2s 2s ease-in-out infinite; }
.links .install { padding: 6px 16px; border-radius: 999px; border: 0; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; background: var(--btn); color: var(--btn-text); }
.links .install[hidden] { display: none; }
@keyframes nudge { 50% { transform: translateY(3px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }

/* ---- イチオシ ---- */
.featured {
  display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 32px; align-items: center;
  margin: 8px 0 40px; padding: 22px; border: 1px solid var(--line); border-radius: 24px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, var(--card)), var(--bg-2));
  box-shadow: var(--shadow);
}
.feat-media { position: relative; }
.feat-media video, .feat-media img {
  display: block; width: 100%; aspect-ratio: 9 / 16; height: auto; object-fit: cover; border-radius: 22px; background: #000;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 6px #05070f;
  animation: float 6s ease-in-out infinite;
}
.feat-media img { aspect-ratio: 3 / 4; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-0.6deg); } }
.badge { display: inline-block; font-size: 13px; font-weight: 900; color: var(--btn-text); background: var(--btn); border-radius: 999px; padding: 3px 12px; animation: wiggle 3s ease-in-out infinite; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-6deg); } 90% { transform: rotate(5deg); } 95% { transform: rotate(-3deg); } }
.featured h2 { margin: 10px 0 2px; font-size: clamp(28px, 5vw, 40px); font-weight: 900; line-height: 1.2; }
.featured .catch { margin: 0 0 8px; font-weight: 800; font-size: 18px; color: var(--c); }
.featured p { margin: 0 0 16px; color: var(--muted); }
@media (max-width: 760px) {
  .featured { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .feat-media { width: min(260px, 70%); margin-inline: auto; }
}

/* ---- 絞り込み ---- */
.controls {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 0; margin-bottom: 4px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px);
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; padding: 2px 2px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--chip); color: var(--text);
  border-radius: 999px; padding: 6px 15px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform 0.2s cubic-bezier(.34, 1.56, .64, 1), background 0.2s, color 0.2s;
}
.chip:hover { transform: translateY(-2px); }
.chip small { color: var(--muted); margin-left: 5px; }
.chip[aria-selected="true"] { background: var(--chip-on); color: var(--chip-on-text); border-color: transparent; transform: scale(1.06); }
.chip[aria-selected="true"] small { color: inherit; opacity: 0.7; }
.search { flex: 1 1 220px; max-width: 320px; }
.search input {
  width: 100%; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-size: 15px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
@media (max-width: 640px) { .search { max-width: none; } }
.result { margin: 4px 0 14px; color: var(--muted); font-size: 14px; }

/* ---- カード ---- */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.card {
  --rx: 0deg; --ry: 0deg;
  display: flex; flex-direction: column; height: 100%;
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  background: var(--card); transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.25s ease, background 0.2s, box-shadow 0.25s, border-color 0.25s;
}
.card:hover { background: var(--card-hover); border-color: color-mix(in srgb, var(--c) 55%, transparent); box-shadow: 0 16px 36px color-mix(in srgb, var(--c) 22%, transparent); }
.card[hidden] { display: none; }
.thumb { position: relative; display: block; aspect-ratio: 3 / 4; background: var(--bg-2); overflow: hidden; }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease, opacity 0.4s ease; }
.thumb video { opacity: 0; }
.card.playing .thumb video { opacity: 1; }
.card:hover .thumb img { transform: scale(1.06); }
.marks { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 1; }
.mark { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.62); color: #fff; backdrop-filter: blur(4px); }
.mark.new { background: var(--btn); color: var(--btn-text); }
.mark.play { margin-left: auto; background: var(--c); color: #0b1020; }
.body { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px 14px; flex: 1; }
.cat { font-size: 12px; color: var(--muted); font-weight: 700; }
.card h3 { margin: 0; font-size: 17px; font-weight: 900; line-height: 1.35; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--c); }
.desc {
  margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: auto; padding-top: 8px; }
@media (max-width: 520px) {
  .body { padding: 10px 10px 12px; }
  .card h3 { font-size: 15px; }
  .desc { font-size: 12.5px; }
  .card .tags { display: none; }
  .card .btn { padding: 7px 12px; font-size: 13px; }
  .card .more { font-size: 12px; }
}
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

/* スクロールで現れる(main.js が .in を付ける) */
.js .reveal, .js .card { opacity: 0; translate: 0 28px; }
.js .reveal.in, .js .card.in { opacity: 1; translate: 0 0; transition: opacity 0.6s ease, translate 0.7s cubic-bezier(.22, 1, .36, 1), transform 0.25s ease, background 0.2s, box-shadow 0.25s, border-color 0.25s; transition-delay: calc(var(--d, 0) * 80ms); }

/* ============================ 個人ページ ============================ */
.crumbs { padding: calc(18px + env(safe-area-inset-top)) 0 0; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.app-hero { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 44px; align-items: center; padding: 26px 0 40px; }
.phone { position: relative; border-radius: 34px; padding: 9px; background: #05070f; box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), 0 0 60px color-mix(in srgb, var(--c) 30%, transparent); animation: float 6s ease-in-out infinite; }
.phone video, .phone img { display: block; width: 100%; aspect-ratio: 9 / 16; height: auto; object-fit: cover; border-radius: 26px; background: #000; }
.phone.still img { aspect-ratio: 3 / 4; }
.app-media { width: 100%; max-width: 340px; margin-inline: auto; }
.phone video { cursor: pointer; }
.chip-cat { display: inline-block; font-size: 13px; font-weight: 800; padding: 4px 12px; border-radius: 999px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.app-text h1 { margin: 12px 0 4px; font-size: clamp(32px, 6vw, 54px); line-height: 1.15; font-weight: 900; }
.app-text .catch { margin: 0 0 12px; font-size: clamp(18px, 2.6vw, 22px); font-weight: 900; color: var(--c); }
.app-text .lead { animation: none; color: var(--muted); max-width: 34em; margin-bottom: 18px; }
.app-text .actions { gap: 16px; }
.facts { list-style: none; padding: 0; margin: 26px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.facts li { padding: 10px 14px; border-radius: 14px; background: var(--chip); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.facts b { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.facts small { color: var(--muted); font-weight: 500; }
.rise { animation: fadeUp 0.7s calc(0.1s + var(--d, 0) * 0.08s) cubic-bezier(.22, 1, .36, 1) both; }
@media (max-width: 760px) {
  .app-hero { grid-template-columns: 1fr; gap: 26px; padding-top: 16px; }
  .app-media { max-width: 260px; }
}
.detail h2 { font-size: clamp(22px, 3.4vw, 28px); font-weight: 900; margin: 0 0 16px; }
.points { padding: 20px 0 30px; }
.points ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.points li { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.points .num { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 20px; color: #0b1020; background: var(--c); box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 45%, transparent); }
.points li.in .num { animation: boing 0.7s calc(var(--d) * 0.12s + 0.2s) cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes boing { from { transform: scale(0) rotate(-30deg); } }
.points p { margin: 0; font-weight: 800; }
.tech { padding: 10px 0 30px; }
.tags.big .tag { font-size: 14px; padding: 4px 12px; border-radius: 999px; }
.related { padding: 10px 0 0; }
.back { text-align: center; margin-top: 28px; }
.toast { max-width: calc(100% - 32px); text-align: center; position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 20; padding: 10px 18px; border-radius: 999px; background: var(--chip-on); color: var(--chip-on-text); font-weight: 800; font-size: 14px; animation: fadeUp 0.3s both; }

/* ---- 足もと ---- */
.fan { margin: 12px 0 0; font-size: 13px; color: var(--muted); animation: fadeUp 0.7s 0.9s both; }
.fan a { color: inherit; margin-left: 4px; white-space: nowrap; }
.about { margin-top: 56px; scroll-margin-top: 140px; padding: 22px 22px 14px; border: 1px dashed var(--line); border-radius: 20px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.about h2 { margin: 0 0 8px; font-size: 18px; }
.about p { margin: 0 0 8px; }
.about ul { margin: 0; padding-left: 1.2em; color: var(--muted); font-size: 14px; line-height: 1.8; }
.about strong { color: var(--text); }
.foot { position: relative; z-index: 1; margin-top: 64px; padding: 24px 0 calc(32px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot p { margin: 4px 0; }

/* 絞り込みの切り替えをなめらかに(対応ブラウザだけ) */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.25s; }

/* ---- 動きを控える設定の人には、動かさない ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js .reveal, .js .card { opacity: 1; translate: none; }
}
