/* ============================================================
   AI AUTONOMOUS 2D GRAVURE MAGAZINE - STYLESHEET
   Theme: Fresh Sage Green (さわやかなライトグリーン / モダンエディトリアル)
   ============================================================ */

:root {
    /* さわやかなライトグリーン（セージグリーン）パレット */
    --bg-base: #e6ede7;             /* 上品で落ち着いたライトセージグリーン */
    --bg-base-tint: #f0f5f1;        /* より明るいハイライトセージ */
    --bg-surface: #ffffff;          /* クリーンなホワイトサーフェス */
    --bg-surface-elevated: #f4f8f5; /* ほんのりセージがかったカード面 */
    --bg-glass: rgba(255, 255, 255, 0.88); /* 上質グラスモーフィズム */
    --bg-glass-strong: rgba(255, 255, 255, 0.95);

    --border-subtle: rgba(35, 65, 48, 0.1);
    --border-medium: rgba(35, 65, 48, 0.18);
    --border-accent: rgba(46, 125, 82, 0.4);

    --text-primary: #15241b;        /* 視認性の高いダークフォレスト */
    --text-secondary: #364d3f;      /* 落ち着いたセージフォレスト */
    --text-muted: #5e7567;          /* ソフトセージグレー */
    --text-accent: #27794e;         /* さわやかなエメラルドフォレストグリーン */

    --accent-emerald: #10b981;
    --accent-mint: #34d399;
    --accent-cyan: #0284c7;
    --accent-rose: #e11d48;
    --accent-gold: #b48c36;

    /* タイポグラフィ */
    --font-editorial: 'Noto Serif JP', serif;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Noto Sans JP', sans-serif;
    --font-display: 'Cinzel', serif;

    /* ボックスシャドウ（軽やかで立体的なソフトシャドウ） */
    --shadow-card: 0 20px 40px -12px rgba(28, 55, 38, 0.18),
                   0 2px 10px rgba(46, 125, 82, 0.06);
    --shadow-elevated: 0 12px 28px -8px rgba(28, 55, 38, 0.14);

    /* 角丸 */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

/* ============================================================
   リセット＆基本設定
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    min-height: 100%;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* メインビューワー専用（管理画面 .admin-page 除外）: 縦スクロールOFF */
body:not(.admin-page) {
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
}

/* 背景グラデーション・さわやかなアンビエントライト */
body::before {
    content: '';
    position: fixed;
    top: -20vh;
    left: 15vw;
    width: 65vw;
    height: 60vh;
    background: radial-gradient(circle, rgba(110, 195, 145, 0.16) 0%, rgba(230, 237, 231, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20vh;
    right: 10vw;
    width: 55vw;
    height: 55vh;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.1) 0%, rgba(230, 237, 231, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================================
   スプラッシュスクリーン（オープニング演出・1秒短縮）
   ============================================================ */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0d1712; /* 深いフォレストナイト */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1), visibility 1s ease;
    cursor: pointer;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    animation: splashAppear 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes splashAppear {
    0% {
        opacity: 0;
        transform: scale(0.94) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.splash-edition {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: #6ee7b7;
}

.splash-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 6vw, 48px);
    font-weight: 900;
    letter-spacing: 0.2em;
    background: linear-gradient(135deg, #ffffff 0%, #a7f3d0 60%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 24px rgba(16, 185, 129, 0.3);
}

.splash-subtitle {
    font-family: var(--font-heading);
    font-size: 18px;
    letter-spacing: 0.2em;
    color: #94a3b8;
}

.splash-indicator {
    width: 140px;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    margin-top: 16px;
    overflow: hidden;
}

.splash-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #34d399, #38bdf8);
    animation: splashProgress 1s linear forwards; /* 1秒に短縮 */
}

@keyframes splashProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ============================================================
   全体レイアウト
   ============================================================ */
.app-layout {
    position: relative;
    z-index: 1;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px 20px;
    overflow: hidden;
}

.content-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* ============================================================
   ステージ：3Dカードビューワー（最大化レイアウト）
   ============================================================ */
.stage-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    height: calc(100dvh - 24px);
    max-height: 840px;
    min-height: 320px;
    padding: 0;
}

/* カード右隣のアクションボタン群（縦並び） */
.card-side-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 50;
    flex-shrink: 0;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.card-side-actions.clean-view-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.side-action-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px solid var(--border-accent);
    border-radius: var(--radius-md);
    color: var(--text-accent);
    cursor: pointer;
    backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(28, 55, 38, 0.2), 0 0 10px rgba(39, 121, 78, 0.12);
    transition: all 0.25s cubic-bezier(0.2, 0.85, 0.4, 1);
    padding: 0;
}

.side-action-btn:hover {
    background: #ffffff;
    border-color: var(--primary-accent);
    color: var(--primary-accent);
    transform: scale(1.06);
    box-shadow: 0 6px 22px rgba(39, 121, 78, 0.3);
}

.side-action-btn:active {
    transform: scale(0.92);
}

.side-btn-svg {
    display: block;
    stroke: currentColor;
}

.side-btn-label {
    font-family: var(--font-heading);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
}

/* カードシーン：上下ボタンを内蔵したことで画面いっぱいに拡大 */
.card-scene {
    position: relative;
    height: calc(100dvh - 28px);
    max-height: 800px;
    min-height: 260px;
    aspect-ratio: 768 / 1344;
    max-width: calc(100vw - 40px);
    perspective: 1600px;
    transition: transform 0.3s ease;
    container-type: size;
}

.gravure-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.75s cubic-bezier(0.2, 0.85, 0.4, 1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.gravure-card.is-flipped {
    transform: rotateY(180deg);
}

/* 縦スライドアニメーション */
.gravure-card.slide-out-up {
    animation: cardSlideOutUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.gravure-card.slide-in-up {
    animation: cardSlideInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gravure-card.slide-out-down {
    animation: cardSlideOutDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.gravure-card.slide-in-down {
    animation: cardSlideInDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardSlideOutUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-35px) scale(0.97); opacity: 0; }
}

@keyframes cardSlideInUp {
    0% { transform: translateY(35px) scale(0.97); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes cardSlideOutDown {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(35px) scale(0.97); opacity: 0; }
}

@keyframes cardSlideInDown {
    0% { transform: translateY(-35px) scale(0.97); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ============================================================
   表面（Front: グラビア画像 + 概要 + カード内ナビゲーション）
   ============================================================ */
.card-front {
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    cursor: default;
    z-index: 5;
    pointer-events: auto;
    visibility: visible;
    touch-action: pan-x;
}

/* クリーンビュー（画像のみ表示モード） */
.card-front.clean-view {
    cursor: pointer;
}

.card-front.clean-view .image-scrim,
.card-front.clean-view .front-header,
.card-front.clean-view .card-left-nav,
.card-front.clean-view .front-bottom {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* 反転時の切り替え：表面を非活性化 */
.gravure-card.is-flipped .card-front {
    pointer-events: none;
    visibility: hidden;
    z-index: 1;
}

/* 反転時の切り替え：裏面を最前面・活性化 */
.gravure-card.is-flipped .card-back {
    pointer-events: auto;
    visibility: visible;
    z-index: 10;
}

.card-image-container {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #0d0f15;
    overflow: hidden;
}

/* 画像読み込み中のスケルトンシマー効果 */
.card-image-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(212, 175, 55, 0.05) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: imageShimmer 1.8s infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes imageShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-img.loaded {
    opacity: 1;
}

.image-scrim {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0) 55%,
        rgba(0, 0, 0, 0.25) 70%,
        rgba(0, 0, 0, 0.8) 88%,
        rgba(0, 0, 0, 0.95) 100%
    );
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.front-header {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 2px 4px 0;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.card-date-badge {
    font-family: var(--font-en);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(14, 26, 19, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 3px 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    user-select: none;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.theme-badge {
    background: rgba(39, 121, 78, 0.35);
    color: #a7f3d0;
    border: 1px solid rgba(110, 231, 183, 0.4);
    backdrop-filter: blur(8px);
}

/* カード左サイド中央ナビゲーション（▲ / ▼） */
.card-left-nav {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.nav-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(14, 26, 19, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(14px);
    transition: all 0.25s cubic-bezier(0.2, 0.85, 0.4, 1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.nav-card-btn:hover:not(:disabled) {
    background: rgba(39, 121, 78, 0.65);
    border-color: #6ee7b7;
    color: #a7f3d0;
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(110, 231, 183, 0.35);
}

.nav-card-btn:active:not(:disabled) {
    transform: scale(0.94);
}

.nav-card-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    border-color: transparent;
    pointer-events: none;
    box-shadow: none;
}

.front-bottom {
    position: relative;
    z-index: 2;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.front-title-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
}

.theme-badge-wrapper {
    display: inline-flex;
    align-items: center;
}

.theme-badge-wrapper .theme-badge {
    padding: 5px 12px;
    font-size: 14px;
    letter-spacing: 0.08em;
    background: rgba(14, 26, 19, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(110, 231, 183, 0.45);
    color: #a7f3d0;
    border-radius: var(--radius-full);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

.card-title-text {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.04em;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    word-break: break-word;
    max-width: 100%;
}

.card-title-text:empty {
    display: none;
}

.front-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 丸型アイコンアクションボタン */
.icon-round-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(14, 26, 19, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(14px);
    transition: all 0.25s cubic-bezier(0.2, 0.85, 0.4, 1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    padding: 0;
}

.icon-round-btn:hover {
    background: rgba(39, 121, 78, 0.45);
    border-color: #6ee7b7;
    color: #a7f3d0;
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 6px 18px rgba(39, 121, 78, 0.3);
}

.icon-round-btn:active {
    transform: translateY(0) scale(0.98);
}

.icon-round-btn .btn-icon {
    font-size: 22px;
    line-height: 1;
}

.icon-round-btn .btn-svg {
    display: block;
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* ============================================================
   裏面（Back: キャラクタープロフィール - さわやかグラス調）
   ============================================================ */
.card-back {
    background: rgba(248, 252, 249, 0.95);
    backdrop-filter: blur(24px);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    border: 1px solid var(--border-accent);
    color: var(--text-primary);
    z-index: 1;
    pointer-events: none;
    visibility: hidden;
}

.back-header {
    position: relative;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 12px;
    pointer-events: auto;
}

.back-title-group {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.back-badge {
    background: transparent;
    border: none;
    color: var(--text-accent);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.25em;
    padding: 0;
    text-align: center;
}

.back-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.back-scroll-area::-webkit-scrollbar {
    width: 4px;
}

.back-scroll-area::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

/* ============================================================
   裏面（Back: プロンプトレシピ・知見インスペクター）
   ============================================================ */
.prompt-inspector-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 1. 解説カード（旧・構図/動作） */
.prompt-explanation-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--text-accent);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: 0 2px 8px rgba(28, 55, 38, 0.04);
}

.prompt-explanation-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-accent);
    margin-bottom: 6px;
}

.prompt-explanation-text {
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-primary);
    margin: 0;
    word-break: break-word;
}

/* 2. プロンプト表示ブロック ＆ コピーボタングループ */
.prompt-box-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(28, 55, 38, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.prompt-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(230, 237, 231, 0.5);
    border-bottom: 1px solid var(--border-subtle);
}

.prompt-section-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

.prompt-btn-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.4, 1);
}

.copy-action-btn:hover {
    background: rgba(39, 121, 78, 0.1);
    border-color: var(--text-accent);
    color: var(--text-accent);
    transform: translateY(-1px);
}

.copy-action-btn.copy-full-btn {
    background: rgba(39, 121, 78, 0.08);
    border-color: rgba(39, 121, 78, 0.3);
    color: var(--text-accent);
}

.copy-action-btn.copy-full-btn:hover {
    background: var(--text-accent);
    border-color: var(--text-accent);
    color: #ffffff;
}

.copy-action-btn.copied {
    background: #10b981 !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.prompt-content-wrap {
    padding: 12px;
    max-height: 260px;
    overflow-y: auto;
    background: #fafcfb;
}

.prompt-code-block {
    margin: 0;
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, Menlo, monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #243329;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: all;
}

/* 裏面フッター（表面右下ボタンと完全同一位置・同一サイズの丸型RETURNボタン） */
.back-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 10px;
    pointer-events: auto;
    z-index: 20;
}

.back-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #ffffff;
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(28, 55, 38, 0.1);
    transition: all 0.25s cubic-bezier(0.2, 0.85, 0.4, 1);
    padding: 0;
}

.back-close-btn:hover {
    background: #f0fdf4;
    border-color: var(--text-accent);
    color: var(--text-accent);
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 6px 16px rgba(39, 121, 78, 0.2);
}

.back-close-btn:active {
    transform: translateY(0) scale(0.98);
}

.back-close-btn .btn-icon {
    font-size: 20px;
    line-height: 1;
}

/* ============================================================
   カウンター表示スタイル
   ============================================================ */

.filter-title-group {
    display: flex;
    flex-direction: column;
}

.filter-heading {
    font-family: var(--font-display);
    font-size: 21px;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.counter-display {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.1em;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.counter-current {
    font-size: 24px;
    color: var(--text-accent);
}

.counter-slash {
    color: var(--text-muted);
    font-size: 16px;
}

.counter-total {
    color: var(--text-muted);
}

.filter-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.filter-select {
    width: 100%;
    background: #f8faf8;
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    border-color: var(--text-accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(39, 121, 78, 0.15);
}

.filter-select option {
    background: #ffffff;
    color: var(--text-primary);
}

.filter-actions {
    margin-top: 6px;
}

.filter-reset-btn {
    width: 100%;
    background: #f4f8f5;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter-reset-btn:hover {
    background: #e6ede7;
    border-color: var(--text-accent);
    color: var(--text-accent);
}

/* ============================================================
   ステート（ローディング／空表示）
   ============================================================ */
.state-indicator {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    background: rgba(230, 237, 231, 0.95);
    z-index: 10;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
}

.state-indicator.hidden {
    display: none;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--text-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.state-text {
    font-family: var(--font-heading);
    font-size: 12px;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.empty-title {
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}

/* ============================================================
   レスポンシブ・SP版専用（スクロール禁止＆ドロワー化）
   ============================================================ */
@media (max-width: 960px) {
    body:not(.admin-page) {
        height: 100dvh !important;
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        overscroll-behavior: none;
    }

    .app-layout {
        height: 100dvh !important;
        overflow: hidden !important;
        padding: 4px 0px;
        justify-content: center;
    }

    .content-container {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%;
        width: 100%;
    }

    .stage-section {
        height: 100%;
        max-height: 100dvh;
        justify-content: center;
        gap: 0;
        padding: 0;
    }

    .card-scene {
        width: min(calc(100vw - 16px), calc((100dvh - 16px) * (768 / 1344)));
        max-width: calc(100vw - 16px);
        height: auto;
        max-height: calc(100dvh - 16px);
        min-height: unset;
        aspect-ratio: 768 / 1344;
    }

    /* SP時: カード右端に縦並びで配置（絶対に重ならない） */
    .card-side-actions {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        gap: 10px;
    }

    .side-action-btn {
        width: 46px;
        height: 48px;
        background: rgba(255, 255, 255, 0.95);
        border: 1.5px solid var(--border-accent);
        border-radius: var(--radius-md);
        box-shadow: 0 4px 16px rgba(28, 55, 38, 0.25);
    }
}

/* ============================================================
   いいねボタン（Favorite Button）
   ============================================================ */
.footer-left-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.favorite-btn .heart-icon {
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), fill 0.2s ease, stroke 0.2s ease;
}

.favorite-btn:hover .heart-icon {
    transform: scale(1.15);
    stroke: #fb7185;
}

.favorite-btn.active {
    background: rgba(225, 29, 72, 0.88);
    border-color: rgba(254, 205, 211, 0.7);
    color: #fff;
    box-shadow: 0 4px 16px rgba(225, 29, 72, 0.45);
}

.favorite-btn.active .heart-icon {
    fill: #fff;
    stroke: #fff;
}

.favorite-btn.pop-anim .heart-icon {
    animation: heartPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPop {
    0% { transform: scale(1); }
    45% { transform: scale(1.45); }
    100% { transform: scale(1); }
}

.favorite-count {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* ============================================================
   フィルター モーダル用UIスタイル
   ============================================================ */
.modal-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-counter-badge {
    background: #f0fdf4;
    border: 1px solid var(--border-accent);
    color: var(--text-accent);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
}

.modal-filter-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-field-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.modal-field-select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.modal-field-select:focus {
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(39, 121, 78, 0.15);
}

.modal-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.modal-reset-btn {
    flex: 1;
    padding: 11px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.modal-apply-btn {
    flex: 2;
    padding: 11px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

/* ============================================================
   テーマリクエスト モーダル
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(14, 24, 18, 0.75);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.25s ease;
}

.modal-backdrop.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-accent);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 480px;
    max-height: min(720px, calc(100vh - 40px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
    0% { transform: scale(0.92) translateY(12px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
    background: #fbfdfc;
    flex-shrink: 0;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.request-badge {
    background: rgba(39, 121, 78, 0.12);
    color: var(--primary-accent);
    border: 1px solid rgba(39, 121, 78, 0.3);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: 0.04em;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f5f2;
    border: 1px solid var(--border-medium);
    color: var(--text-muted);
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #e2ede6;
    color: var(--text-primary);
}

.modal-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-accent);
}

.modal-desc {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.active-themes-preview {
    background: #f7faf8;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.preview-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.active-themes-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.theme-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    border: 1px solid var(--border-accent);
    color: var(--text-primary);
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 12px;
}

.reprint-tag {
    background: #fef3c7;
    color: #92400e;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 700;
}

.request-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-wrap {
    position: relative;
    width: 100%;
}

.theme-input {
    width: 100%;
    padding: 12px 60px 12px 14px;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    background: #fff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.theme-input:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(39, 121, 78, 0.15);
}

.char-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-family: var(--font-heading);
    color: var(--text-muted);
    pointer-events: none;
}

.char-count.limit-reached {
    color: #e11d48;
    font-weight: 700;
}

.request-feedback {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.5;
}

.request-feedback.success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.request-feedback.error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

.theme-submit-btn {
    width: 100%;
    padding: 12px 18px;
    background: var(--primary-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.25s ease;
}

.theme-submit-btn:hover:not(:disabled) {
    background: #1e6340;
    box-shadow: 0 4px 14px rgba(39, 121, 78, 0.35);
}

.theme-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================
   ABOUT モーダル用スタイル
   ============================================================ */
.about-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.about-section-heading {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    border-left: 3px solid var(--primary-accent);
    padding-left: 8px;
    margin: 0;
    letter-spacing: 0.04em;
}

.about-body-text {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
}

.about-feature-bullets {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.about-feature-bullets strong {
    color: var(--text-primary);
}

.about-disclaimer-box {
    background: #fdfaf6;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-top: 4px;
}

.disclaimer-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #c2410c;
    background: #ffedd5;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.disclaimer-desc {
    font-size: 11.5px;
    line-height: 1.6;
    color: #7c2d12;
    margin: 0;
}

/* カタログボタン用カラーアクセント */
.catalog-btn:hover {
    border-color: #38bdf8 !important;
    background: rgba(14, 165, 233, 0.12) !important;
    color: #38bdf8 !important;
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.25) !important;
}

/* ============================================================
   カタログ（バックナンバー）モーダル
   ============================================================ */
.catalog-modal-card {
    max-width: 600px !important;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.catalog-modal-body {
    overflow-y: auto;
    max-height: calc(85vh - 70px);
    padding: 16px 20px 24px;
}

.catalog-lead {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 16px;
    line-height: 1.5;
}

.catalog-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.catalog-action-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.catalog-action-chip:hover {
    background: rgba(39, 121, 78, 0.1);
    color: var(--primary-accent);
    border-color: var(--primary-accent);
}

.catalog-action-chip.active {
    background: var(--primary-accent);
    color: #fff;
    border-color: var(--primary-accent);
    box-shadow: 0 2px 8px rgba(39, 121, 78, 0.3);
}

.chip-icon {
    font-size: 13px;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.catalog-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.85, 0.4, 1);
    display: flex;
    flex-direction: column;
}

.catalog-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.catalog-card.selected-issue {
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 2px var(--primary-accent);
}

.catalog-card-cover {
    position: relative;
    width: 100%;
    height: 140px;
    background: #111;
    overflow: hidden;
}

.catalog-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.catalog-card:hover .catalog-card-cover img {
    transform: scale(1.05);
}

.cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-en);
}

.issue-latest-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #10b981;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.issue-count-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    backdrop-filter: blur(8px);
}

.catalog-card-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.catalog-card-date {
    font-family: var(--font-en);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.catalog-card-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.issue-theme-tag {
    font-size: 10.5px;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    line-height: 1.3;
}

.catalog-loading,
.catalog-empty,
.catalog-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.small-spinner {
    width: 24px !important;
    height: 24px !important;
    margin: 0 auto 10px !important;
}

/* ============================================================
   管理者モード（非表示トグル）スタイル
   ============================================================ */
.admin-only {
    display: none !important;
}

body.is-admin-mode .admin-only {
    display: inline-flex !important;
}

/* カード左下：非公開ボタン */
.hide-action-btn {
    background: rgba(45, 15, 15, 0.75) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #fca5a5 !important;
    transition: all 0.25s cubic-bezier(0.2, 0.85, 0.4, 1);
}

.hide-action-btn:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    transform: translateY(-2px) scale(1.08) !important;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35) !important;
}

.hide-action-btn:active {
    transform: translateY(0) scale(0.96) !important;
}

/* サイドバーの管理者バッジ */
.admin-badge-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: var(--radius-full);
    color: #f87171;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.2s ease;
    user-select: none;
}

.admin-badge-indicator:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: #ef4444;
    color: #fff;
    transform: scale(1.05);
}

.admin-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
    animation: adminPulse 2s infinite ease-in-out;
}

@keyframes adminPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* ABOUTモーダル内の管理者設定 */
.about-admin-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.admin-logged-in-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
}

.admin-status-text {
    font-size: 11.5px;
    color: #b91c1c;
    font-weight: 600;
}

.admin-logout-btn {
    padding: 4px 10px;
    font-size: 11px;
    background: #fff;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: #dc2626;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.admin-logout-btn:hover {
    background: #dc2626;
    color: #fff;
}

.show-admin-login-btn {
    background: transparent;
    border: none;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.show-admin-login-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}

.admin-login-form {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.admin-password-input {
    flex: 1;
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-primary);
    outline: none;
}

.admin-password-input:focus {
    border-color: var(--primary-accent);
}

.admin-login-submit-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.admin-login-submit-btn:hover {
    opacity: 0.88;
}



