/* style.css */
:root {
    --primary: #9D84B7;
    /* Pastel Purple */
    --primary-light: #E6E0EE;
    --secondary: #FFB7B2;
    /* Pastel Pink */
    --accent: #B5EAD7;
    /* Pastel Mint */
    --text-main: #4A4A4A;
    --text-light: #888;
    --bg-body: #F9F7FC;
    --white: #FFFFFF;
    --shadow: 0 4px 20px rgba(157, 132, 183, 0.15);
    --radius-lg: 20px;
    --radius-md: 15px;
    --radius-sm: 8px;
    --font-main: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #F9F7FC 0%, #fff0f0 100%);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    padding-top: 120px;
}

/* Header & Side Menu */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0.8rem 2rem;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(157, 132, 183, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    letter-spacing: 0.05em;
    text-decoration: none;
}

.logo img {
    height: 40px;
    width: auto;
    border-radius: 8px;
}

/* Menu Button */
.menu-btn {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    z-index: 201;
}

.menu-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.5);
}

.menu-line {
    width: 24px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.3s;
}

/* Menu Open State (Hamburger Animation) */
.menu-open .menu-btn .menu-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-open .menu-btn .menu-line:nth-child(2) {
    opacity: 0;
}

.menu-open .menu-btn .menu-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Side Menu Drawer */
.side-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 200;
    padding: 6rem 2rem 2rem;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.menu-open .side-menu {
    transform: translateX(0);
}

.side-menu nav ul {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
    list-style: none;
}

.side-menu nav a {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-main);
    display: block;
    padding: 0.5rem;
    transition: color 0.3s;
    text-decoration: none;
}

.side-menu nav a:hover,
.side-menu nav a.active {
    color: var(--primary);
    border-bottom: none;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.menu-open .menu-overlay {
    opacity: 1;
    visibility: visible;
}

/* Layout */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    background: linear-gradient(135deg, #9D84B7 0%, #FFB7B2 100%);
    color: var(--white);
    border: none;
    padding: 1rem 3rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(157, 132, 183, 0.3);
    display: block;
    margin: 0 auto;
    width: fit-content;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(157, 132, 183, 0.4);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
}

/* Diagnosis UI */
.question-card {
    background: var(--white);
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-top: 2rem;
    text-align: center;
}

.question-counter {
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 1rem;
    display: block;
}

.question-text {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    font-weight: bold;
}

.likert-scale {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    position: relative;
    padding-bottom: 2rem;
}

.likert-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--primary-light);
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.likert-btn:hover {
    background: var(--primary-light);
    transform: scale(1.1);
}

.likert-btn[data-value="1"],
.likert-btn[data-value="5"] {
    width: 60px;
    height: 60px;
}

.likert-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--primary-light);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 2rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Result Page */
.result-header {
    text-align: center;
    margin-bottom: 3rem;
}

.result-img {
    width: 200px;
    height: auto;
    margin: 1rem 0;
}

.type-name {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.catchphrase {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* Accordion */
.accordion-item {
    background: var(--white);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 1.2rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    cursor: pointer;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: 0 1.5rem;
    border-radius: 0 0 20px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease-out;
    opacity: 0;
}

.accordion-item.active .accordion-content {
    max-height: 1000px;
    padding: 1rem 1.5rem;
    opacity: 1;
}

/* Share Section */
.share-section {
    margin: 3rem 0;
    display: grid;
    gap: 1.5rem;
}

.share-block {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow);
}

.share-block h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #000;
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: bold;
}

.share-count {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    display: block;
}

/* Compatibility Page */
.compat-selector {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 2rem;
}

.select-wrapper {
    margin-bottom: 1rem;
    text-align: left;
}

.select-wrapper label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

select {
    width: 100%;
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid #ddd;
    font-size: 1rem;
}

.compat-header {
    text-align: center;
    padding: 2rem;
    border-radius: var(--radius-lg);
    color: var(--text-main);
    margin-bottom: 2rem;
}

.compat-pair {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-direction: row;
}

