/* ===== START SCREEN ===== */
.quiz-start-screen {
    position: relative;
    padding: 40px 32px 32px;
    text-align: center;
    z-index: 1;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

/* Hero Section - Icon + Title + Badge */
.quiz-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.quiz-start-icon {
    display: none;
}

.quiz-start-icon-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    background: #FAFAF7;
    box-shadow:
        0 6px 24px rgba(61, 90, 128, 0.09),
        0 3px 10px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    padding: 12px;
    border: 2.5px solid rgba(61, 90, 128, 0.15);
}

@keyframes mascotBounce {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    25% { transform: translateY(-6px) scale(1.03) rotate(-2deg); }
    50% { transform: translateY(-8px) scale(1.04) rotate(0deg); }
    75% { transform: translateY(-4px) scale(1.02) rotate(2deg); }
}

.quiz-start-title {
    font-size: 1.8em;
    font-weight: 600;
    color: #2C2C2C;
    margin: 0;
    letter-spacing: -0.02em;
}

/* Pool Badge - plain text */
.quiz-pool-badge {
    font-size: 0.85em;
    font-weight: 500;
    color: var(--quiz-text-muted);
    margin: 0 0 20px 0;
    padding: 0;
    background: none;
    border-radius: 0;
}

.quiz-pool-badge span {
    font-weight: 600;
    color: #57534e;
}

/* Daily Streak Display */
/* Streak display hidden — gamification pattern, not 和の感性 */
.quiz-streak-display {
    display: none !important;
}

.quiz-streak-fire {
    font-size: 1.2em;
    color: #7c6a3e;
    opacity: 0.7;
}

.quiz-streak-count {
    font-size: 1.3em;
    font-weight: 800;
    color: #57534e;
}

.quiz-streak-label {
    font-size: 0.95em;
    font-weight: 600;
    color: #78716c;
}

.quiz-streak-best {
    font-size: 0.85em;
    color: #7c6a3e;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid rgba(201, 169, 110, 0.3);
}

.quiz-streak-best:empty {
    display: none;
}

/* Settings wrapper - legacy */
.quiz-start-subtitle {
    display: none;
}

.quiz-start-stats {
    display: none;
}

/* Config Cards - no card styling */
.quiz-config-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-config-header {
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-config-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--quiz-text-muted);
    letter-spacing: 0.3px;
}

/* Quiz Length Buttons - plain text selector */
.quiz-length-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    padding: 4px 0;
    gap: 8px;
    width: 100%;
    max-width: 320px;
}

/* Hide container when empty */
.quiz-length-buttons:empty {
    display: none;
}

.quiz-length-btn {
    flex: 0 0 auto;
    min-width: 40px;
    padding: 10px 18px;
    font-size: 0.88em;
    font-weight: 500;
    color: #8C8578;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.quiz-length-btn:hover:not(.active) {
    color: #57534e;
}

.quiz-length-btn.active {
    color: #2C2C2C;
    background: transparent;
    border-bottom-color: #2C2C2C;
    font-weight: 600;
    box-shadow: none;
}

.quiz-length-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Quiz Mode Buttons - Larger card-style buttons */
.quiz-mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quiz-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 12px;
    background: #FAFAF7;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.quiz-mode-btn:hover:not(.active) {
    border-color: rgba(var(--quiz-primary-rgb), 0.3);
    background: rgba(var(--quiz-primary-rgb), 0.04);
}

.quiz-mode-btn.active {
    border-color: var(--quiz-primary-text);
    background: rgba(var(--quiz-primary-rgb), 0.06);
    box-shadow: 0 0 0 3px rgba(var(--quiz-primary-rgb), 0.12);
}

.quiz-mode-icon {
    font-size: 1.6em;
    line-height: 1;
}

.quiz-mode-label {
    font-size: 0.9em;
    font-weight: 600;
    color: #2C2C2C;
}

.quiz-mode-btn.active .quiz-mode-label {
    color: var(--quiz-primary-dark);
}

.quiz-mode-desc {
    font-size: 0.75em;
    font-weight: 500;
    color: var(--quiz-text-muted);
}

.quiz-mode-btn.active .quiz-mode-desc {
    color: var(--quiz-primary-text);
}

/* ============================================
   PREMIUM RING TIMER
   ============================================ */
.quiz-timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    position: relative;
}

/* Ring Timer */
.quiz-timer-ring {
    position: relative;
    width: 90px;
    height: 90px;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.06);
    stroke-width: 6;
}

