/* ============================================
   Markdown 完全チートシート - スタイルシート
   ============================================ */

/* スコープ限定 */
.markdown-cheatsheet-container * {
    box-sizing: border-box;
}

:root {
    --md-primary: #0ea5e9;
    --md-primary-dark: #0284c7;
    --md-primary-light: #38bdf8;
    --md-secondary: #f97316;
    --md-accent: #22c55e;
    --md-danger: #ef4444;
    --md-bg: #0f172a;
    --md-surface: #020617;
    --md-card-bg: #020617;
    --md-card-border: #1e293b;
    --md-text-main: #e5e7eb;
    --md-text-sub: #9ca3af;
    --md-shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.9);
    --md-shadow-md: 0 12px 24px rgba(15, 23, 42, 0.8);
}

/* コンテナ */
.markdown-cheatsheet-container {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Roboto", "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
    line-height: 1.7;
    color: var(--md-text-main);
    max-width: 1200px;
    margin: 0 auto 40px;
    background: radial-gradient(circle at top, #1e293b 0, var(--md-bg) 40%, #020617 100%);
    border-radius: 24px;
    box-shadow: var(--md-shadow-lg);
    overflow: hidden;
    position: relative;
    isolation: isolate;
}

/* 背景のグリッドアニメーション */
.markdown-cheatsheet-container::before {
    content: "";
    position: absolute;
    inset: -40%;
    background:
        radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.25), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(249, 115, 22, 0.25), transparent 60%);
    opacity: 0.7;
    filter: blur(30px);
    z-index: -2;
}

.markdown-cheatsheet-container::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    mix-blend-mode: soft-light;
    opacity: 0.7;
    z-index: -1;
    animation: md-grid-scroll 30s linear infinite;
}

@keyframes md-grid-scroll {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(24px, 24px, 0);
    }
}

/* ヘッダー */
.markdown-cheatsheet-container header {
    padding: 40px 40px 32px;
    text-align: center;
    position: relative;
}

.markdown-cheatsheet-container header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(56, 189, 248, 0.4), transparent 60%);
    opacity: 0.9;
    mix-blend-mode: screen;
    pointer-events: none;
}

.markdown-cheatsheet-container h1 {
    font-size: 2.6rem;
    margin: 0 0 8px;
    letter-spacing: 0.05em;
    color: #f9fafb;
    text-shadow: 0 0 40px rgba(56, 189, 248, 0.8);
    position: relative;
    z-index: 1;
}

.markdown-cheatsheet-container .subtitle {
    font-size: 1.1rem;
    color: #e5e7eb;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* 目次 */
.markdown-cheatsheet-container .toc {
    background: linear-gradient(to right, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.9));
    padding: 20px 32px 22px;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    backdrop-filter: blur(18px);
}

.markdown-cheatsheet-container .toc h2 {
    margin: 0 0 10px;
    font-size: 1.15rem;
    color: var(--md-primary-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.markdown-cheatsheet-container .toc ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
}

.markdown-cheatsheet-container .toc li {
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.markdown-cheatsheet-container .toc a {
    display: block;
    padding: 6px 14px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #e5e7eb;
    position: relative;
    z-index: 1;
    white-space: nowrap;
}

.markdown-cheatsheet-container .toc li::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(56, 189, 248, 0.4), rgba(249, 115, 22, 0.4));
    opacity: 0;
    transform: translate3d(-10%, 0, 0);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.markdown-cheatsheet-container .toc li:hover::before {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.markdown-cheatsheet-container .toc li:hover a {
    color: #0b1120;
}

/* セクション */
.markdown-cheatsheet-container .section {
    padding: 32px 40px 24px;
    position: relative;
}

.markdown-cheatsheet-container .section h2 {
    font-size: 1.8rem;
    margin: 0 0 20px;
    color: var(--md-primary-light);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(56, 189, 248, 0.45);
}

.markdown-cheatsheet-container .section h2::after {
    content: "";
    width: 120px;
    height: 2px;
    margin-left: 4px;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.9), rgba(249, 115, 22, 0.9));
}

.markdown-cheatsheet-container .description {
    color: var(--md-text-sub);
    font-size: 0.98rem;
    margin-bottom: 14px;
}

