/* ==========================================================================
   Kotsukotsu Nihongo: the homepage, second edition (2026-11-11).
   Loaded after style.css on index.html only, so privacy, delete-account and 404
   keep their styling, and the goodnight broadcast keeps exactly the look the
   owner chose. Everything here is the night-mountain spine taken further: real
   app screens in phones, the story as painted scenes, things you can try.
   ========================================================================== */

:root {
  --ember: #f59e0b;
  --gold: #e8c66a;
  --blue: #4f8ef7;
  --phone-edge: #1a2233;
}

/* --- Shared: a phone with a real screen ---------------------------------- */
.rphone {
  position: relative;
  width: min(15rem, 62vw);
  aspect-ratio: 720 / 1600;
  border-radius: 2.4rem;
  padding: 0.45rem;
  background: linear-gradient(160deg, #2a3446, #0d1320 60%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 40px 80px -30px rgba(0, 0, 0, 0.95), 0 0 60px -10px rgba(14, 165, 233, 0.18);
}
.rphone img { width: 100%; height: 100%; object-fit: cover; border-radius: 2rem; }
.rphone.tilt-l { transform: rotate(-4deg); }
.rphone.tilt-r { transform: rotate(4deg); }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* --- Breathing: slow ambient motion so the page feels alive, never busy ---- */
.hero-bg { animation: breathe 32s ease-in-out infinite alternate; transform-origin: 60% 40%; }
@keyframes breathe { from { transform: scale(1.02); } to { transform: scale(1.1) translate(-1%, -1%); } }
.phones .rphone { animation: bob 8s ease-in-out infinite; }
.phones .rphone:nth-child(2) { animation-delay: -4s; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }

/* --- Hero: a real phone beside the words on wide screens ------------------ */
.hero-title { text-wrap: balance; }
.hero-phone { display: none; }
@media (min-width: 1000px) {
  .hero-phone {
    display: block;
    position: absolute;
    right: max(2rem, calc((100vw - 1060px) / 2));
    bottom: clamp(3rem, 9vh, 6rem);
    width: 15.5rem;
    z-index: 2;
    animation: float 7s ease-in-out infinite;
  }
  .hero-inner { padding-right: 20rem; }
}
@keyframes float { 0%, 100% { transform: translateY(0) rotate(2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }

/* --- The numbers ---------------------------------------------------------- */
.stats { padding: 0 1.25rem; margin-top: -1px; background: linear-gradient(180deg, rgba(5, 10, 20, 0) , var(--night) 40%); }
.stats ul {
  max-width: 1060px; margin: 0 auto; padding: 1.4rem 0.5rem; list-style: none;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem 0.8rem;
  border-top: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border);
}
@media (min-width: 820px) { .stats ul { grid-template-columns: repeat(6, 1fr); } }
.stats li { text-align: center; }
.stats b { display: block; font-family: var(--display); font-weight: 700; font-size: clamp(1.6rem, 4vw, 2.2rem); color: var(--ink); line-height: 1.1; }
.stats span { font-size: 0.82rem; color: var(--ink-dim); }

/* --- Two-column blocks: words on one side, phones on the other ------------- */
.split { display: grid; gap: 2.6rem; align-items: center; }
@media (min-width: 900px) {
  .split { grid-template-columns: 1.05fr 0.95fr; gap: 3.5rem; }
  .split.flip > :first-child { order: 2; }
}
.phones { display: flex; justify-content: center; gap: 1.2rem; }
.phones .rphone { width: min(13.5rem, 44vw); }
.phones .rphone:nth-child(2) { margin-top: 3rem; }

/* --- The story: painted scenes you swipe through --------------------------- */
.reel-wrap { position: relative; margin-top: 2rem; }
.reel {
  display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  padding: 0.5rem max(1.25rem, calc((100vw - 1060px) / 2)) 1.5rem; margin: 0 -1.25rem;
  overscroll-behavior-x: contain;
}
.reel::-webkit-scrollbar { display: none; }
.scene {
  flex: 0 0 min(78vw, 25rem); scroll-snap-align: center; margin: 0; border-radius: 1.2rem; overflow: hidden;
  background: #0b1222; border: 1px solid var(--card-border); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9);
}
.scene img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; transition: transform 6s ease-out; }
.scene:hover img { transform: scale(1.04); }
.scene figcaption { padding: 0.9rem 1.1rem 1.1rem; color: var(--ink-dim); font-size: 0.92rem; }
.scene figcaption strong { display: block; color: var(--ink); font-family: var(--display); font-size: 1.08rem; font-weight: 600; margin-bottom: 0.1rem; }
/* Arrows under each sideways row, at every width: a click is the visitor taking over */
.reel-nav { display: flex; gap: 0.6rem; justify-content: flex-end; max-width: 1060px; margin: 0 auto; }
.reel-wrap .reel-nav { padding: 0 0.1rem; }
.reel-nav button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--card-border); background: var(--card);
  color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0 0 0.12em;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.reel-nav button:hover { border-color: var(--accent); }