.timer-progress {
    fill: none;
    stroke: var(--quiz-primary);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 264; /* 2 * PI * 42 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
    filter: drop-shadow(0 0 6px rgba(var(--quiz-primary-rgb), 0.4));
}

.timer-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.timer-seconds {
    font-size: 1.8em;
    font-weight: 800;
    color: var(--quiz-primary-dark);
    line-height: 1;
    transition: color 0.3s ease, transform 0.1s ease;
}

.timer-label {
    font-size: 0.65em;
    font-weight: 600;
    color: var(--quiz-text-muted);
    letter-spacing: 0.05em;
}

/* Glow effect behind ring */
.timer-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(var(--quiz-primary-rgb), 0.08);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* === URGENCY STATES === */

/* Warning state (50-25% time) */
.quiz-timer-ring.timer-warning .timer-progress {
    stroke: #C9A96E;
    filter: drop-shadow(0 0 8px rgba(201, 169, 110, 0.5));
}

.quiz-timer-ring.timer-warning .timer-seconds {
    color: #7c6a3e;
}

.quiz-timer-ring.timer-warning .timer-glow {
    opacity: 1;
    background: rgba(201, 169, 110, 0.10);
}

/* Critical state (<25% time) */
.quiz-timer-ring.timer-critical .timer-progress {
    stroke: #A3604E;
    filter: drop-shadow(0 0 10px rgba(163, 96, 78, 0.4));
    animation: ringPulse 0.6s ease-in-out infinite;
}

.quiz-timer-ring.timer-critical .timer-seconds {
    color: #A3604E;
    animation: numberPulse 0.6s ease-in-out infinite;
}

.quiz-timer-ring.timer-critical .timer-glow {
    opacity: 1;
    background: rgba(163, 96, 78, 0.12);
    animation: glowPulse 0.6s ease-in-out infinite;
}

/* Urgent state (<10% time) - more intense */
.quiz-timer-ring.timer-urgent .timer-progress {
    stroke: #A3604E;
    filter: drop-shadow(0 0 12px rgba(163, 96, 78, 0.4));
    animation: ringPulse 0.4s ease-in-out infinite;
}

.quiz-timer-ring.timer-urgent .timer-seconds {
    color: #A3604E;
    animation: urgentShake 0.4s ease-in-out infinite;
}

.quiz-timer-ring.timer-urgent .timer-glow {
    opacity: 1;
    background: rgba(163, 96, 78, 0.15);
    animation: glowPulse 0.4s ease-in-out infinite;
}

/* Timer animations */
@keyframes ringPulse {
    0%, 100% {
        stroke-width: 6;
        filter: drop-shadow(0 0 10px rgba(163, 96, 78, 0.4));
    }
    50% {
        stroke-width: 7;
        filter: drop-shadow(0 0 14px rgba(163, 96, 78, 0.6));
    }
}

@keyframes numberPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Merged numberPulse + shake: scale + translateX on same property */
@keyframes urgentShake {
    0%, 100% { transform: translateX(0) scale(1); }
    25% { transform: translateX(-2px) scale(1.08); }
    50% { transform: translateX(0) scale(1.08); }
    75% { transform: translateX(2px) scale(1.08); }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0) scale(1); }
    25% { transform: translateX(-2px) scale(1.08); }
    75% { transform: translateX(2px) scale(1.08); }
}

/* === TIME BONUS === */
.time-bonus {
    position: absolute;
    top: -10px;
    right: -20px;
    font-size: 1.1em;
    font-weight: 800;
    color: #4E6F3E;
    opacity: 0;
    transform: translateY(10px) scale(0.8);
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(78, 111, 62, 0.24);
}

.time-bonus.show {
    animation: bonusPopup 1s ease-out forwards;
}

@keyframes bonusPopup {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translateY(-5px) scale(1.1);
    }
    80% {
        opacity: 1;
        transform: translateY(-15px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-25px) scale(0.9);
    }
}

/* === SPEED STREAK === */
.speed-streak {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: rgba(201, 169, 110, 0.12);
    border-radius: 20px;
    border: 1px solid rgba(201, 169, 110, 0.3);
    box-shadow: 0 2px 8px rgba(201, 169, 110, 0.12);
}

.speed-streak .streak-fire {
    font-size: 1em;
    animation: fireWiggle 0.5s ease-in-out infinite;
}

.speed-streak .streak-count {
    font-size: 0.9em;
    font-weight: 800;
    color: #7c6a3e;
}

@keyframes fireWiggle {
    0%, 100% { transform: rotate(-5deg) scale(1); }
    50% { transform: rotate(5deg) scale(1.1); }
}

/* Speed mode - show minutes:seconds format */
.quiz-timer-ring.speed-mode .timer-label {
    display: none;
}

.quiz-timer-ring.speed-mode .timer-seconds {
    font-size: 1.4em;
}

/* ===== NEW QUIZ START SCREEN VIEWS ===== */

