/* アイマスカラーゲッサー */

:root {
    --cq-accent:      #e8588a;
    --cq-accent-dark: #b83c6a;
    --cq-mint:        #fdf0f8;
    --cq-mint-soft:   #fff8fc;
    --cq-ink:         #2a1f2e;
    --cq-muted:       #7a6880;
    --cq-line:        #e8d8ef;
}

.cq-outer {
    max-width: 680px;
}

/* ─── View switching ─── */
.cq-view { display: none; }
.cq-view.is-active { display: block; }

/* ─── Phase 1: Menu Hero ─── */
.cq-menu-hero {
    background: linear-gradient(160deg, #fff8fc 0%, #fdf0f8 60%, #f0f4ff 100%);
    border-radius: 22px;
    overflow: hidden;
    padding: 2rem 1.5rem 0;
    box-shadow: 0 18px 48px rgba(70, 30, 60, 0.14);
    color: var(--cq-ink);
    font-family: "Noto Sans JP", sans-serif;
}

.cq-hero-title {
    margin: 0;
    color: var(--cq-ink);
    font-size: clamp(1.4rem, 4vw, 1.9rem);
    font-weight: 900;
    font-family: "Zen Maru Gothic", sans-serif;
    text-align: center;
    line-height: 1.25;
}

.cq-hero-desc {
    color: var(--cq-muted);
    text-align: center;
    margin: 0.5rem 0 1rem;
    font-size: 0.88rem;
    line-height: 1.7;
}

.cq-hero-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin: 0 0 1.4rem;
}

.cq-hero-dots span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
    animation: cqDotPop 0.4s backwards cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cq-hero-dots span:nth-child(1) { animation-delay: 0.02s; }
.cq-hero-dots span:nth-child(2) { animation-delay: 0.07s; }
.cq-hero-dots span:nth-child(3) { animation-delay: 0.12s; }
.cq-hero-dots span:nth-child(4) { animation-delay: 0.17s; }
.cq-hero-dots span:nth-child(5) { animation-delay: 0.22s; }
.cq-hero-dots span:nth-child(6) { animation-delay: 0.27s; }

@keyframes cqDotPop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Loading */
.cq-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    gap: 0.8rem;
    color: var(--cq-muted);
    font-size: 0.88rem;
}

.cq-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--cq-line);
    border-top-color: var(--cq-accent);
    border-radius: 50%;
    animation: cqSpin 0.7s linear infinite;
}

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

/* Section label */
.cq-section-label {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 900;
    color: var(--cq-muted);
    letter-spacing: 0.06em;
    margin: 0.2rem 0 0.8rem;
    font-family: "Noto Sans JP", sans-serif;
}

/* Carousels */
.cq-mode-carousel,
.cq-brand-carousel {
    display: grid;
    grid-template-columns: 46px 1fr 46px;
    align-items: center;
    gap: 0.7rem;
    width: min(100%, 440px);
    margin: 0 auto;
}

.cq-carousel-arrow {
    width: 46px;
    height: 46px;
    border: 2px solid var(--cq-accent);
    border-radius: 50%;
    background: #fff;
    color: var(--cq-accent);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(70, 30, 60, 0.12);
    transition: transform 0.15s, background 0.15s, color 0.15s;
}

.cq-carousel-arrow:hover {
    transform: translateY(-2px);
    background: var(--cq-accent);
    color: #fff;
}

.cq-carousel-arrow:active { transform: scale(0.94); }

/* Mode display */
.cq-mode-display {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 66px;
    padding: 0.7rem 1rem;
    border-radius: 16px;
    background: #fff;
    border: 2px solid var(--cq-line);
    box-shadow: 0 6px 16px rgba(70, 30, 60, 0.08);
}

.cq-mode-disp-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: center;
    min-width: 0;
}

.cq-mode-disp-text b {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--cq-ink);
    font-family: "Noto Sans JP", sans-serif;
}

.cq-mode-disp-text small {
    font-size: 0.72rem;
    color: var(--cq-muted);
    font-family: "Noto Sans JP", sans-serif;
}

