:root {
    --primary-color: #4a4a4a;
    /* Soft Black */
    --secondary-color: #faf9f6;
    /* Warm Off-White */
    --accent-color: #16a1b4;
    /* Teal */
    --accent-warm: #e65f5c;
    /* Soft Red for warmth */
    --gold: #d4af37;
    --text-color: #333333;
    --bg-color: #fdfcf8;
    /* Very light cream */
    --card-bg: #ffffff;
    --font-main: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --border-radius: 16px;
    --primary-orange: #f78d0c;
}

/* Utilities */
.u-mb-0 {
    margin-bottom: 0 !important;
}

.u-mb-sm {
    margin-bottom: 1rem !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.8;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url('assets/images/bg-uma.jpg');
    background-size: 1400px 852px;
    background-position: center top;
    background-repeat: repeat;
}

.app-container {
    width: 100%;
    max-width: 600px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

/* .app-container::before,
.app-container::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    width: 50vw;
    background-repeat: repeat;
    pointer-events: none;
    opacity: 0.7;
}

.app-container::before {
    right: calc(50% + 240px);
    background-image: url('assets/images/bg-uma-rp01.png');
    background-position: right top;
    background-size: 613px 852px;
    z-index: -1;
}

.app-container::after {
    left: calc(50% + 240px);
    background-image: url('assets/images/bg-uma-rp02.png');
    background-position: left top;
    background-size: 650px 852px;
    z-index: -1;
} */

/* Screen Management */
.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.8s ease-out;
}

/* Top Screen Container */
.top-container {
    position: relative;
    z-index: 1;
    width: 100%;
    /* max-width: 480px; */
    /* Removed to allow full width image if needed, but keeping generally centered */
    max-width: 480px;
    min-height: 100vh;
    padding: 25px 18px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* justify-content: center; */
    /* Changed to flex-start or space-between layout */
    background-color: #FCF6E7;
    box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    /* Allow scrolling if content is tall */
    overflow-x: hidden;
}

.top-logo {
    width: 142px;
    align-self: flex-start;
    margin-bottom: 1rem;
    display: block;
}

.top-main-visual {
    display: flex;
    justify-content: center;
    margin-bottom: 0;
}

.intro-img {
    width: calc(100% + 36px);
    height: auto;
    display: block;
}

.top-intro-text {
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 16px;
    line-height: 1.9;
    text-align: center;
    color: #000000;
    margin-bottom: 30px;
    width: 100%;
}

/* Update btn-primary to match Figma exactly */
.btn-primary {
    background-color: var(--primary-orange);
    color: white;
    box-shadow: 0 4px 10px rgba(247, 141, 12, 0.3);
    height: 68px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    max-width: 358px;
    margin: 0 auto 1rem;
}

.btn-primary#btn-start {
    background-color: #8C6239;
    box-shadow: none;
}

.btn-primary:hover {
    background-color: #e07d00;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(247, 141, 12, 0.4);
}


/* Buttons */
button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: var(--font-main);
    width: 100%;
    padding: 1.2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.btn-primary {
    background-color: #FF9A1E;
    color: white;
    box-shadow: 0 4px 10px rgba(255, 154, 30, 0.3);
}

.btn-primary:hover {
    background-color: #e88a15;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 154, 30, 0.4);
}

.btn-secondary {
    background: white;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    /* Match btn-primary dimensions */
    height: 68px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    max-width: 358px;
    width: 100%;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    /* Slight shadow for visibility */
}

.btn-secondary:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(22, 161, 180, 0.3);
    /* Match accent color shadow */
}

/* Hero Image removed (or reused if needed elsewhere) */

/* Quiz Styles */
#screen-quiz {
    padding: 0;
}

.quiz-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    padding: 60px 20px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #1EBECD;
    box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.25);
    overflow: scroll;
}

.progress-bar {
    width: 100%;
    max-width: 380px;
    height: 10px;
    min-height: 10px;
    background: white;
    border-radius: 5px;
    margin-bottom: 3.2rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #FF9A1E;
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 5px;
}

.quiz-number {
    font-family: 'Jost', sans-serif;
    font-size: 50px;
    font-weight: 600;
    color: white;
    text-align: center;
    line-height: 1;
    margin-bottom: 1.8rem;
}

.question-text {
    font-family: var(--font-main);
    font-size: 22px;
    font-weight: 700;
    color: white;
    text-align: center;
    line-height: 1.6;
    letter-spacing: 0.07em;
    margin-bottom: 3.1rem;
    max-width: 380px;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: fit-content;
    min-width: 390px;
    max-width: 100%;
}

