/* hairLogX LP の動く画面モック（homepage #193。仕様: ai-team projects/homepage/docs/apps/2026-10-16-spec-hairlogx-lp-redesign.md §5）
   色はアプリに合わせる: アクセント #6366F1（hairLogX lib/theme/app_theme.dart:9）、背景 #F8FAFC、
   カレンダーのマス #575992 とカード #F6F2FA（ストア画像を撮った実機の画面から拾った値） */

@property --hxd-pos {
    syntax: '<percentage>';
    inherits: true;
    initial-value: 50%;
}

.hxd {
    --hxd-accent: #6366f1;
    --hxd-bg: #f8fafc;
    --hxd-ink: #1f2430;
    --hxd-sub: #6b7280;
    --hxd-line: #e5e7eb;
    --hxd-cell: #575992;
    --hxd-cell-off: #e9e4f0;
    --hxd-card: #f6f2fa;
    --hxd-star: #ffb400;
    --hxd-star-off: #e5e1d8;
    font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
    text-align: left; /* LP のスマホの幅の中央揃えを持ち込まない（アプリは左揃え） */
}

/* ---- 端末の枠 ---------------------------------------------------------------- */

.hxd,
.hxd * {
    box-sizing: border-box;
}

.hxd-phone {
    position: relative;
    width: min(300px, 78vw);
    aspect-ratio: 9 / 18.5;
    padding: 9px;
    border-radius: 38px;
    background: #15161c;
    box-shadow: 0 30px 70px rgba(15, 27, 51, 0.22);
}

.hxd-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: 30px;
    background: var(--hxd-bg);
    color: var(--hxd-ink);
    font-size: 12px;
    line-height: 1.5;
}

.hxd-status {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    height: 26px;
    padding: 0 18px;
    font-size: 11px;
    font-weight: 600;
}

.hxd-status-icons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.hxd-status-icons i {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: currentColor;
    opacity: 0.75;
}

.hxd-appbar {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 14px;
    border-bottom: 1px solid var(--hxd-line);
    font-size: 15px;
    font-weight: 700;
}

.hxd-appbar-side {
    position: absolute;
    top: 50%;
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--hxd-sub);
    font-size: 11px;
    font-weight: 500;
    transform: translateY(-50%);
}

.hxd-appbar-side.is-left { left: 14px; }
.hxd-appbar-side.is-right { right: 14px; }
.hxd-appbar-side .is-accent { color: var(--hxd-accent); }

.hxd-icon {
    display: inline-block;
    width: 15px;
    height: 15px;
    vertical-align: middle;
}

/* ---- A: Before / After のスライダー（比較の編集画面） ---------------------------- */

.hxd-screen.is-dark {
    background: #101114;
    color: #f5f5f7;
}

.hxd-editor-top {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    padding: 0 12px;
}

.hxd-editor-close {
    font-size: 16px;
    line-height: 1;
    opacity: 0.85;
}

.hxd-editor-save {
    padding: 5px 11px;
    border-radius: 999px;
    background: #4b8bff;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.hxd-compare {
    --hxd-pos: 50%;
    position: relative;
    flex: none;
    width: 100%;
    aspect-ratio: 3 / 4;
    margin: auto 0;
    overflow: hidden;
}

.hxd-compare img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hxd-compare .hxd-after {
    clip-path: inset(0 0 0 var(--hxd-pos));
}

.hxd-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--hxd-pos);
    width: 2px;
    background: #fff;
    transform: translateX(-1px);
}

.hxd-divider::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26px;
    height: 26px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(17, 18, 22, 0.55);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    content: "";
    transform: translate(-50%, -50%);
}