/* 情報ボックス */
.markdown-cheatsheet-container .info-box {
    background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.25), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(249, 115, 22, 0.25), transparent 55%),
        rgba(15, 23, 42, 0.9);
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    padding: 18px 20px;
    margin-bottom: 22px;
    box-shadow: var(--md-shadow-md);
}

.markdown-cheatsheet-container .info-box p {
    margin: 0 0 10px;
}

.markdown-cheatsheet-container .info-box p:last-child {
    margin-bottom: 0;
}

/* カード */
.markdown-cheatsheet-container .prop-card {
    background: rgba(15, 23, 42, 0.96);
    border-radius: 18px;
    padding: 20px 20px 18px;
    margin-bottom: 22px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: var(--md-shadow-md);
    position: relative;
    overflow: hidden;
}

.markdown-cheatsheet-container .prop-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.2), transparent 55%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.markdown-cheatsheet-container .prop-card:hover::before {
    opacity: 1;
}

.markdown-cheatsheet-container .prop-card h3 {
    margin: 0 0 10px;
    font-size: 1.25rem;
    color: var(--md-primary);
    position: relative;
    z-index: 1;
}

/* コードサンプル */
.markdown-cheatsheet-container .code-sample {
    background: radial-gradient(circle at top left, #1f2937, #020617);
    border-radius: 14px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    margin-top: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    position: relative;
}

.markdown-cheatsheet-container .code-sample-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.9));
    border-bottom: 1px solid rgba(55, 65, 81, 0.9);
}

.markdown-cheatsheet-container .code-sample-header span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(148, 163, 184, 0.9);
}

.markdown-cheatsheet-container .copy-button,
.markdown-cheatsheet-container .toggle-view-button {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    font-size: 0.7rem;
    padding: 4px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.markdown-cheatsheet-container .copy-button:hover,
.markdown-cheatsheet-container .toggle-view-button:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.8);
    transform: translateY(-1px);
}

.markdown-cheatsheet-container .copy-button:active,
.markdown-cheatsheet-container .toggle-view-button:active {
    transform: translateY(0);
}

.markdown-cheatsheet-container pre {
    margin: 0;
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #e5e7eb;
    overflow-x: auto;
}

.markdown-cheatsheet-container pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* インラインコード */
.markdown-cheatsheet-container code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    background: rgba(15, 23, 42, 0.9);
    padding: 2px 5px;
    border-radius: 4px;
    border: 1px solid rgba(55, 65, 81, 0.8);
    color: #e5e7eb;
}

/* レンダリングプレビュー */
.markdown-cheatsheet-container .render-preview {
    margin-top: 12px;
    border-radius: 14px;
    border: 1px solid rgba(55, 65, 81, 0.8);
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.95));
    padding: 10px 12px;
}

.markdown-cheatsheet-container .render-preview-label {
    font-size: 0.8rem;
    color: rgba(148, 163, 184, 0.9);
    margin-bottom: 6px;
}

.markdown-cheatsheet-container .render-preview-body {
    font-size: 0.9rem;
}

.markdown-cheatsheet-container .render-preview-body p {
    margin: 0 0 6px;
}

.markdown-cheatsheet-container .render-preview-body p:last-child {
    margin-bottom: 0;
}

/* 2カラムレイアウト */
.markdown-cheatsheet-container .md-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 4px;
}

/* TIPと注意 */
.markdown-cheatsheet-container .md-tip,
.markdown-cheatsheet-container .md-caution {
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.88rem;
    margin-top: 10px;
}

.markdown-cheatsheet-container .md-tip {
    background: rgba(22, 163, 74, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.6);
}

.markdown-cheatsheet-container .md-caution {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.6);
}

/* フロー図 */
.markdown-cheatsheet-container .md-diagram-flow {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 14px;
}

.markdown-cheatsheet-container .md-flow-step {
    flex: 1;
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.98));
    border-radius: 12px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    padding: 10px 10px;
    font-size: 0.85rem;
}

.markdown-cheatsheet-container .md-flow-title {
    font-weight: 600;
    color: var(--md-primary-light);
    margin-bottom: 4px;
}