/* Brand display */
.cq-brand-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 132px;
    padding: 1.1rem 1rem;
    border-radius: 18px;
    background: #fff;
    border: 2px solid var(--cq-line);
    box-shadow: 0 6px 18px rgba(70, 30, 60, 0.08);
}

.cq-brand-display-logo {
    height: 44px;
    width: auto;
    max-width: 80%;
    object-fit: contain;
}

.cq-brand-display-name {
    font-size: 1rem;
    font-weight: 900;
    color: var(--cq-ink);
    font-family: "Zen Maru Gothic", sans-serif;
}

.cq-brand-display-sub {
    font-size: 0.72rem;
    color: var(--cq-muted);
    font-family: "Noto Sans JP", sans-serif;
}

/* Panels */
.cq-panel {
    margin-top: 1.3rem;
    padding-bottom: 1.5rem;
}

.cq-panel-action {
    display: flex;
    justify-content: center;
    margin-top: 1.2rem;
}

.cq-fade-in {
    animation: cqFadeIn 0.28s ease;
}

@keyframes cqFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Brand tabs (oshi mode) */
.cq-brand-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 6px;
    margin-bottom: 0.8rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.cq-brand-tab {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1.5px solid var(--cq-line);
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cq-ink);
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
    font-family: "Noto Sans JP", sans-serif;
}

.cq-brand-tab:hover { background: var(--cq-mint-soft); }

.cq-brand-tab.is-active {
    background: var(--cq-accent);
    border-color: var(--cq-accent);
    color: #fff;
}

.cq-brand-tab-logo {
    height: 15px;
    width: auto;
    display: block;
}

.cq-brand-tab.is-active .cq-brand-tab-logo { filter: brightness(0) invert(1); }

/* Idol grid */
.cq-idol-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: min(420px, 55vh);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--cq-line) transparent;
    padding-right: 2px;
}

@media (max-width: 700px) { .cq-idol-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) { .cq-idol-grid { grid-template-columns: repeat(3, 1fr); } }

.cq-idol-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    background: rgba(255, 255, 255, 0.7);
    user-select: none;
}

.cq-idol-card:hover { background: var(--cq-mint); }

.cq-idol-card.is-selected {
    border-color: var(--cq-accent);
    background: var(--cq-mint);
}

.cq-idol-card.is-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.cq-idol-icon-wrap {
    position: relative;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #edf0f4;
    overflow: hidden;
}

@media (max-width: 480px) { .cq-idol-icon-wrap { width: 68px; height: 68px; } }

.cq-idol-icon {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 12%;
    display: block;
    border: 0;
    background: #edf0f4;
}

.cq-idol-icon--ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--cq-muted);
    background: var(--cq-line);
    border: none;
}

.cq-idol-check {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(80, 80, 86, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
}

.cq-idol-name {
    font-size: 0.62rem;
    font-weight: 600;
    text-align: center;
    color: var(--cq-ink);
    line-height: 1.3;
    word-break: break-all;
    font-family: "Noto Sans JP", sans-serif;
}

/* Select bar (inside accordion body) */
.cq-select-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--cq-line);
}

.cq-select-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cq-select-actions .cq-btn-primary,
.cq-select-actions .cq-btn-ghost {
    min-height: 42px;
    padding: 0.5rem 0.8rem;
}

.cq-select-count {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--cq-muted);
    font-family: "Noto Sans JP", sans-serif;
}

.cq-select-count b {
    font-size: 1.4rem;
    font-family: "Noto Sans JP", sans-serif;
    color: var(--cq-accent);
    line-height: 1;
}

.cq-player-name-field {
    display: grid;
    gap: 0.35rem;
    width: min(100%, 320px);
    margin: 0.7rem auto 1.5rem;
    color: var(--cq-muted);
    font: 800 0.78rem "Noto Sans JP", sans-serif;
    text-align: center;
}

.cq-player-name-field input {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    border: 1px solid var(--cq-line);
    border-radius: 12px;
    padding: 0.55rem 0.8rem;
    background: #fff;
    color: var(--cq-ink);
    font: 800 0.95rem "Noto Sans JP", sans-serif;
}

