:root {
    --color-bg: #f5f6f8;
    --color-surface: #ffffff;
    --color-text: #1f2933;
    --color-heading: #1e2a38;
    --color-muted: #4b5b6b;
    --color-muted-2: #5b6875;
    --color-border: #d9e0e7;
    --color-border-soft: #c7d2de;
    --color-input-border: #cfd8e3;

    --color-label-bg: #eef2f6;
    --color-button-secondary: #e9eef3;

    --color-success-bg: #e7f4ea;
    --color-success-text: #1f6b3a;

    --color-warning-border: #ef9a9a;
    --color-warning-bg: #fff5f5;
    --color-warning-text: #b42318;

    --color-status-default-bg: #f3f4f6;

    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 6px 14px rgba(0, 0, 0, 0.12);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-pill: 999px;

    --container-width: 1100px;
    --article-width: 900px;
    --hero-width: 820px;
    --hero-text-width: 720px;
    --error-width: 600px;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

h1,
h2,
h3,
h4 {
    margin-top: 0;
}

/* Layout */
.site-header {
    color: #ffffff;
    background-color: var(--color-heading);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner,
.site-main {
    max-width: var(--container-width);
    margin: 0 auto;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
}

.site-main {
    padding: 24px 20px 40px;
}

/* Navigation */
.site-brand a,
.site-nav a {
    color: #ffffff;
    text-decoration: none;
}

.site-brand a {
    font-size: 1.2rem;
    font-weight: bold;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.site-nav a {
    padding: 8px 10px;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease;
}

.site-nav a:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

/* Shared layout blocks */
.card-container,
.result-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    margin-bottom: 12px;
    font-size: 2rem;
    line-height: 1.4;
}

.section-label {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    color: var(--color-muted-2);
}

.page-description,
.article-summary,
.article-card-summary,
.hero-description,
.error-description,
.tool-note {
    color: var(--color-muted);
}

/* Card */
.card,
.empty-state,
.wb-form {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card {
    width: 250px;
    padding: 16px;
}

.card a {
    color: var(--color-heading);
    text-decoration: none;
}

.card a:hover,
.breadcrumb a:hover,
.back-link:hover,
.text-link:hover,
.toc-item a:hover,
.article-body a:hover {
    text-decoration: underline;
}

.card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.card-link .card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-link .card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Common small UI */
.category-label,
.tool-status {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: var(--radius-pill);
    line-height: 1.2;
}

.category-label {
    margin-bottom: 8px;
    padding: 4px 8px;
    font-size: 0.85rem;
    color: var(--color-muted);
    background-color: var(--color-label-bg);
}

.text-link,
.back-link {
    color: var(--color-heading);
    text-decoration: none;
    font-weight: bold;
}

/* Home / Hero */
.hero {
    padding: 32px 0 40px;
}

.hero h1 {
    max-width: var(--hero-width);
    margin: 0 0 16px;
    font-size: 2.4rem;
    line-height: 1.35;
}

.hero-description {
    max-width: var(--hero-text-width);
    margin: 0;
    font-size: 1rem;
    line-height: 1.8;
}

.hero-actions,
.error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-actions {
    margin-top: 24px;
}

.primary-button,
.secondary-button {
    display: inline-block;
    padding: 12px 18px;
    font-weight: bold;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.primary-button {
    color: #ffffff;
    background-color: var(--color-heading);
}

.secondary-button {
    color: var(--color-heading);
    background-color: var(--color-button-secondary);
}

.primary-button:hover,
.secondary-button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.home-section {
    margin-top: 44px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0;
}

/* Article list / cards */
.article-grid {
    align-items: stretch;
}

.article-card,
.tool-card {
    display: flex;
    flex-direction: column;
}

.article-card {
    min-height: 220px;
}

.article-card-title {
    margin: 0 0 12px;
    font-size: 1.2rem;
    line-height: 1.5;
}

.article-card-summary {
    margin: 0;
    line-height: 1.7;
    flex-grow: 1;
}

.article-card-footer,
.tool-card-footer {
    margin-top: 20px;
}

.article-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.article-meta-row .category-label {
    margin-bottom: 0;
}

.article-meta-inline,
.article-header-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}


.reading-time,
.article-reading-time {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-muted-2);
    white-space: nowrap;
}

.article-reading-time {
    font-size: 0.9rem;
}

.article-header-meta {
    margin-bottom: 12px;
}

.article-list-meta {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--color-muted-2);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Category cards */
.category-card {
    min-height: 240px;
}

.category-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.category-count {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-muted-2);
    white-space: nowrap;
}

/* Article detail */
.article-page {
    max-width: var(--article-width);
    margin: 0 auto;
}

.breadcrumb {
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--color-muted-2);
}