.hxd-label {
    position: absolute;
    top: 10px;
    padding: 3px 7px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.hxd-label.is-before { left: 8px; }
.hxd-label.is-after { right: 8px; }

.hxd-editor-tabs {
    display: flex;
    flex: none;
    gap: 6px;
    justify-content: center;
    padding: 12px 10px 16px;
}

.hxd-editor-tabs span {
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
}

.hxd-editor-tabs .is-on {
    border-color: #fff;
    color: #fff;
}

.hxd.is-playing .hxd-compare {
    animation: hxd-slide 6s ease-in-out infinite;
}

@keyframes hxd-slide {
    0% { --hxd-pos: 50%; }
    22% { --hxd-pos: 14%; }
    58% { --hxd-pos: 86%; }
    82%, 100% { --hxd-pos: 50%; }
}

/* ---- B: ホームの一覧 ---------------------------------------------------------- */

/* JS が無いときは CSS の grid で 3 列に並べる（完成形）。JS が動くと .is-js を付けて、位置を JS が決める */
.hxd-grid {
    position: relative;
    display: grid;
    flex: 1;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: max-content;
    gap: 6px;
    align-content: start;
    margin: 8px 8px 0;
    overflow: hidden;
}

.hxd-card {
    position: relative;
    align-self: start;
    aspect-ratio: 0.74;
    overflow: hidden;
    border-radius: 10px;
    background: #ccc;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.hxd-grid.is-js {
    display: block;
}

.hxd-grid.is-js .hxd-card {
    position: absolute;
    top: 0;
    left: 0;
    aspect-ratio: auto;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}

.hxd-card img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hxd-card-text {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 18px 6px 5px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 8.5px;
    line-height: 1.35;
}

.hxd-card-text b {
    display: block;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hxd-card-text .hxd-rate {
    display: block;
}

.hxd-card-text .hxd-rate::before {
    color: var(--hxd-star);
    content: "★ ";
}

.hxd-card.is-new {
    opacity: 0;
}

.hxd-card.is-new.is-in {
    opacity: 1;
}

.hxd-fab {
    position: absolute;
    right: 14px;
    bottom: 16px;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 12px;
    background: #e3e2ff;
    color: #2b2a5e;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease;
}

.hxd-fab.is-press {
    transform: scale(0.86);
}

/* ---- C: 記録の詳細 ------------------------------------------------------------ */

.hxd-detail {
    flex: 1;
    padding: 10px 14px 0;
    overflow: hidden;
}

.hxd-detail-photo {
    display: block;
    width: 74px;
    height: 74px;
    margin: 0 0 6px;
    border-radius: 10px;
    object-fit: cover;
}

.hxd-field {
    margin-top: 8px;
    color: var(--hxd-sub);
    font-size: 9.5px;
}

.hxd-chip {
    display: inline-block;
    margin-top: 3px;
    padding: 3px 8px;
    border-radius: 6px;
    background: #eceef2;
    color: var(--hxd-ink);
    font-size: 11px;
    font-weight: 700;
}

.hxd-memo {
    min-height: 3.2em;
    margin: 3px 0 0;
    color: var(--hxd-ink);
    font-size: 10.5px;
    line-height: 1.6;
}

.hxd-memo.is-typing::after {
    display: inline-block;
    width: 1px;
    height: 1.1em;
    margin-left: 1px;
    background: var(--hxd-accent);
    vertical-align: -0.15em;
    content: "";
    animation: hxd-caret 0.8s steps(1) infinite;
}

@keyframes hxd-caret {
    50% { opacity: 0; }
}

.hxd-items {
    margin: 3px 0 0;
    padding: 0 0 0 1.2em;
    color: var(--hxd-ink);
    font-size: 10.5px;
}

.hxd-items li {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.hxd-items li.is-on {
    opacity: 1;
    transform: none;
}

.hxd-rating {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 3px;
    color: var(--hxd-ink);
    font-size: 10px;
}

.hxd-rating-name {
    width: 4.6em;
}

.hxd-stars span {
    color: var(--hxd-star-off);
    font-size: 13px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.hxd-stars span.is-on {
    color: var(--hxd-star);
}

/* ---- D: 統計（連続記録日数とカレンダー） --------------------------------------- */

.hxd-stats {
    flex: 1;
    padding: 12px 12px 0;
    overflow: hidden;
}

.hxd-streak {
    padding: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6c6fd8, #575992);
    color: #fff;
    text-align: center;
}

.hxd-streak-label {
    font-size: 10.5px;
    font-weight: 700;
    opacity: 0.92;
}

.hxd-streak-num {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.hxd-streak-unit {
    margin-left: 2px;
    font-size: 12px;
    font-weight: 700;
}

.hxd-stats h4 {
    margin: 14px 0 6px;
    font-size: 13px;
    font-weight: 800;
}

.hxd-cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    padding: 9px;
    border-radius: 12px;
    background: var(--hxd-card);
}

.hxd-cal span {
    display: grid;
    aspect-ratio: 1;
    place-items: center;
    border-radius: 6px;
    background: var(--hxd-cell-off);
    color: #8a84a0;
    font-size: 9px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.hxd-cal span.is-on {
    background: var(--hxd-cell);
    color: #fff;
}

.hxd-legend {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 7px;
    color: var(--hxd-sub);
    font-size: 9px;
}

.hxd-legend i {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 3px;
    border-radius: 2px;
    vertical-align: -0.05em;
}

/* ---- 動きを減らす設定のときは、最後の状態で止める（js/hairlogx-demo.js が最後の状態を描く） ---- */

@media (prefers-reduced-motion: reduce) {
    .hxd.is-playing .hxd-compare { animation: none; }
    .hxd-card,
    .hxd-items li,
    .hxd-stars span,
    .hxd-cal span { transition: none; }
    .hxd-memo.is-typing::after { animation: none; }
}