/* ─── Buttons ─── */
.cq-btn-primary,
.cq-btn-ghost {
    border-radius: 12px;
    min-height: 48px;
    padding: 0.65rem 1.2rem;
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 900;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, background 0.14s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.cq-btn-primary {
    background: var(--cq-accent);
    border: 1px solid var(--cq-accent);
    color: #fff;
}

.cq-btn-primary:hover:not(:disabled) {
    background: var(--cq-accent-dark);
    border-color: var(--cq-accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(232, 88, 138, 0.28);
}

.cq-btn-primary:disabled {
    opacity: 0.4;
    cursor: default;
}

.cq-btn-ghost {
    background: #fff;
    border: 1px solid var(--cq-line);
    color: var(--cq-accent-dark);
}

.cq-btn-ghost:hover {
    background: var(--cq-mint);
    border-color: var(--cq-accent);
}

/* ─── Phase 2: Quiz Shell ─── */
.cq-quiz-shell {
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(70, 30, 60, 0.14);
    color: var(--cq-ink);
    font-family: "Noto Sans JP", sans-serif;
}

/* HUD */
.cq-quiz-hud {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 0.8rem 0.9rem 0;
}

.cq-quiz-hud > div {
    justify-self: end;
    text-align: right;
}

.cq-hud-back {
    min-height: 34px;
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--cq-muted);
    font-family: "Noto Sans JP", sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 8px;
    transition: color 0.12s, background 0.12s;
}

.cq-hud-back:hover {
    color: var(--cq-accent-dark);
    background: var(--cq-mint);
}

#cqRoundLabel {
    display: inline-flex;
    align-items: baseline;
    gap: 0.08em;
    color: var(--cq-accent-dark);
    line-height: 1;
}

#cqRoundLabel span {
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 900;
    color: var(--cq-accent);
    font-size: clamp(2rem, 6vw, 3rem);
}

#cqRoundLabel small {
    font-size: clamp(0.78rem, 2vw, 0.95rem);
    font-weight: 900;
    font-family: "Noto Sans JP", sans-serif;
    color: var(--cq-muted);
}

/* Card stage (idol portrait zone) */
.cq-card-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 1.8rem 1rem 2.8rem;
    border-radius: 0 0 48px 48px;
    background: linear-gradient(160deg, #fff8fc 0%, #fdf0f8 100%);
    overflow: hidden;
}

/* Watermark */
.cq-watermark {
    position: absolute;
    bottom: -0.2em;
    right: -0.1em;
    font-size: clamp(12rem, 38vw, 22rem);
    font-family: "Dela Gothic One", sans-serif;
    line-height: 1;
    color: #000;
    opacity: 0.04;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 0;
}

/* Idol display */
.cq-idol-display {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}

.cq-portrait-frame {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.9);
    background: #f0ecf5;
    box-shadow: 0 8px 24px rgba(70, 30, 60, 0.16);
}

.cq-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 15%;
    display: block;
}

.cq-idol-name-disp {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    font-weight: 900;
    font-family: "Zen Maru Gothic", sans-serif;
    color: var(--cq-ink);
    text-align: center;
}

.cq-idol-brand-tag {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--cq-muted);
    border: 1px solid var(--cq-line);
}

/* Answer stage (color picker) */
.cq-answer-stage {
    padding: 1.4rem 1.2rem 1.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
}

.cq-pick-hint {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--cq-muted);
    letter-spacing: 0.02em;
    margin: 0;
    font-family: "Noto Sans JP", sans-serif;
}