.compat-vs {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.compat-char {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.compat-char span {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-weight: bold;
}

.compat-char img {
    max-width: 150px;
    height: auto;
    margin: 1rem 0;
}

.compat-best {
    background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 100%);
}

/* Type Cards */
.type-card-mini {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: 0 4px 15px rgba(157, 132, 183, 0.1);
    transition: all 0.3s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.type-card-mini:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
    box-shadow: 0 8px 25px rgba(157, 132, 183, 0.2);
}

.card-img-wrapper {
    width: 100px;
    height: 100px;
    background: #FFF5F7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.type-card-mini img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.type-card-mini h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.type-card-mini .catchphrase {
    font-size: 0.8rem;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.detail-btn {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.detail-btn:hover {
    background: var(--primary);
    color: var(--white);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--white);
    margin: 10% auto;
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-img {
    width: 120px;
}


/* Compatibility Tabs */
.tab-btn {
    background: transparent;
    border: 2px solid var(--primary-light);
    color: var(--text-light);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(157, 132, 183, 0.3);
}

.tab-btn:hover:not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 4rem;
}

/* Share Section - Rich Style */
.share-container {
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: 0 8px 30px rgba(157, 132, 183, 0.2);
    margin-top: 3rem;
    border: 1px solid rgba(157, 132, 183, 0.1);
}

.share-title {
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.share-btn-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

.share-btn-icon:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.share-x {
    background: #000;
    background: linear-gradient(135deg, #333 0%, #000 100%);
}

.share-line {
    background: #06C755;
    background: linear-gradient(135deg, #06C755 0%, #05b34c 100%);
}

.share-insta {
    background: #d6249f;
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}

.share-copy {
    background: var(--primary);
    background: linear-gradient(135deg, #9D84B7 0%, #8a6fa8 100%);
}

.share-fb {
    background: #1877F2;
    background: linear-gradient(135deg, #1877F2 0%, #0056b3 100%);
}

.share-qr {
    background: #333;
    background: linear-gradient(135deg, #555 0%, #333 100%);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* QR Modal specific */
.qr-img {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    display: block;
}

/* Marquee */
.marquee-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    margin-bottom: 2rem;
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-content {
    display: inline-block;
    animation: marquee 20s linear infinite;
}

.marquee-content img {
    height: 80px;
    width: auto;
    margin: 0 1rem;
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.marquee-content img:hover {
    opacity: 1;
    transform: scale(1.1);
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Grid Layout */
.types-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0.5rem;
}

@media (min-width: 601px) {
    .types-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

/* Utilities & Missing Components */
.text-center {
    text-align: center;
}

.sp-only {
    display: block;
}

@media (min-width: 768px) {
    .sp-only {
        display: none;
    }
}

.text-gradient {
    background: linear-gradient(135deg, #9D84B7 0%, #FFB7B2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.main-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

@media (min-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }
}

.floating {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.btn-multiline {
    height: auto;
    padding: 1rem 3rem;
    line-height: 1.4;
    text-align: center;
    display: inline-block;
}

/* Compatibility Extra Styles */
.compat-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.compat-block {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: left;
}

.guide-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 600px) {
    .guide-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.guide-item {
    background: #fff;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid #eee;
    text-align: left;
}

.guide-item h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.guide-item p {
    font-size: 0.9rem;
    color: var(--text-main);
}

.action-guide {
    margin-top: 2rem;
    text-align: center;
}

.action-guide h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Image Optimization & Fade-in */
.img-fade-in {
    opacity: 0;
    transition: opacity 0.6s ease-out;
    will-change: opacity;
}



/* Marquee */
.marquee-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    margin-bottom: 2rem;
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-content {
    display: inline-block;
    animation: marquee 20s linear infinite;
}

.marquee-content img {
    height: 80px;
    width: auto;
    margin: 0 1rem;
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.marquee-content img:hover {
    opacity: 1;
    transform: scale(1.1);
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Grid Layout */
.types-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0.5rem;
}

@media (min-width: 601px) {
    .types-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

/* Utilities & Missing Components */
.text-center {
    text-align: center;
}

.sp-only {
    display: block;
}

@media (min-width: 768px) {
    .sp-only {
        display: none;
    }
}

.text-gradient {
    background: linear-gradient(135deg, #9D84B7 0%, #FFB7B2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.main-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

@media (min-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }
}

.floating {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.btn-multiline {
    height: auto;
    padding: 1rem 3rem;
    line-height: 1.4;
    text-align: center;
    display: inline-block;
}

/* Compatibility Extra Styles */
.compat-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.compat-block {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: left;
}

.guide-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 600px) {
    .guide-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.guide-item {
    background: #fff;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid #eee;
    text-align: left;
}

.guide-item h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.guide-item p {
    font-size: 0.9rem;
    color: var(--text-main);
}

.action-guide {
    margin-top: 2rem;
    text-align: center;
}

.action-guide h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Image Optimization & Fade-in */
.img-fade-in {
    opacity: 0;
    transition: opacity 0.6s ease-out;
    will-change: opacity;
}

.img-fade-in.loaded {
    opacity: 1;
}

/* Ensure images don't layout shift too much if possible */
img {
    max-width: 100%;
    height: auto;
}