.reel-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.reel-nav button:active { background: var(--accent-soft); }
.looks-nav { margin-top: 0.1rem; }
.story-note { color: var(--ink-dim); font-size: 0.9rem; max-width: 1060px; margin: 0.4rem auto 0; }

/* --- Try it: pitch karaoke, the brush, the stamps -------------------------- */
.demo { border-radius: 1.6rem; overflow: hidden; border: 1px solid var(--card-border);
        background: linear-gradient(180deg, rgba(14, 165, 233, 0.06), rgba(255, 255, 255, 0.02)); }
.tabs { display: flex; gap: 0.5rem; padding: 1.1rem 1.2rem 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; min-height: 44px; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--card-border);
  background: rgba(5, 10, 20, 0.6); color: var(--ink-dim); font: 600 0.92rem var(--body); cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--accent); color: #031019; border-color: transparent; }
.panel { padding: 1.2rem; }
.panel[hidden] { display: none; }
.panel-grid { display: grid; gap: 1.4rem; align-items: center; }
@media (min-width: 900px) { .panel-grid { grid-template-columns: 1fr 13rem; gap: 2rem; } .panel { padding: 1.6rem 2rem 2rem; } }
.panel .rphone { width: 12.5rem; margin: 0 auto; }
.stage { position: relative; border-radius: 1.1rem; overflow: hidden; min-height: 300px; }
.panel-note { color: var(--ink-dim); font-size: 0.95rem; margin-top: 0.9rem; }
.panel-note strong { color: var(--ink); }

