/* ============================================ */
/* BASE RESET & VARIABLES                       */
/* ============================================ */
:root {
    /* Color Palette - Wabi-Sabi & Warmth */
    --color-bg: #fbfaf5;
    --color-bg-dark: #f5f3eb;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-accent: #ed6d3d;
    --color-accent-light: #ffe0d6;
    --color-sub: #8a9a5b;
    --color-sub-light: #e8ecd8;
    --color-warm: #f8c291;
    --color-cold: #a8c5d9;
    --color-shadow: rgba(51, 51, 51, 0.1);
    --color-shadow-strong: rgba(51, 51, 51, 0.2);

    --spacing-xs: 0.5rem;
    --spacing-s: 1rem;
    --spacing-m: 1.5rem;
    --spacing-l: 2.5rem;
    --spacing-xl: 4rem;

    /* Typography */
    --font-base: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "Yu Gothic", "Meiryo", sans-serif;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-medium: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html,
body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-base);
    line-height: 1.8;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ============================================ */
/* CANVAS BACKGROUND                            */
/* ============================================ */
#bgCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    /* Behind everything */
    pointer-events: none;
}

/* ============================================ */
/* PROGRESS BAR                                 */
/* ============================================ */
#progressBar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--color-bg-dark);
    z-index: 9999;
}

#progressFill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent), var(--color-warm));
    transition: width var(--transition-medium);
}

/* ============================================ */
/* SLIDE CONTAINER                              */
/* ============================================ */
#presentation {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-m) var(--spacing-l);
    opacity: 0;
    visibility: hidden;
    transform: translateX(30px) scale(0.95);
    transition: opacity 0.8s ease, visibility 0.8s ease, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
    overflow-y: auto;
}

.slide.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1);
    z-index: 2;
}

/* Theme variations: subtle tints if needed */
.slide[data-theme="cold"] {
    background: radial-gradient(circle at center, transparent 0%, rgba(168, 197, 217, 0.1) 100%);
}

.slide[data-theme="warm"] {
    background: radial-gradient(circle at center, transparent 0%, rgba(248, 194, 145, 0.1) 100%);
}

.slide.slide-reveal {
    /* Background handled by canvas mainly, but add gradient */
    background: rgba(255, 255, 255, 0.6);
}

.slide.slide-final {
    background: rgba(255, 255, 255, 0.8);
}

/* ============================================ */
/* CONTENT LAYOUT                               */
/* ============================================ */
.content {
    max-width: 1200px;
    width: 100%;
    position: relative;
    z-index: 5;
    /* Above canvas */
}

.center-content {
    text-align: center;
}

/* Fade-in Animation */
.fade-in>* {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.fade-in>*:nth-child(1) {
    animation-delay: 0s;
}

.fade-in>*:nth-child(2) {
    animation-delay: 0.1s;
}

.fade-in>*:nth-child(3) {
    animation-delay: 0.2s;
}

.fade-in>*:nth-child(4) {
    animation-delay: 0.3s;
}

.fade-in>*:nth-child(5) {
    animation-delay: 0.4s;
}

.fade-in>*:nth-child(6) {
    animation-delay: 0.5s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================ */
/* TYPOGRAPHY                                   */
/* ============================================ */
h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--color-accent);
    margin-bottom: var(--spacing-s);
    font-weight: 800;
    line-height: 1.4;
    text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.8);
    letter-spacing: 0.05em;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    margin-bottom: var(--spacing-m);
    font-weight: 600;
}

.section-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: var(--color-text);
    border-bottom: 3px solid var(--color-sub);
    padding-bottom: var(--spacing-xs);
    display: inline-block;
    margin-bottom: var(--spacing-m);
    background: rgba(255, 255, 255, 0.8);
    /* Readability over canvas */
}

h3 {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    margin-bottom: var(--spacing-s);
    color: var(--color-accent);
}

h4 {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-xs);
}

p,
li {
    font-size: clamp(1rem, 1.5vw, 1.4rem);
    margin-bottom: var(--spacing-s);
}