.option-button {
    background: white;
    color: #000000;
    padding: 25px 20px;
    border-radius: 92px;
    border: none;
    text-align: center;
    box-shadow: 0 11px 0 0 #0A838E;
    transition: all 0.3s ease;
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.42;
    letter-spacing: 0.06em;
    min-height: 116px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

@media (hover: hover) {
    .option-button:hover {
        color: #3fbecd;
        transform: translateY(7px);
        box-shadow: 0 0px 0 0 #0A838E;
    }
}

.option-button:active {
    color: #3fbecd;
    transform: translateY(7px);
    box-shadow: 0 0px 0 0 #0A838E;
}



/* Race Styles */
.track {
    width: 100%;
    height: 80px;
    background: white;
    border-radius: 40px;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
    border: 2px solid #f0f0f0;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

.horse-runner {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) scaleX(-1);
    height: 60px;
    /* Adjust based on image aspect ratio */
    width: auto;
    left: 0;
    transition: left 0.1s linear;
    animation: horseRun 0.4s ease-in-out infinite;
}

@keyframes horseRun {

    0%,
    100% {
        transform: translateY(-50%) scaleX(-1) rotate(-40deg);
    }

    50% {
        transform: translateY(-65%) scaleX(-1) rotate(20deg);
    }
}

.loading-text {
    text-align: center;
    color: var(--accent-color);
    font-weight: bold;
    margin-top: 1.5rem;
    font-size: 1.1rem;
}

/* Result Container */
.result-container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    background-color: #1EBECD;
    box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
}