.breadcrumb a {
    color: var(--color-muted-2);
    text-decoration: none;
}

.article-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.article-header h1 {
    margin-bottom: 12px;
    font-size: 2rem;
    line-height: 1.4;
}

.article-summary {
    margin: 0;
    font-size: 1rem;
    line-height: 1.7;
}

.article-content {
    margin-top: 28px;
    margin-bottom: 36px;
    font-size: 1.02rem;
    line-height: 2;
    color: var(--color-text);
    white-space: normal;
}

.article-updated {
    margin-top: 36px;
    padding: 16px 18px;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-muted-2);
    border-radius: 8px;
    background-color: var(--color-label-bg);
}

.article-updated-date {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-heading);
}

.article-updated-note {
    margin: 8px 0 0;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--color-muted-2);
}

.article-actions {
    margin-top: 24px;
    margin-bottom: 36px;
}

.article-list-notice {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background-color: var(--color-label-bg);
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--color-muted-2);
}

.related-section {
    margin-top: 24px;
}

.related-section h2 {
    margin-bottom: 16px;
}

.related-inline {
    margin: 20px 0 28px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.related-ogp-link {
    display: block;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    border-top: 3px solid #5b8db8;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.related-ogp-link:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.related-ogp-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-heading);
    margin: 0 0 4px;
    line-height: 1.0;
}

.related-ogp-summary {
    font-size: 16px;
    color: var(--color-muted);
    margin: 0 0 6px;
    line-height: 1.3;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-ogp-meta {
    font-size: 12px;
    color: var(--color-muted-2);
}

/* ツール引用カード（:::tool） */
.tool-ogp-link {
    border-top-color: #2f9e8f;
}

/* フラッシュカードのデッキ引用カード（:::deck・カード未指定時） */
.deck-ogp-link {
    border-top-color: #c2811b;
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    margin: 24px 0;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* TOC */
.toc {
    margin: 24px 0 32px;
    padding: 20px;
    background-color: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.toc-details {
    margin: 0;
}

.toc-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-heading);
    cursor: pointer;
    list-style: none;
    user-select: none;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.toc-title::-webkit-details-marker {
    display: none;
}

.toc-title:hover {
    background-color: #edf2f7;
}

.toc-title-text {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.toc-icon {
    font-size: 0.95rem;
    color: var(--color-muted);
}

.toc-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-muted);
}

.toc-chevron {
    font-size: 0.7rem;
    color: var(--color-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.toc-details[open] .toc-chevron {
    transform: rotate(180deg);
}

.toc-details[open] .toc-hint {
    display: none;
}

.toc-details[open] .toc-list {
    margin-top: 10px;
    padding-left: 0.75rem;
}

.toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.toc-item {
    margin-bottom: 10px;
}

.toc-item:last-child {
    margin-bottom: 0;
}

.toc-item a {
    color: var(--color-heading);
    text-decoration: none;
    line-height: 1.6;
}

.toc-level-3 {
    padding-left: 16px;
}

/* Markdown article body */
.article-body h2,
.article-body h3,
.article-body h4 {
    color: var(--color-heading);
    line-height: 1.5;
    scroll-margin-top: 90px;
}

.article-body h2 {
    margin-top: 48px;
    margin-bottom: 18px;
    padding-bottom: 10px;
    font-size: 1.65rem;
    border-bottom: 2px solid var(--color-border);
}

.article-body h3 {
    margin-top: 32px;
    margin-bottom: 14px;
    font-size: 1.28rem;
}

.article-body h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 1.08rem;
}

.article-body p {
    margin: 0 0 18px;
    line-height: 2;
}

.article-body ul,
.article-body ol {
    margin: 0 0 22px 24px;
    padding: 0;
    line-height: 1.95;
}

.article-body li {
    margin-bottom: 8px;
}

/* Callout blocks */
.callout {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 24px 0;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 0.97rem;
    line-height: 1.8;
}

.callout-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.callout-body {
    flex: 1;
    min-width: 0;
}

.callout-body p:last-child {
    margin-bottom: 0;
}

.callout-note {
    background-color: #f0f4ff;
    border-color: #c5d3f7;
    color: #2c3e7a;
}

.callout-tip {
    background-color: #f0faf2;
    border-color: #a8ddb5;
    color: #1a5c2e;
}

.callout-warning {
    background-color: var(--color-warning-bg);
    border-color: var(--color-warning-border);
    color: var(--color-warning-text);
}

.callout-quote {
    background-color: #f4f5f6;
    border-color: #cfd3d8;
    color: #2a2d31;
}

.article-body blockquote {
    margin: 24px 0;
    padding: 14px 18px;
    border-left: 4px solid var(--color-border-soft);
    background-color: #f8fafc;
    color: var(--color-muted);
    line-height: 1.8;
}

.article-body hr {
    margin: 32px 0;
    border: none;
    border-top: 1px solid var(--color-border);
}

.article-body strong {
    font-weight: bold;
}

.article-body a {
    color: var(--color-heading);
    text-decoration: underline;
}

.article-body a.related-ogp-link,
.article-body a.related-ogp-link:hover {
    text-decoration: none;
}

.article-body code {
    padding: 2px 6px;
    background-color: var(--color-label-bg);
    border-radius: var(--radius-sm);
    font-size: 0.95em;
}

.article-body pre {
    overflow-x: auto;
    margin: 24px 0;
    padding: 16px;
    background-color: var(--color-heading);
    color: #ffffff;
    border-radius: var(--radius-lg);
    line-height: 1.7;
}

.article-body pre code {
    padding: 0;
    background: none;
    color: inherit;
    border-radius: 0;
}

.article-body table {
    width: 100%;
    margin: 24px 0;
    border-collapse: collapse;
    font-size: 0.97rem;
    line-height: 1.7;
}

.article-body th,
.article-body td {
    padding: 10px 16px;
    border: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
}

.article-body th {
    background-color: var(--color-label-bg);
    font-weight: bold;
    color: var(--color-heading);
}

.article-body tr:nth-child(even) td {
    background-color: #f9fafb;
}

/* Lead section */
.article-lead {
    margin: 28px 0 36px;
    padding: 20px 22px;
    background-color: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.article-lead h2 {
    margin-top: 0;
    padding-bottom: 0;
    font-size: 1.4rem;
    border-bottom: none;
}

.article-lead p:last-child {
    margin-bottom: 0;
}

.article-grid > .card-link {
    display: block;
}

.article-grid > .card-link .card {
    height: 100%;
    box-sizing: border-box;
}

/* Tools */
.tool-card {
    min-height: 230px;
}

.tool-card-header {
    margin-bottom: 12px;
}

.tool-status {
    margin: 0 0 10px;
    padding: 4px 10px;
}

.status-released {
    color: #1a4a7a;
    background-color: #e3f0fb;
}

.status-active {
    color: var(--color-success-text);
    background-color: var(--color-success-bg);
}

.status-planned {
    color: var(--color-muted);
    background-color: var(--color-label-bg);
}

.tool-card--planned {
    opacity: 0.6;
}

/* 新ツール（NEW）の緑テーマ */
.tool-status-new {
    color: #ffffff;
    background-color: var(--color-success-text);
    letter-spacing: 0.04em;
}

.tool-card--new {
    border-color: #a7d7b6;
    border-top: 3px solid var(--color-success-text);
}

.tool-card-footer {
    margin-top: auto;
    padding-top: 20px;
}

.tool-note {
    font-size: 0.9rem;
}

/* Error page */
.error-page {
    max-width: var(--error-width);
    margin: 60px auto;
    text-align: center;
}

.error-page h1 {
    margin-bottom: 16px;
    font-size: 2rem;
    line-height: 1.4;
}

.error-description {
    margin-bottom: 24px;
    line-height: 1.7;
}

.error-actions {
    justify-content: center;
}

/* Forms */
.wb-form {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0; /* グリッド/フレックス内で内容より狭く縮められるように */
}

.form-group label {
    font-size: 0.95rem;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-md);
    font-family: Arial, sans-serif;
    resize: vertical;
}

.form-actions {
    margin-top: 24px;
}

.result-card {
    min-width: 220px;
}

.warning-card {
    background-color: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
}

/* Preset mode: locked config fields */
.form-group input.preset-locked {
    background: #f0f3f6;
    color: var(--color-muted);
    cursor: not-allowed;
    border-color: #d0d8e0;
}

/* Preset mode: required user input fields */
.form-group input.preset-required {
    border-color: #1a6eb5;
    background: #f0f6ff;
}

.warning-text {
    font-weight: bold;
    color: var(--color-warning-text);
}

.input-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
}

/* Empty state */
.empty-state {
    padding: 24px;
}

.article-content img {
  display: block;
  max-width: 500px;
  width: 100%;
  height: auto;
  margin: 20px auto;
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-nav {
        width: 100%;
        gap: 10px;
    }

    .site-main {
        padding: 20px 16px 32px;
    }

    .card {
        box-sizing: border-box;
        width: 100%;
    }

    /* スマホでは入力欄を必ず1列・全幅に（最後の行のはみ出し/左寄りを防ぐ） */
    /* minmax(0, 1fr) で、内容（長い select 等）が画面幅を超えても列が縮むようにする */
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero {
        padding: 20px 0 28px;
    }

    .hero h1 {
        font-size: 1.9rem;
    }

    .section-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .article-page {
        max-width: 100%;
    }

    .article-header h1 {
        font-size: 1.7rem;
    }

    .article-content {
        font-size: 1rem;
        line-height: 1.9;
    }

    .article-content img {
        max-width: 90%;
    }

    .article-body h2 {
        font-size: 1.4rem;
    }

    .article-body h3 {
        font-size: 1.18rem;
    }
}

/* ================================================
   Flashcard Tool
   ================================================ */

.fc-view {
    display: none;
}

/* New deck row */
.fc-new-deck {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.fc-input,
.fc-select,
.fc-textarea {
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 1rem;
    font-family: Arial, sans-serif;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
}

.fc-input {
    flex: 1;
    min-width: 0;
}

.fc-select {
    width: 100%;
}

.fc-textarea {
    resize: vertical;
    width: 100%;
}

/* Deck list */
.fc-deck-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fc-deck-item {
    width: auto;
    box-sizing: border-box;
    padding: 16px 20px;
}

.fc-deck-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.fc-deck-name {
    margin: 0;
    font-size: 1.1rem;
}

.fc-deck-description {
    margin: -4px 0 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.fc-card-count {
    font-size: 0.85rem;
    color: var(--color-muted-2);
    white-space: nowrap;
}

.fc-deck-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.fc-btn-sm {
    padding: 6px 14px;
    font-size: 0.9rem;
}

.fc-btn-plain {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: Arial, sans-serif;
    padding: 0;
    color: var(--color-heading);
    font-weight: bold;
}

.fc-btn-plain:hover {
    text-decoration: underline;
}

.fc-btn-delete {
    margin-left: auto;
    padding: 4px 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--color-muted);
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}

.fc-btn-delete:hover {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.primary-button:disabled,
.secondary-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.fc-empty {
    padding: 32px 24px;
    color: var(--color-muted);
    text-align: center;
}

/* Edit view */
.fc-view-nav {
    margin-bottom: 16px;
}

.fc-add-card {
    margin-bottom: 24px;
}

.fc-add-card h2 {
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.fc-card-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.fc-edit-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.fc-card-edit-item {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
}

.fc-card-edit-item--editing {
    border: 1px solid var(--color-border-soft);
}

.fc-card-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

.fc-card-preview-side {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fc-face-label-sm {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--color-muted-2);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.fc-card-preview-text {
    font-size: 0.95rem;
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
}

.fc-card-item-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Study / Test shared header */
.fc-study-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.fc-progress-text {
    font-size: 0.95rem;
    color: var(--color-muted-2);
}

.fc-round-badge {
    font-size: 0.8rem;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-label-bg);
    color: var(--color-muted-2);
}

/* Flip card */
.fc-card-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.fc-flip-card {
    perspective: 1000px;
    width: 100%;
    max-width: 640px;
    cursor: pointer;
    outline: none;
}

.fc-flip-inner {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.45s ease;
    height: 260px;
}

.fc-flip-inner.fc-flipped {
    transform: rotateY(180deg);
}

.fc-flip-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow-y: auto;
}

.fc-flip-back {
    transform: rotateY(180deg);
    background: #f0f6ff;
}

.fc-face-label {
    margin: 0 0 12px;
    font-size: 0.78rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    color: var(--color-muted-2);
    text-transform: uppercase;
    flex-shrink: 0;
}

.fc-face-text {
    font-size: 1.4rem;
    line-height: 1.6;
    color: var(--color-heading);
    word-break: break-word;
    white-space: pre-wrap;
}

.fc-flip-hint {
    margin-top: 10px;
    font-size: 0.83rem;
    color: var(--color-muted-2);
    text-align: center;
}

/* Study answer buttons */
.fc-study-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.fc-answer-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    font-family: Arial, sans-serif;
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}

.fc-answer-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.fc-btn-learning {
    color: var(--color-warning-text);
    background: var(--color-warning-bg);
    border-color: var(--color-warning-border);
}

.fc-btn-known {
    color: var(--color-success-text);
    background: var(--color-success-bg);
    border-color: #a8d9b0;
}

.fc-btn-key {
    display: inline-block;
    font-size: 0.73rem;
    font-weight: normal;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.1);
    color: inherit;
}

@keyframes fc-known-pulse {
    0%   { box-shadow: 0 0 0 0px rgba(40, 167, 69, 0); }
    35%  { box-shadow: 0 0 0 8px rgba(40, 167, 69, 0.35); }
    100% { box-shadow: 0 0 0 0px rgba(40, 167, 69, 0); }
}

.fc-flip-card.fc-known-anim {
    animation: fc-known-pulse 0.35s ease;
}

@keyframes fc-learning-pulse {
    0%   { box-shadow: 0 0 0 0px rgba(255, 153, 0, 0); }
    35%  { box-shadow: 0 0 0 8px rgba(255, 153, 0, 0.35); }
    100% { box-shadow: 0 0 0 0px rgba(255, 153, 0, 0); }
}

.fc-flip-card.fc-learning-anim {
    animation: fc-learning-pulse 0.35s ease;
}

/* Study setup */
.fc-setup-card {
    max-width: 480px;
}

.fc-setup-option {
    margin-bottom: 16px;
}

.fc-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
}

/* Study completion */
.fc-results-summary {
    margin-bottom: 16px;
    color: var(--color-muted);
}

.fc-results-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.fc-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.fc-result-card-text {
    font-size: 0.93rem;
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    word-break: break-word;
}

.fc-result-sep {
    color: var(--color-muted-2);
}

.fc-attempts-badge {
    font-size: 0.8rem;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

.fc-attempts-easy {
    color: var(--color-success-text);
    background: var(--color-success-bg);
}

.fc-attempts-mid {
    color: #856404;
    background: #fff3cd;
}

.fc-attempts-hard {
    color: var(--color-warning-text);
    background: var(--color-warning-bg);
}

.fc-complete-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* Test: question area */
.fc-test-question-area {
    max-width: 640px;
    margin: 0 auto;
}

.fc-test-question-card {
    margin-bottom: 20px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.fc-test-q-text {
    font-size: 1.4rem;
    line-height: 1.6;
    color: var(--color-heading);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Test: options */
.fc-test-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.fc-option-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    font-family: Arial, sans-serif;
    color: var(--color-text);
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.fc-option-btn:hover:not(:disabled) {
    border-color: var(--color-border-soft);
    background: var(--color-button-secondary);
}

.fc-option-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: var(--radius-sm);
    background: var(--color-label-bg);
    color: var(--color-muted-2);
}

.fc-option-text {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
}

.fc-option-btn.fc-option-correct {
    border-color: #a8d9b0;
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.fc-option-btn.fc-option-correct .fc-option-num {
    background: #a8d9b0;
    color: var(--color-success-text);
}

.fc-option-btn.fc-option-wrong {
    border-color: var(--color-warning-border);
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.fc-option-btn.fc-option-wrong .fc-option-num {
    background: var(--color-warning-border);
    color: var(--color-warning-text);
}

.fc-option-btn:disabled {
    cursor: default;
}

.fc-test-nav {
    text-align: right;
}

/* Test: score */
.fc-test-score-box {
    margin-bottom: 20px;
}

.fc-score-display {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 8px;
}

.fc-score-num {
    font-size: 2.4rem;
    font-weight: bold;
    color: var(--color-heading);
}

.fc-score-pct {
    font-size: 1.4rem;
    color: var(--color-muted);
}

.fc-score-label {
    margin: 0;
    color: var(--color-muted);
}

/* Test: answer review */
.fc-test-answer-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.fc-test-answer-row {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: var(--color-surface);
}

.fc-test-answer-row.fc-answer-correct {
    background: var(--color-success-bg);
}

.fc-test-answer-row.fc-answer-wrong {
    background: var(--color-warning-bg);
}

.fc-answer-num {
    font-size: 1.1rem;
    font-weight: bold;
    flex-shrink: 0;
    width: 24px;
    line-height: 1.6;
}

.fc-answer-correct .fc-answer-num {
    color: var(--color-success-text);
}

.fc-answer-wrong .fc-answer-num {
    color: var(--color-warning-text);
}

.fc-answer-detail {
    flex: 1;
    font-size: 0.93rem;
    line-height: 1.7;
    word-break: break-word;
}

.fc-answer-question {
    font-weight: bold;
    color: var(--color-heading);
    margin-bottom: 2px;
}

.fc-answer-your {
    color: var(--color-warning-text);
}

.fc-answer-correct-val {
    color: var(--color-success-text);
}

/* Flashcard responsive */
@media (max-width: 768px) {
    .fc-card-form-grid,
    .fc-card-preview {
        grid-template-columns: 1fr;
    }

    .fc-flip-face {
        padding: 20px 16px;
    }

    .fc-flip-inner {
        height: 220px;
    }

    .fc-face-text {
        font-size: 1.2rem;
    }

    .fc-test-q-text {
        font-size: 1.2rem;
    }

    .fc-score-num {
        font-size: 1.8rem;
    }

    .fc-score-pct {
        font-size: 1.1rem;
    }
}