.small {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

strong {
    color: var(--color-accent);
    font-weight: bold;
}

kbd {
    background: #eee;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid #ccc;
}

/* ============================================ */
/* SLIDE 1: CIRCLE BACKGROUND                   */
/* ============================================ */
.circle-bg {
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--color-accent-light);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.6;
    animation: pulse 4s infinite ease-in-out;
}

.floating {
    animation: float 3s ease-in-out infinite;
}

.floating-delayed {
    animation: float 3.2s ease-in-out infinite 0.5s;
}

.pulsing {
    animation: pulse 1.5s ease-in-out infinite;
}

.visual-placeholder {
    margin: var(--spacing-l) 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-m);
    position: relative;
    height: 200px;
    /* Force height so elements float properly */
}

.visual-placeholder .emoji {
    font-size: clamp(4rem, 10vw, 8rem);
    z-index: 2;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ============================================ */
/* SLIDE 2: STATS                               */
/* ============================================ */
.stat-box {
    background: rgba(255, 255, 255, 0.95);
    padding: var(--spacing-m);
    border-radius: 12px;
    box-shadow: 0 8px 30px var(--color-shadow);
    margin-bottom: var(--spacing-m);
    transition: transform var(--transition-medium);
}

.stat-box:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 4rem;
    font-weight: 800;
    color: var(--color-accent);
    font-family: monospace;
}

.stat-unit {
    font-size: 2rem;
    font-weight: bold;
    margin-right: var(--spacing-s);
}

/* ============================================ */
/* SLIDE 11: COPY BUTTON                        */
/* ============================================ */
.copy-btn {
    background: white;
    border: 1px solid white;
    color: var(--color-sub);
    padding: 0.2rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    float: right;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--color-sub-light);
}

/* ============================================ */
/* SLIDE 17: OMIKUJI                            */
/* ============================================ */
.omikuji-section {
    margin-top: var(--spacing-l);
    min-height: 150px;
}

.omikuji-btn {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--color-shadow-strong);
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
    font-family: var(--font-base);
}

.omikuji-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--color-shadow-strong);
    background: #ff7f50;
}

.omikuji-btn.shaking {
    animation: shake 0.5s infinite;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px) rotate(-5deg);
    }

    75% {
        transform: translateX(5px) rotate(5deg);
    }
}

.omikuji-result {
    margin-top: var(--spacing-m);
    padding: var(--spacing-m);
    background: white;
    border: 4px double var(--color-accent);
    border-radius: 12px;
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.omikuji-result.hidden {
    display: none;
}

.omikuji-result.fade-in-up {
    opacity: 1;
    transform: translateY(0);
}

.omikuji-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-text);
    margin: 0;
}

/* ============================================ */
/* PREVIOUS STYLES (Keep essentials)            */
/* ============================================ */
/* ... (Include previous critical layout styles for grids, cards, bubbles) ... */

/* Speech Bubble */
.speech-bubble {
    background-color: white;
    border-radius: 20px;
    padding: var(--spacing-m) var(--spacing-l);
    box-shadow: 4px 4px 0 var(--color-sub);
    margin-bottom: var(--spacing-l);
    position: relative;
}

/* Timeline */
.timeline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-m);
    flex-wrap: wrap;
}

.timeline-item {
    background: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-m);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px var(--color-shadow);
    width: 280px;
}

.timeline-item.highlight {
    border: 3px solid var(--color-accent);
    transform: scale(1.05);
}

/* Barrier Grid */
.barrier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-m);
}

.barrier-card {
    background: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-m);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px var(--color-shadow);
}

.barrier-emoji {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Paradigm Shift */
.paradigm-shift {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-m);
}

.old-way,
.new-way {
    background: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-m);
    border-radius: 12px;
    width: 80%;
    max-width: 600px;
}

.new-way {
    border-left: 5px solid var(--color-accent);
}

/* Reveal */
.big-reveal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-m);
}

.flower {
    font-size: 3rem;
}