.markdown-cheatsheet-container .md-flow-body {
    color: var(--md-text-sub);
    margin-bottom: 6px;
    font-size: 0.82rem;
}

.markdown-cheatsheet-container .md-flow-code,
.markdown-cheatsheet-container .md-flow-preview {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 0.82rem;
    background: rgba(15, 23, 42, 1);
    border-radius: 8px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    padding: 5px 7px;
    white-space: nowrap;
    overflow-x: auto;
}

.markdown-cheatsheet-container .md-flow-arrow {
    align-self: center;
    font-size: 1.4rem;
    color: rgba(148, 163, 184, 0.9);
}

/* 見出し図解 */
.markdown-cheatsheet-container .md-headings-diagram {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0 12px;
}

.markdown-cheatsheet-container .md-heading-level {
    display: flex;
    align-items: center;
    gap: 10px;
}

.markdown-cheatsheet-container .md-heading-mark {
    width: 52px;
    text-align: center;
    padding: 4px 0;
    border-radius: 999px;
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.85), rgba(14, 165, 233, 0.9));
    color: #0b1120;
    font-weight: 700;
}

.markdown-cheatsheet-container .md-heading-desc {
    flex: 1;
}

.markdown-cheatsheet-container .md-heading-label {
    font-size: 0.95rem;
    font-weight: 600;
}

.markdown-cheatsheet-container .md-heading-note {
    font-size: 0.8rem;
    color: var(--md-text-sub);
}

/* タスクリストプレビュー */
.markdown-cheatsheet-container .task-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.markdown-cheatsheet-container .task-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.markdown-cheatsheet-container .task-list input[type="checkbox"] {
    accent-color: var(--md-primary);
}

/* テーブル */
.markdown-cheatsheet-container .md-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.markdown-cheatsheet-container .md-table th,
.markdown-cheatsheet-container .md-table td {
    border: 1px solid rgba(55, 65, 81, 0.9);
    padding: 4px 8px;
}

.markdown-cheatsheet-container .md-table th {
    background: rgba(15, 23, 42, 0.9);
}

/* 良い例・悪い例 */
.markdown-cheatsheet-container .md-good-bad {
    border-radius: 12px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    padding: 10px 12px;
    font-size: 0.88rem;
}

.markdown-cheatsheet-container .md-good-bad h4 {
    margin: 0 0 6px;
    font-size: 0.96rem;
}

.markdown-cheatsheet-container .md-good-bad ul {
    padding-left: 18px;
    margin: 0;
}

.markdown-cheatsheet-container .md-good-bad li {
    margin-bottom: 4px;
}

.markdown-cheatsheet-container .md-good-bad li:last-child {
    margin-bottom: 0;
}

.markdown-cheatsheet-container .md-good-bad.md-bad {
    border-color: rgba(248, 113, 113, 0.8);
}

/* フッター */
.markdown-cheatsheet-container footer {
    padding: 14px 24px 18px;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(148, 163, 184, 0.85);
    border-top: 1px solid rgba(55, 65, 81, 0.9);
    background: linear-gradient(to right, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.95));
}

/* レスポンシブ */
@media (max-width: 960px) {
    .markdown-cheatsheet-container {
        margin: 10px;
        border-radius: 18px;
    }

    .markdown-cheatsheet-container header {
        padding: 28px 18px 22px;
    }

    .markdown-cheatsheet-container h1 {
        font-size: 2.1rem;
    }

    .markdown-cheatsheet-container .toc {
        padding: 14px 16px 15px;
    }

    .markdown-cheatsheet-container .section {
        padding: 20px 18px 14px;
    }

    .markdown-cheatsheet-container .md-two-col {
        grid-template-columns: minmax(0, 1fr);
    }

    .markdown-cheatsheet-container .md-diagram-flow {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .markdown-cheatsheet-container .toc ul {
        flex-direction: column;
        gap: 6px;
    }

    .markdown-cheatsheet-container .toc li {
        width: 100%;
    }
}

/* アニメーション軽減対応 */
@media (prefers-reduced-motion: reduce) {
    .markdown-cheatsheet-container,
    .markdown-cheatsheet-container * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