/* SL picker face */
.sl-picker {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1;
    border-radius: 12px;
    position: relative;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.sl-cursor {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Hue rail */
.hue-rail {
    width: 100%;
    max-width: 300px;
    height: 26px;
    border-radius: 13px;
    background: linear-gradient(to right,
        #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
    position: relative;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
}

.hue-thumb {
    position: absolute;
    top: 50%;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Preview row */
.picker-preview-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    max-width: 300px;
}

.picker-preview-swatch {
    width: 100%;
    height: 54px;
    border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.picker-preview-hex {
    display: none;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: monospace;
    color: var(--cq-muted);
    letter-spacing: 0.06em;
}

.answer-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 0.6rem;
    width: 100%;
    max-width: 300px;
}

.answer-mode-toggle {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
}

.color-code-input {
    width: 100%;
    max-width: 300px;
    min-height: 48px;
    border: 1px solid var(--cq-line);
    border-radius: 12px;
    padding: 0.65rem 1rem;
    background: #fff;
    color: var(--cq-ink);
    font: 800 1rem monospace;
    letter-spacing: 0.08em;
    text-align: center;
}

.color-code-input.is-invalid {
    border-color: #ef4444;
    background: #fff1f2;
}

.cq-submit-btn {
    width: 100%;
}

/* Reveal stage */
.cq-reveal-stage {
    border-top: 1px solid var(--cq-line);
}

.cq-reveal-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--cq-line);
    box-shadow: 0 4px 16px rgba(70, 30, 60, 0.14);
    animation: cqPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cqPopIn {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.cq-reveal-colors {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cq-color-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.cq-color-swatch {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cq-color-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--cq-muted);
    font-family: "Noto Sans JP", sans-serif;
}

.cq-color-hex {
    font-size: 0.72rem;
    font-family: monospace;
    color: var(--cq-muted);
}

.cq-arrow {
    font-size: 1rem;
    color: var(--cq-line);
}

.cq-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    line-height: 1;
}

.cq-score-line {
    display: flex;
    align-items: baseline;
}

.cq-score-num {
    font-size: 3.4rem;
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 900;
    line-height: 1;
}

.cq-score-pct {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cq-muted);
    font-family: "Noto Sans JP", sans-serif;
    margin-left: 2px;
}

.cq-grade-badge {
    display: inline-block;
    padding: 3px 16px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 900;
    border: 2px solid currentColor;
    font-family: "Noto Sans JP", sans-serif;
}

/* Breakdown bars */
.cq-breakdown {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.cq-bd-row {
    display: grid;
    grid-template-columns: 4.2em 1fr 2.2em;
    align-items: center;
    gap: 9px;
}

/* 無彩色で色相が評価対象外のとき */
.cq-bd-row.is-disabled { opacity: 0.4; }
.cq-bd-row.is-disabled .cq-bd-fill { background: var(--cq-line) !important; width: 0 !important; }

.cq-bd-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--cq-muted);
    font-family: "Noto Sans JP", sans-serif;
}

.cq-bd-track {
    height: 10px;
    border-radius: 5px;
    background: var(--cq-line);
    overflow: hidden;
}

.cq-bd-fill {
    height: 100%;
    width: 0;
    border-radius: 5px;
    background: var(--cq-accent);
    transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.cq-bd-val {
    font-size: 0.8rem;
    font-weight: 800;
    font-family: "Noto Sans JP", sans-serif;
    color: var(--cq-ink);
    text-align: right;
}

.cq-next-btn {
    flex: 1;
    max-width: 200px;
}

.cq-reveal-capture {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
}

.cq-reveal-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    max-width: 320px;
}