/* Resume View - shown when there's saved progress */
.quiz-resume-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #FAFAF7;
    border: 1.5px solid rgba(61, 90, 128, 0.12);
    border-radius: 16px;
    margin: 0 -4px;
}

.quiz-resume-view .quiz-start-title {
    font-size: 1.5em;
    margin-bottom: 8px;
}

/* Visual progress dots for resume */
.quiz-resume-progress-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    border: 1px solid rgba(61, 90, 128, 0.08);
}

.quiz-resume-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 280px;
}

.quiz-resume-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.quiz-resume-dot.filled {
    background: var(--quiz-primary);
    box-shadow: 0 2px 6px rgba(var(--quiz-primary-rgb), 0.3);
}

.quiz-resume-dot.empty {
    background: rgba(0, 0, 0, 0.06);
}

.quiz-resume-count {
    font-size: 1.1em;
    font-weight: 700;
    color: #57534e;
}

.quiz-resume-view .quiz-resume-time {
    font-size: 0.9em;
    color: var(--quiz-text-muted);
}

/* New Quiz View - shown when no saved progress */
.quiz-new-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
}

.quiz-new-view .quiz-start-title {
    font-size: 1.8em;
    margin-bottom: 0;
}

.quiz-new-view .quiz-length-buttons {
    margin: 8px 0;
}

/* Secondary button style (Start Fresh) */
.quiz-secondary-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 1em;
    font-weight: 600;
    color: #8C8578;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.quiz-secondary-btn:hover {
    color: #475569;
    background: rgba(0, 0, 0, 0.04);
}

/* Hide dashboard button on start screen — Karesansui: fewer exits */
.quiz-new-view .quiz-secondary-btn {
    display: none;
}

/* ============================================
   KARESANSUI START — 練習 kanji header
   ============================================ */
.quiz-start-kanji {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    font-size: 2.8em;
    font-weight: 400;
    color: #2C2C2C;
    letter-spacing: 0.06em;
    line-height: 1.2;
}

.quiz-start-kanji-sub {
    font-family: 'Inter', sans-serif;
    font-size: 0.88em;
    font-weight: 400;
    color: #8c8578;
    margin-bottom: 36px;
}

/* Legacy Resume Section (can be removed after migration) */
.quiz-resume-section {
    display: none;
}

/* Settings wrapper */
.quiz-settings {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    margin-top: 4px;
}

.quiz-start-btn {
    position: relative;
    width: 100%;
    padding: 15px 24px;
    margin-top: 4px;
    font-size: 0.95em;
    font-weight: 600;
    color: white;
    background: var(--quiz-primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 2px 8px rgba(var(--quiz-primary-rgb), 0.2);
    letter-spacing: 0.01em;
}

.quiz-start-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--quiz-primary-hover);
    box-shadow: 0 4px 12px rgba(var(--quiz-primary-rgb), 0.25);
}

.quiz-start-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.quiz-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--quiz-text-muted);
    box-shadow: none;
}

/* ===== OPTIONS PANEL ===== */
.quiz-options-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--quiz-text-muted);
    cursor: pointer;
    transition: color 0.15s ease;
    user-select: none;
}

.quiz-options-toggle:hover {
    color: var(--quiz-text-muted-hover);
}

.quiz-options-toggle.open {
    color: var(--quiz-primary-text);
}

.quiz-options-arrow {
    font-size: 0.9em;
    transition: transform 0.2s ease;
}

.quiz-options-panel {
    width: 100%;
    padding: 14px;
    background: #FAFAF7;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: optionsPanelReveal 0.2s ease-out;
}

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

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

.quiz-option-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.72em;
    font-weight: 600;
    color: var(--quiz-text-muted);
    letter-spacing: 0.3px;
    text-align: left;
}

/* Word filter buttons */
.quiz-word-filter {
    display: flex;
    gap: 4px;
    background: #FAFAF7;
    border-radius: 10px;
    padding: 3px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.quiz-filter-btn {
    flex: 1;
    padding: 7px 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--quiz-text-muted);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.quiz-filter-btn:hover:not(.active) {
    color: var(--quiz-text-muted-hover);
    background: rgba(0, 0, 0, 0.03);
}

.quiz-filter-btn.active {
    color: white;
    background: var(--quiz-primary);
    box-shadow: 0 2px 6px rgba(var(--quiz-primary-rgb), 0.3);
}

/* Deep Mode toggle switch */
.quiz-toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.quiz-toggle-switch input {
    display: none;
}

.quiz-toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.quiz-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.quiz-toggle-switch input:checked + .quiz-toggle-slider {
    background: var(--quiz-primary, #3D5A80);
}

.quiz-toggle-switch input:checked + .quiz-toggle-slider::after {
    transform: translateX(16px);
}

.quiz-toggle-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.8em;
    color: #8C8578;
    font-weight: 500;
}