.result-inner {
    width: 100%;
    max-width: 420px;
    background-image:
        linear-gradient(to right, #e9f8ff 2px, transparent 2px),
        linear-gradient(to bottom, #e9f8ff 2px, transparent 2px);
    background-size: 16px 16px;
    background-color: white;
    padding: 50px 30px 70px;
    border-radius: 16px;
}

/* Result Styles */
.result-card {
    text-align: center;
    margin-bottom: 1.5rem;
}

.result-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.result-header h2 {
    font-family: var(--font-main);
    font-size: 18px;
    font-weight: 700;
    color: #55381c;
    letter-spacing: 0.15em;
    line-height: 1.52;
    margin-bottom: 1rem;
}

.result-header h1 {
    display: none;
}

.type-desc {
    font-family: var(--font-main);
    font-size: 20px;
    font-weight: 700;
    color: #0a838e;
    letter-spacing: 0.1em;
    line-height: 1.52;
    margin-bottom: 1.5rem;
}

.horse-image-container {
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
}

.horse-image {
    width: 100%;
    height: auto;
    display: block;
}

.result-description {
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 400;
    color: #000000;
    line-height: 1.9;
    letter-spacing: 0.05em;
    text-align: left;
    margin-bottom: 1.5rem;
}

.fortune-box {
    background: white;
    padding: 20px 30px;
    border-radius: 17px;
    margin-bottom: 1.5rem;
    text-align: center;
    border: 1px solid #1ebecd;
}

.fortune-box h3 {
    font-family: var(--font-main);
    font-size: 18px;
    font-weight: 700;
    color: #0a838e;
    letter-spacing: 0.05em;
    line-height: 1.9;
    margin-bottom: 0.5rem;
}

.fortune-divider {
    width: 100%;
    max-width: 310px;
    height: 1px;
    border: none;
    border-top: 1px dashed #603E13;
    margin: 10px auto;
    background: transparent;
}

.lucky-item-text {
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 400;
    color: #000000;
    letter-spacing: 0.05em;
    line-height: 1.48;
    text-align: center;
}

.member-box {
    background: white;
    padding: 20px 30px;
    border-radius: 17px;
    margin-bottom: 1.5rem;
    text-align: center;
    border: 1px solid #1ebecd;
}

.member-box h3 {
    font-family: var(--font-main);
    font-size: 18px;
    font-weight: 700;
    color: #0a838e;
    letter-spacing: 0.05em;
    line-height: 1.9;
    margin-bottom: 0.5rem;
}

.member-content {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.member-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.member-text {
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: left;
}

.watermark {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: #aaa;
    letter-spacing: 0.1em;
}

.action-buttons {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.btn-sns {
    flex: 1;
    padding: 1rem;
    font-size: 0.9rem;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-x {
    background-color: #000;
}

.btn-x:hover {
    background-color: #333;
}

.btn-line {
    background-color: #06C755;
}

.btn-line:hover {
    background-color: #05b34c;
}

.restart-container {
    margin-top: 1rem;
}

.race-title {
    text-align: center;
}

.race-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    padding: 60px 20px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.25);
    overflow: scroll;
}

/* レスポンシブ対応 */
@media (max-width: 520px) {
    .quiz-container {
        padding: 40px 15px 30px;
    }

    .progress-bar {
        max-width: 100%;
        margin-bottom: 2rem;
        /* Reduced from 3.2rem */
    }

    .quiz-number {
        font-size: 40px;
        margin-bottom: 1rem;
        /* Reduced from 1.8rem */
    }

    .question-text {
        font-size: 18px;
        max-width: 100%;
        padding: 0 10px;
        margin-bottom: 2rem;
        /* Reduced from 3.1rem */
    }

    .options-grid {
        max-width: 100%;
        min-width: 100%;
        gap: 20px;
        /* Reduced gap from 30px */
    }

    .option-button {
        padding: 15px 20px;
        min-height: 90px;
        /* Slightly reduced min-height */
        font-size: 14px;
        border-radius: 60px;
    }

    .race-container {
        padding: 40px 15px 30px;
    }

    .race-title {
        font-size: 20px;
        margin-bottom: 2rem;
    }

    .track {
        height: 60px;
        margin: 1.5rem 0;
    }

    .horse-runner {
        height: 45px;
    }

    .loading-text {
        font-size: 0.95rem;
        margin-top: 1rem;
        padding: 0 10px;
    }

    /* Result Screen Optimizations */
    .result-container {
        padding: 30px 15px;
        /* Reduced padding */
    }

    .result-inner {
        padding: 40px 20px 30px;
        /* Reduced padding */
    }

    .result-header {
        margin-bottom: 1rem;
    }

    .result-header h2 {
        font-size: 16px;
        /* Smaller header */
        margin-bottom: 0.5rem;
    }

    .type-desc {
        font-size: 18px;
        /* Smaller type text */
        margin-bottom: 1rem;
    }

    .horse-image-container {
        margin-bottom: 1.5rem;
    }

    .result-description {
        font-size: 14px;
        line-height: 1.7;
        margin-bottom: 1.5rem;
    }

    .fortune-box,
    .member-box {
        padding: 15px 20px;
        /* Compact box padding */
        margin-bottom: 1rem;
    }

    .fortune-box h3,
    .member-box h3 {
        font-size: 16px;
    }

    .member-img {
        width: 60px;
        height: 60px;
    }

    .member-text {
        font-size: 0.85rem;
    }

    .action-buttons {
        gap: 0.5rem;
    }

    .btn-sns {
        padding: 0.8rem;
        font-size: 0.85rem;
    }
}

/* Character List Styles */
.characters-container {
    width: 100%;
    max-width: 600px;
    min-height: 100vh;
    padding: 40px 20px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
}

.characters-title {
    font-family: var(--font-main);
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
}

.character-list {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 15px;
    width: 100%;
    margin-bottom: 30px;
}

@media (min-width: 600px) {
    .character-list {
        grid-template-columns: repeat(1, 1fr);
        /* Keep 2 columns even on larger screens for better card ratio, or go to 3 if needed */
        gap: 20px;
    }
}

.character-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.character-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.character-card.active {
    grid-column: 1 / -1;
    /* Expand to full width when active */
    border-color: var(--accent-color);
}

.character-header {
    padding: 15px;
    display: grid;
    grid-template-columns: auto minmax(min-content, 160px) auto;
    /* Changed to row for horizontal layout */
    align-items: center;
    text-align: left;
    /* Changed to left align */
    gap: 15px;
    justify-content: center;
    /* Add spacing between icon and text */
}

.character-icon {
    width: 80px;
    height: auto;
    margin-bottom: 0px;
    border-radius: 50%;
    /* Optional: circle shape or remove if square is preferred */
    background: #f9f9f9;
}

.character-info h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.character-info p {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.toggle-icon {
    margin-top: 10px;
    font-size: 12px;
    color: #aaa;
    transition: transform 0.3s ease;
}

.character-card.active .toggle-icon {
    transform: rotate(180deg);
}

.character-detail {
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease-out;
    background-color: #fcfcfc;
    border-top: 1px solid #f0f0f0;
    padding: 0 20px;
}

.character-card.active .character-detail {
    max-height: 1000px;
    padding: 20px;
    /* Large enough to fit content */
}

.detail-content h4 {
    font-size: 14px;
    color: var(--accent-color);
    margin-bottom: 8px;
    margin-top: 15px;
}

.detail-content h4:first-child {
    margin-top: 0;
}

.detail-content p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
    color: #444;
}

.detail-lucky-item {
    color: var(--primary-orange);
}

/* Adjustments for mobile to ensure readability */
@media (max-width: 400px) {
    .character-list {
        grid-template-columns: 1fr;
        /* Single column on very small screens */
    }
}