.spin {
    animation: spin 8s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Traits */
.grandma-traits {
    display: flex;
    justify-content: center;
    gap: var(--spacing-m);
    flex-wrap: wrap;
}

.trait-card {
    background: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-m);
    border-radius: 16px;
    width: 260px;
    text-align: center;
    box-shadow: 0 4px 12px var(--color-shadow);
}

.psychology-box {
    background: var(--color-sub-light);
    padding: var(--spacing-m);
    border-radius: 12px;
    margin-top: var(--spacing-l);
}

/* VS Container */
.vs-container {
    display: flex;
    justify-content: center;
    gap: var(--spacing-m);
    flex-wrap: wrap;
}

.vs-item {
    background: rgba(255, 255, 255, 0.95);
    padding: var(--spacing-m);
    border-radius: 16px;
    width: 45%;
    min-width: 300px;
}

.vs-divider {
    font-size: 2rem;
    font-weight: bold;
    align-self: center;
}

/* Affirmation */
.affirmation {
    background: var(--color-accent-light);
    padding: 0.5rem 2rem;
    border-radius: 30px;
    margin: 0.5rem;
    display: inline-block;
}

.cycle-diagram-enhanced {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.cycle-node {
    background: var(--color-accent);
    color: white;
    padding: 1rem;
    border-radius: 50px;
    min-width: 140px;
    text-align: center;
}

/* Steps */
.step-cards {
    display: flex;
    justify-content: center;
    gap: var(--spacing-m);
    flex-wrap: wrap;
}

.step-card {
    background: rgba(255, 255, 255, 0.95);
    padding: var(--spacing-m);
    border-radius: 12px;
    width: 260px;
    position: relative;
    margin-top: 1rem;
}

.step-number {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-accent);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Prompt Box */
.prompt-box {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

.prompt-header {
    background: var(--color-sub);
    color: white;
    padding: 10px 20px;
}

.prompt-content {
    padding: 20px;
    white-space: pre-wrap;
    background: #fafafa;
    margin: 0;
}

/* Chat Demos */
.demo-comparison {
    display: flex;
    gap: var(--spacing-m);
    flex-wrap: wrap;
}

.demo-side {
    flex: 1;
    min-width: 300px;
    background: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-m);
    border-radius: 12px;
}

.chat-bubble {
    padding: 10px 20px;
    border-radius: 20px;
    margin-bottom: 10px;
    max-width: 90%;
    display: none;
    /* Hidden by default for animation */
}

.chat-bubble.show {
    display: block;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.user-bubble {
    background: #eee;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.ai-bubble {
    background-color: #f0f0f0;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.ai-bubble.warm {
    background: var(--color-accent-light);
    border: 2px solid var(--color-accent);
}

.grandma-bubble {
    background: var(--color-accent-light);
    border: 2px solid var(--color-accent);
    position: relative;
    padding-left: 60px;
}

.grandma-avatar {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
}

/* Future Grid */
.future-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-m);
}

.future-card {
    background: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-m);
    border-radius: 12px;
    text-transform: center;
}

/* Summary */
.summary-table {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-collapse: collapse;
}

.summary-table td,
.summary-table th {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.summary-table thead {
    background: var(--color-sub);
    color: white;
}

.after-cell {
    color: var(--color-accent);
    font-weight: bold;
}

/* Reuse controls & Nav */
.controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 15px;
    border-radius: 30px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.controls button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.slide-nav {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

.nav-toggle {
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 15px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.5rem;
}

.nav-panel {
    display: none;
    position: absolute;
    bottom: 50px;
    left: 0;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    width: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.nav-panel.open {
    display: block;
}

.nav-item {
    padding: 5px;
    cursor: pointer;
}

.nav-item:hover {
    background: #eee;
}

.nav-item.active {
    color: var(--color-accent);
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .vs-container,
    .demo-comparison,
    .timeline {
        flex-direction: column;
    }

    .vs-item,
    .demo-side,
    .timeline-item {
        width: 100%;
    }
}