.karaoke {
  background: radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 20%, #fff, transparent),
              radial-gradient(1.5px 1.5px at 85% 60%, #cfe3ff, transparent), radial-gradient(1px 1px at 40% 75%, #fff, transparent),
              radial-gradient(60% 70% at 50% 110%, rgba(79, 142, 247, 0.35), transparent 70%), linear-gradient(180deg, #060b1a, #14234a);
  display: grid; place-items: center; padding: 1.6rem 1rem; text-align: center;
}
.k-words { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.k-words button {
  min-height: 44px; min-width: 6.5rem; padding: 0.25rem 0.9rem; border-radius: 0.9rem; border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(5, 10, 20, 0.55); color: var(--ink); cursor: pointer; font: inherit;
}
.k-words button b { display: block; font-size: 1.25rem; font-family: var(--jp); }
.k-words button span { font-size: 0.75rem; color: var(--ink-dim); }
.k-words button[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 198, 106, 0.25); }
.k-graph { width: min(100%, 340px); height: auto; margin: 0 auto 0.6rem; display: block; }
.k-line { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.k-dot { r: 7; fill: #0b1427; stroke-width: 3; }
.playing .k-line { animation: draw 1.6s ease forwards; }
.k-mora { display: flex; gap: 0.6rem; justify-content: center; }
.k-mora span {
  width: 4rem; height: 4rem; border-radius: 1rem; display: grid; place-items: center; font-size: 1.9rem; color: rgba(255, 255, 255, 0.45);
  background: rgba(5, 10, 20, 0.55); border: 1px solid rgba(255, 255, 255, 0.14); font-family: var(--jp); transition: all 0.25s ease;
}
.k-mora span.lit.hi { color: #231206; background: var(--gold); box-shadow: 0 0 26px rgba(232, 198, 106, 0.7); transform: translateY(-6px); }
.k-mora span.lit.lo { color: #fff; background: var(--blue); box-shadow: 0 0 26px rgba(79, 142, 247, 0.6); transform: translateY(6px); }
.k-legend { margin-top: 0.9rem; font-size: 0.8rem; color: var(--ink-dim); }
.k-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: -1px; }

.scroll { background: #f2ead8 radial-gradient(120% 90% at 50% 40%, #fbf6ea 0%, #ece0c6 100%); display: grid; place-items: center; padding: 1.8rem 0.8rem; }
.scroll::before, .scroll::after { content: ""; position: absolute; left: 0; right: 0; height: 18px; background: linear-gradient(180deg, #3b2a1e, #6b4c34 50%, #3b2a1e); }
.scroll::before { top: 0; } .scroll::after { bottom: 0; }
.brush { width: min(100%, 520px); height: auto; }
.brush path { fill: none; stroke: #1d1712; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.writing .brush path { animation: draw 0.7s cubic-bezier(.45, .05, .4, 1) forwards; }
.brush-cap { position: absolute; left: 0; right: 0; bottom: 1.9rem; text-align: center; color: #6b4c34; font-size: 0.88rem; font-weight: 600; }

.stamp-stage { background: radial-gradient(80% 80% at 50% 40%, rgba(245, 158, 11, 0.16), transparent 70%), #0d1730; display: grid; place-items: center; padding: 1.6rem 1rem; }
.stamps { display: grid; grid-template-columns: repeat(3, minmax(0, 6.5rem)); gap: 0.8rem; }
@media (min-width: 600px) { .stamps { grid-template-columns: repeat(6, minmax(0, 6rem)); } }
.stamps img { width: 100%; height: auto; filter: sepia(1) brightness(1.6) contrast(0.4); opacity: 0.25; transform: scale(0.94); }
.burning .stamps img { animation: burn 1.1s ease forwards; }
@keyframes burn { 60% { filter: sepia(0.6) brightness(1.3) drop-shadow(0 0 14px rgba(245, 158, 11, 0.9)); opacity: 1; } to { filter: none; opacity: 1; transform: none; } }

.replay {
  margin-top: 0.9rem; min-height: 40px; padding: 0 0.9rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 14, 30, 0.5); color: var(--ink); font: 600 0.85rem var(--body); cursor: pointer;
}
.scroll .replay { position: absolute; top: 1.7rem; right: 0.8rem; margin: 0; color: #3b2a1e; border-color: rgba(59, 42, 30, 0.3); background: rgba(255, 255, 255, 0.45); }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* --- Mio on your home screen: the widget ----------------------------------- */
.widget-demo { display: grid; gap: 2.4rem; align-items: center; margin-top: 3.5rem; }
@media (min-width: 900px) { .widget-demo { grid-template-columns: 19rem 1fr; gap: 3.5rem; } }
.homescreen {
  position: relative; width: min(19rem, 86vw); aspect-ratio: 9 / 18; margin: 0 auto; border-radius: 2.4rem; padding: 0.45rem;
  background: linear-gradient(160deg, #2a3446, #0d1320 60%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 40px 80px -30px rgba(0, 0, 0, 0.95);
}
/* A HOME screen, not a lock screen: status bar, app rows, the widget, a dock */
.homescreen-inner {
  position: relative; height: 100%; border-radius: 2rem; overflow: hidden; padding: 0.55rem 0.9rem 0.7rem;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(5, 10, 20, 0.15), rgba(5, 10, 20, 0.55)), url("../assets/img/sky-sunset.jpg") center / cover;
}
.hs-status {
  display: flex; justify-content: space-between; align-items: center; padding: 0 0.35rem; margin-bottom: 1.1rem;
  color: #fff; font: 600 0.72rem var(--body); letter-spacing: 0.02em; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}
.hs-glyphs { display: flex; align-items: center; gap: 0.32rem; }
.hs-glyphs i { display: block; background: #fff; }
.g-sig { width: 11px; height: 9px; clip-path: polygon(100% 0, 100% 100%, 0 100%); border-radius: 1px; }
.g-wifi { width: 12px; height: 12px; border-radius: 12px 0 0 0; transform: rotate(45deg) translate(2px, 2px); clip-path: polygon(0 0, 100% 0, 0 100%); }
.g-bat { width: 18px; height: 9px; border-radius: 2.5px; background: transparent !important; border: 1.5px solid #fff; position: relative; }
.g-bat::before { content: ""; position: absolute; inset: 1px; right: 4px; border-radius: 1px; background: #fff; }
.g-bat::after { content: ""; position: absolute; right: -4px; top: 2px; width: 2px; height: 3px; border-radius: 0 1px 1px 0; background: #fff; }
.hs-apps + .mio-widget { margin-top: 1rem; }
.mio-widget + .hs-apps { margin-top: 1rem; }
.hs-search {
  margin: auto 0.2rem 0.7rem; height: 1.6rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.24); backdrop-filter: blur(8px);
}
.hs-dock {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; padding: 0.5rem; border-radius: 1.3rem;
  background: rgba(255, 255, 255, 0.16); backdrop-filter: blur(10px);
}
.hs-dock i { aspect-ratio: 1; border-radius: 0.85rem; background: rgba(255, 255, 255, 0.3); }
.mio-widget {
  display: grid; grid-template-columns: 7.2rem 1fr; gap: 0.6rem; align-items: center; padding: 0.55rem; border-radius: 1.3rem;
  background: #fbf7ef; color: #1d2433; box-shadow: 0 18px 30px -16px rgba(0, 0, 0, 0.7);
}
.mio-widget .pose { position: relative; aspect-ratio: 1; border-radius: 0.9rem; overflow: hidden; background: #fff; }
.mio-widget .pose img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity 0.35s ease; }
.mio-widget .mood { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; color: #b45309; }
.mio-widget .streak { font-family: var(--display); font-size: 1.15rem; font-weight: 700; margin: 0.15rem 0; }
.mio-widget .line { font-size: 0.72rem; color: #4b5563; line-height: 1.35; }
.hs-apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem 0.6rem; padding: 0 0.5rem; }
.hs-apps i { aspect-ratio: 1; border-radius: 0.9rem; background: rgba(255, 255, 255, 0.22); backdrop-filter: blur(6px); }
.moments { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0 0.4rem; }
.moments button {
  min-height: 44px; padding: 0 0.95rem; border-radius: 999px; border: 1px solid var(--card-border); background: var(--card);
  color: var(--ink-dim); font: 500 0.9rem var(--body); cursor: pointer;
}
.moments button[aria-pressed="true"] { background: var(--accent); color: #031019; border-color: transparent; }
.moment-note { color: var(--ink-dim); font-size: 0.9rem; min-height: 2.8em; }

/* --- Seventeen outfits ------------------------------------------------------ */
.looks-reel { display: flex; gap: 0.6rem; overflow-x: auto; scrollbar-width: none; padding: 0.5rem 0 1rem; scroll-snap-type: x proximity; }
.looks-reel::-webkit-scrollbar { display: none; }
.looks-reel figure { flex: 0 0 7.4rem; margin: 0; scroll-snap-align: start; text-align: center; }
.looks-reel img {
  width: 100%; aspect-ratio: 9 / 17; object-fit: contain; border-radius: 1rem;
  background: radial-gradient(70% 60% at 50% 45%, rgba(14, 165, 233, 0.18), transparent 70%), rgba(255, 255, 255, 0.035);
  border: 1px solid var(--card-border);
}
.looks-reel figcaption { font-size: 0.78rem; color: var(--ink-dim); margin-top: 0.35rem; }

/* --- Focus and rest ----------------------------------------------------------- */
.focus-art { margin: 0 auto; max-width: 22rem; transform: rotate(-3deg); filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.7)); }
.ticks { list-style: none; display: grid; gap: 0.7rem; margin-top: 1.2rem; }
.ticks li { position: relative; padding-left: 1.8rem; color: var(--ink-dim); }
.ticks li::before { content: "🍙"; position: absolute; left: 0; top: 0; font-size: 1rem; }
.ticks li strong { color: var(--ink); font-weight: 600; }

/* --- Languages: the switcher, the honest note, Japanese line breaking -------- */
.lang-switch { display: flex; align-items: center; flex-wrap: wrap; font: 500 0.82rem var(--body); letter-spacing: 0.04em; }
.lang-switch span { color: rgba(232, 230, 223, 0.45); padding: 0 0.05rem; }
.lang-switch a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 2.4rem; padding: 0 0.5rem;
  color: rgba(232, 230, 223, 0.82); border-radius: 999px; transition: color 0.2s ease, background 0.2s ease;
}
.lang-switch a[lang="ja"] { font-family: var(--jp); letter-spacing: 0.02em; }
.lang-switch a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.lang-switch a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lang-switch a[aria-current="page"] { color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
.lang-hero {
  position: absolute; z-index: 4; top: max(0.75rem, env(safe-area-inset-top)); right: max(0.75rem, calc((100vw - 1060px) / 2));
  padding: 0 0.3rem; border-radius: 999px; background: rgba(5, 10, 20, 0.55); border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 6px 24px -10px rgba(0, 0, 0, 0.8);
}
.lang-footer { margin-left: -0.5rem; }
.lang-note {
  display: flex; gap: 0.55rem; align-items: flex-start; max-width: 34rem; margin: -1.1rem 0 1.4rem; padding: 0.6rem 0.85rem;
  border-radius: 0.8rem; background: rgba(5, 10, 20, 0.5); border: 1px solid rgba(14, 165, 233, 0.35);
  color: rgba(232, 230, 223, 0.9); font-size: 0.88rem; line-height: 1.45;
}
.lang-note::before { content: "i"; flex: none; width: 1.15rem; height: 1.15rem; margin-top: 0.08rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #031019; font: 700 0.72rem/1 var(--body); }

:root:lang(ja) { --body: "Inter", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja) p, :lang(ja) li, :lang(ja) figcaption, :lang(ja) summary {
  word-break: auto-phrase; line-break: strict; overflow-wrap: anywhere;
}
:root:lang(ja) .hero-title { max-width: 17em; font-size: clamp(1.5rem, 5.6vw, 2.9rem); line-height: 1.45; }
:root:lang(ja) .hero-title, :root:lang(ja) .story-tagline { word-break: keep-all; } /* break only at the marked <wbr> */
:root:lang(ja) .hero-eyebrow { text-transform: none; }

/* Wider gutters for the reels on phones, calmer spacing everywhere */
@media (max-width: 640px) {
  .section { padding-top: 3.6rem; padding-bottom: 3.6rem; }
  .phones .rphone:nth-child(2) { margin-top: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-phone, .hero-bg, .phones .rphone { animation: none; }
  .k-line, .brush path { stroke-dashoffset: 0; animation: none !important; }
  .stamps img { filter: none; opacity: 1; transform: none; animation: none !important; }
}
