/* =============================================
   flag Salon カラー調合トレーニング
   Mobile-first CSS
   ============================================= */

/* ── 1. CSS Variables ── */
:root {
    --pink:         #D81B60;
    --pink-dark:    #AD1457;
    --pink-light:   #FCE4EC;
    --pink-pale:    #FFF5F8;
    --purple:       #6A1B9A;
    --blue:         #1565C0;
    --green:        #2E7D32;
    --green-light:  #E8F5E9;
    --orange:       #E65100;
    --orange-light: #FFF3E0;
    --text:         #1A1A2E;
    --text-muted:   #757575;
    --border:       #E0E0E0;
    --card:         #FFFFFF;
    --bg:           #F5F5F7;
    --shadow:       0 2px 12px rgba(0,0,0,0.08);
    --shadow-md:    0 4px 20px rgba(0,0,0,0.12);
    --radius:       16px;
    --radius-sm:    10px;
    --header-h:     56px;
}

/* ── 2. Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
table { border-collapse: collapse; }

/* ── 3. Utilities ── */
.sr-only { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; }

/* ── 4. Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
    letter-spacing: 0.02em;
    -webkit-user-select: none;
    user-select: none;
}
.btn:active { transform: scale(0.96); opacity: 0.9; }

.btn-primary {
    background: var(--pink);
    color: #fff;
}
.btn-primary:hover { background: var(--pink-dark); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-muted);
}

.btn-reveal {
    width: 100%;
    background: var(--pink);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    padding: 14px;
    margin-top: 16px;
}

.btn-understood {
    flex: 1;
    background: var(--green);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    font-size: 14px;
    font-weight: 700;
}

.btn-review {
    flex: 1;
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    font-size: 14px;
    font-weight: 700;
}

.btn-lg { padding: 16px 24px; font-size: 17px; }
.btn-full { width: 100%; }

/* ── 5. Index (Login) Page ── */
.index-body { background: var(--pink); }

.index-hero {
    padding: 56px 24px 40px;
    color: #fff;
    text-align: center;
}
.hero-logo {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.9;
    margin-bottom: 8px;
}
.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    margin-bottom: 24px;
}
.hero-title {
    font-size: 36px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}
.hero-sub {
    font-size: 14px;
    opacity: 0.85;
}

.index-content {
    background: var(--bg);
    border-radius: 24px 24px 0 0;
    padding: 32px 20px 48px;
    min-height: calc(100dvh - 220px);
}

.login-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}
.login-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
}
.login-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.04em;
}
.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
    background: var(--card);
}
.form-input:focus { border-color: var(--pink); }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-error { background: #FFEBEE; color: #C62828; }

.index-features {
    display: flex;
    justify-content: center;
    gap: 32px;
}
.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.feature-icon { font-size: 28px; }
.feature-text { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* ── 6. App Header ── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--pink);
    color: #fff;
    height: var(--header-h);
}
.header-inner {
    display: flex;
    align-items: center;
    height: var(--header-h);
    padding: 0 16px;
    gap: 12px;
}
.header-brand {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.05em;
    flex: 1;
}
.header-user {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-logout {
    font-size: 12px;
    opacity: 0.8;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    padding: 4px 10px;
}
.header-back {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
}
.header-title {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}
.header-counter {
    font-size: 14px;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 2px 10px;
    white-space: nowrap;
}

/* Step header (colored) */
.step-header { height: auto; }
.step-header .header-inner { height: var(--header-h); }

/* ── 7. Progress Bar ── */
.progress-bar-track {
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}
.header-progress { padding: 0 16px 8px; }

/* ── 8. Learn Page (Dashboard) ── */
.main-content {
    padding: 20px 16px 80px;
    max-width: 600px;
    margin: 0 auto;
}

.page-intro { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 800; }
.page-desc  { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* Formula card */
.formula-card {
    background: var(--pink-pale);
    border: 1px solid var(--pink-light);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}
.formula-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--pink-dark);
    margin-bottom: 10px;
    letter-spacing: 0.04em;
}
.formula-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.formula-step {
    background: var(--pink);
    color: #fff;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.formula-arrow {
    color: var(--pink);
    font-weight: 700;
    font-size: 14px;
}

/* Step cards */
.steps-list { display: flex; flex-direction: column; gap: 16px; }