.cq-reveal-save-btn {
    flex: 0 0 auto;
    width: 48px;
    min-width: 48px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Animations */
.cq-answer-animate {
    animation: cqReveal 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cqReveal {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

.cq-phase-enter {
    animation: cqPhaseIn 0.3s ease;
}

@keyframes cqPhaseIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Phase 3: Result ─── */
.cq-result-shell { overflow: hidden; }

.cq-result-header {
    --result-grade-from: var(--cq-ink);
    --result-grade-to: #4a2060;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    padding: 1.8rem 1.5rem 1.6rem;
    background: linear-gradient(160deg, var(--result-grade-from) 0%, var(--result-grade-to) 100%);
    color: #fff;
}

.cq-result-player {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    font-family: "Noto Sans JP", sans-serif;
}

.cq-result-player:empty { display: none; }

.cq-result-headline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
}

.cq-result-grade-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    padding: 0 0.5rem;
    font-size: 3rem;
    font-weight: 900;
    font-family: "Dela Gothic One", "Noto Sans JP", sans-serif;
    line-height: 1;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.cq-result-score-block {
    display: flex;
    align-items: baseline;
    gap: 0.15rem;
}

.cq-result-big-num {
    font-size: 4rem;
    font-family: "Dela Gothic One", "Noto Sans JP", sans-serif;
    font-weight: 900;
    line-height: 0.9;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.cq-result-pct-label {
    font-size: 1.3rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.78);
    font-family: "Noto Sans JP", sans-serif;
}

.cq-result-meter {
    width: min(100%, 280px);
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.cq-result-meter-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.cq-result-idol-list { padding: 0.3rem 0; }

.cq-result-omitted {
    margin: 0.4rem 0.7rem;
    padding: 0.4rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--cq-muted);
    font-family: "Noto Sans JP", sans-serif;
}


/* 振り返り行：イラストの目線帯をマスク表示。背景は左=回答色／右=正解色の分割 */
.cq-result-row {
    position: relative;
    height: 88px;
    margin: 0.45rem 0.7rem;
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(90deg,
        var(--guess-color) 0%,
        var(--guess-color) 44%,
        var(--actual-color) 56%,
        var(--actual-color) 100%);
    box-shadow: 0 4px 12px rgba(70, 30, 60, 0.12);
    transition: transform 0.1s, box-shadow 0.1s;
}

.cq-result-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(70, 30, 60, 0.18);
}

/* 立ち絵：<img>で配置（位置・サイズは JS の RESULT_ART_POS）。
   立ち絵自身の右端を基準に、60%まで不透明→70%で完全透明にフェード。 */
.cq-result-band {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: auto;
    max-width: none;
    object-fit: cover;
    -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent 100%);
            mask-image: linear-gradient(90deg, #000 90%, transparent 100%);
}

.cq-result-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0.5rem 0.75rem;
    color: #fff;
}

.cq-result-top {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
}

.cq-result-name {
    font-size: 0.95rem;
    font-weight: 900;
    color: #fff;
    font-family: "Zen Maru Gothic", "Noto Sans JP", sans-serif;
    text-shadow:
        0 0 2px rgba(0, 0, 0, 0.9),
        0 1px 3px rgba(0, 0, 0, 0.85),
        0 2px 8px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cq-result-score {
    flex-shrink: 0;
    display: inline-flex;
    align-items: baseline;
    gap: 0.1rem;
    font-size: 1.4rem;
    font-weight: 900;
    font-family: "Dela Gothic One", "Noto Sans JP", sans-serif;
    color: #fff;
    text-shadow:
        0 0 2px rgba(0, 0, 0, 0.9),
        0 1px 4px rgba(0, 0, 0, 0.85),
        0 2px 9px rgba(0, 0, 0, 0.6);
}

.cq-result-score small {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: "Noto Sans JP", sans-serif;
}

.cq-result-score i {
    font-size: 0.7rem;
    margin-left: 0.2rem;
    opacity: 0.85;
}

.cq-result-legend {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.18rem;
}

.cq-result-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: monospace;
    font-size: 0.66rem;
    font-weight: 700;
    color: #fff;
    text-shadow:
        0 0 2px rgba(0, 0, 0, 0.95),
        0 1px 3px rgba(0, 0, 0, 0.9);
    letter-spacing: 0.02em;
}

.cq-result-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    flex-shrink: 0;
}

.cq-result-actions {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid var(--cq-line);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
}

.cq-result-actions > .cq-btn-primary,
.cq-result-actions > .cq-btn-ghost { width: 100%; }

/* Share popover */
.cq-result-share {
    position: relative;
    display: flex;
}

.cq-share-trigger { width: 100%; }

.cq-share-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    z-index: 50;
}

.cq-share-popover[hidden] { display: none; }

.cq-share-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #fff;
}

.cq-share-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #f3f0f6;
    color: var(--cq-ink);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.12s, transform 0.12s;
}

.cq-share-icon:hover {
    background: #e8def0;
    transform: translateY(-1px);
}

.cq-share-icon--x {
    background: #000;
    color: #fff;
}

.cq-share-icon--x:hover { background: #333; }

.cq-share-icon.is-copied {
    background: var(--cq-accent);
    color: #fff;
}

/* Xシェア確認モーダル */
.cq-xshare-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cq-xshare-modal.is-open { display: flex; }

.cq-xshare-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 10, 24, 0.5);
}