.step-card {
    display: block;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.step-card:active { transform: scale(0.985); box-shadow: var(--shadow-md); }

.step-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    color: #fff;
}
.step-badge {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 4px 12px;
}
.step-progress-badge {
    font-size: 12px;
    font-weight: 700;
    background: rgba(0,0,0,0.2);
    border-radius: 20px;
    padding: 4px 10px;
}

.step-card-body { padding: 16px 18px; }
.step-name     { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.step-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

.step-card .progress-bar-track { background: var(--border); margin-bottom: 6px; }
.step-card .progress-bar-fill  { background: var(--green); }
.progress-text { font-size: 12px; color: var(--text-muted); }

.coming-soon-note {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 24px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

/* ── 9. Step Page ── */
.step-main {
    padding: 0 0 80px;
    max-width: 600px;
    margin: 0 auto;
}

/* Theory section */
.theory-section {
    background: var(--card);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.theory-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 18px;
    gap: 12px;
    cursor: pointer;
}
.theory-title  { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.theory-sub    { font-size: 13px; color: var(--text-muted); }
.theory-toggle {
    font-size: 12px;
    color: var(--pink);
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 2px;
}

.theory-body { padding: 0 18px 20px; }
.theory-block { margin-bottom: 16px; }
.theory-block-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--pink);
    margin-bottom: 6px;
}
.theory-block-content { font-size: 14px; line-height: 1.7; }

.theory-hint {
    background: var(--orange-light);
    border-left: 3px solid var(--orange);
    padding: 10px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
    color: var(--orange);
    font-weight: 600;
}

/* Questions section */
.questions-section { padding: 16px; }

.questions-header { margin-bottom: 14px; }
.questions-title  { font-size: 15px; font-weight: 700; color: var(--text-muted); }

/* Question card */
.question-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
    transition: border-color 0.3s;
}
.question-card.q-understood { border-left-color: var(--green); }
.question-card.q-review     { border-left-color: var(--orange); }

.q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.q-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}
.q-status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg);
    color: var(--text-muted);
}
.question-card.q-understood .q-status-badge { background: var(--green-light); color: var(--green); }
.question-card.q-review     .q-status-badge { background: var(--orange-light); color: var(--orange); }

.q-text {
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 14px;
    font-weight: 500;
}

.q-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.q-choice {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 14px;
    border: 2px solid var(--border);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    color: var(--text);
    font-family: inherit;
}
.q-choice:active { background: var(--border); }
.q-choice.correct { border-color: var(--green); background: #E8F5E9; font-weight: bold; }
.q-choice.wrong   { border-color: #e57373; background: #FFEBEE; }
.q-choice:disabled { cursor: default; }

.q-text-hint {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 4px;
}

/* Answer area */
.q-answer {
    display: none;
    margin-top: 16px;
    animation: fadeSlideIn 0.3s ease;
}
.q-answer.revealed { display: block; }

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.answer-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.answer-text {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    background: var(--green-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 14px;
}

.explanation-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.explanation-text {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
}

.q-action-buttons {
    display: flex;
    gap: 10px;
}

/* Step footer */
.step-footer {
    padding: 16px;
    text-align: center;
}

/* ── 10. Completion Banner ── */
.completion-banner {
    margin: 16px;
    background: var(--green-light);
    border: 1px solid var(--green);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    display: none;
}
.completion-banner.show { display: block; animation: fadeSlideIn 0.4s ease; }
.completion-title { font-size: 20px; font-weight: 800; color: var(--green); margin-bottom: 4px; }
.completion-sub   { font-size: 14px; color: var(--green); }

/* ── 11. Progress summary (step top) ── */
.step-progress-summary {
    background: var(--card);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}
.sps-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.sps-nums  { font-size: 14px; font-weight: 800; }
.sps-bar   { flex: 1; }

/* ── 12. Responsive (wider screens) ── */
@media (min-width: 640px) {
    .main-content, .step-main { padding-bottom: 60px; }
    .q-action-buttons .btn { font-size: 15px; padding: 16px; }
    .hero-title { font-size: 44px; }
}

/* ── 13. Section header cards ── */
.section-header-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 12px;
    color: #fff;
}
.section-header-icon {
    font-size: 24px;
    line-height: 1;
}
.section-header-title {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
}
.section-header-sub {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}