.cq-xshare-modal__panel {
    position: relative;
    width: min(92vw, 380px);
    background: #fff;
    border-radius: 18px;
    padding: 1.5rem 1.3rem 1.2rem;
    box-shadow: 0 24px 60px rgba(20, 10, 24, 0.3);
    text-align: center;
    font-family: "Noto Sans JP", sans-serif;
}

.cq-xshare-modal__title {
    margin: 0 0 0.7rem;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--cq-ink);
}

.cq-xshare-modal__message {
    margin: 0 0 1.2rem;
    font-size: 0.86rem;
    line-height: 1.7;
    color: var(--cq-muted);
}

.cq-xshare-modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.cq-xshare-modal__actions .cq-btn-primary,
.cq-xshare-modal__actions .cq-btn-ghost { width: 100%; }

.cq-xshare-modal__cancel {
    margin-top: 0.7rem;
    border: none;
    background: transparent;
    color: var(--cq-muted);
    font-family: "Noto Sans JP", sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.4rem;
}

.cq-xshare-modal__cancel:hover { color: var(--cq-ink); }

/* Ranking */
.cq-ranking-section {
    --ranking-color: var(--cq-accent);
    margin-top: 1.2rem;
    padding: 1.2rem;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--cq-line);
    box-shadow: 0 10px 28px rgba(70, 30, 60, 0.08);
    font-family: "Noto Sans JP", sans-serif;
}

.cq-ranking-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin: 0 0 0.9rem;
}

.cq-ranking-title {
    margin: 0;
    color: var(--cq-ink);
    font-size: 1.05rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.cq-ranking-note {
    margin: 0;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--cq-muted);
    text-align: right;
}

.cq-ranking-tabs {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.55rem;
    margin-bottom: 0.6rem;
    scrollbar-width: thin;
}

.cq-ranking-tab {
    flex: 0 0 auto;
    border: 1px solid color-mix(in srgb, var(--brand-color, var(--cq-accent)) 46%, #fff);
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand-color, var(--cq-accent)) 10%, #fff);
    color: color-mix(in srgb, var(--brand-color, var(--cq-accent)) 76%, #1f2937);
    padding: 0.42rem 0.8rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 900;
    cursor: pointer;
}

.cq-ranking-tab.is-active {
    background: var(--brand-color, var(--cq-accent));
    border-color: var(--brand-color, var(--cq-accent));
    color: #fff;
}

.cq-ranking-list {
    list-style: none;
    display: grid;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
}

.cq-ranking-item {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) 3.6rem 4rem;
    align-items: center;
    gap: 0.55rem;
    min-height: 48px;
    padding: 0.45rem 0.6rem;
    border-radius: 10px;
    background: var(--cq-mint-soft);
}

.cq-ranking-item.is-mine {
    outline: 2px solid var(--ranking-color);
    background: color-mix(in srgb, var(--ranking-color) 12%, #fff);
}

.cq-ranking-pos {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #fff;
    color: var(--cq-muted);
    font-weight: 900;
}

.cq-ranking-pos.is-top {
    color: #fff;
    background: var(--ranking-color);
}

.cq-ranking-main {
    min-width: 0;
    display: block;
    color: var(--cq-ink);
    font-weight: 900;
}

.cq-ranking-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cq-ranking-rank,
.cq-ranking-score {
    color: var(--cq-ink);
    font-weight: 900;
    text-align: right;
}

.cq-ranking-rank {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
}

.cq-ranking-rank i {
    font-size: 0.7rem;
}

.cq-ranking-score {
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 900;
}

.cq-ranking-msg {
    padding: 1rem;
    color: var(--cq-muted);
    text-align: center;
}

.cq-ranking-more {
    display: flex;
    justify-content: center;
    margin-top: 0.8rem;
}

/* Disclaimer */
.cq-disclaimer {
    margin-top: 2rem;
    padding: 1rem;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border-color, #e8e8e8);
    font-size: 0.78rem;
    color: #888;
    text-align: center;
    line-height: 1.7;
    font-family: "Noto Sans JP", sans-serif;
}
