/* Base Variables (ひだまりのアトリエ仕様) */
:root {
    --color-base: #FFFAF0;
    /* フローラルホワイト */
    --color-main: #8D6E63;
    /* ブラウン */
    --color-accent: #F4A460;
    /* オレンジ */

    /* 派生カラー・シャドウ用 */
    --color-bg-alt: #FFF5E1;
    --color-shadow: rgba(141, 110, 99, 0.15);
    --color-white: #FFFFFF;

    --font-main: 'Zen Maru Gothic', sans-serif;
    --border-radius-blob: 40% 60% 70% 30% / 40% 50% 60% 50%;
    /* 手書き風の柔らかいかたち */
    --transition-soft: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset & Global */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-base);
    color: var(--color-main);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    /* 背景の水彩風ドットパターン */
    background-image: radial-gradient(var(--color-bg-alt) 20%, transparent 20%),
        radial-gradient(var(--color-bg-alt) 20%, transparent 20%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

/* 遊び心の装飾 */
.decoration {
    position: fixed;
    font-size: 2rem;
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
    animation: floating 6s ease-in-out infinite alternate;
}

.leaf-1 {
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.leaf-2 {
    bottom: 20%;
    right: 5%;
    font-size: 3rem;
    animation-delay: 1s;
}

@keyframes floating {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    100% {
        transform: translateY(-20px) rotate(15deg);
    }
}

/* View Control */
.view {
    display: none;
    opacity: 0;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 40px 20px;
    transition: opacity 0.5s ease;
}

.view.active {
    display: flex;
    opacity: 1;
    animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

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

/* Buttons */
button {
    font-family: var(--font-main);
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition-soft);
}

.btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-main);
    background-color: var(--color-white);
    border: 3px solid var(--color-main);
    border-radius: 30px 40px 20px 30px / 30px 20px 40px 30px;
    /* 手書き風の変形角丸 */
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 4px 4px 0 var(--color-shadow);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 6px 6px 0 var(--color-accent);
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 2px 2px 0 var(--color-accent);
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
}

.btn-primary:hover {
    background-color: #E29350;
    border-color: #E29350;
}

.btn-back {
    background: none;
    color: var(--color-main);
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
}

.btn-back:hover {
    opacity: 1;
    transform: translateX(-5px);
}

/* Entrance Board */
.glass-board {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid var(--color-white);
    border-radius: var(--border-radius-blob);
    padding: 60px 40px;
    text-align: center;
    max-width: 600px;
    width: 100%;
    margin: auto;
    box-shadow: 0 10px 30px var(--color-shadow);
}

.title-area h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--color-accent);
    text-shadow: 2px 2px 0 var(--color-bg-alt);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--color-main);
    margin-bottom: 40px;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

@media (min-width: 600px) {
    .button-group {
        flex-direction: row;
        justify-content: center;
    }
}

/* --- 使い方（チュートリアル）リッチデザイン --- */
.tutorial-section {
    margin-top: 50px;
    padding: 30px;
    background: var(--color-bg-alt);
    border: 3px dashed var(--color-accent);
    border-radius: 20px;
    text-align: center;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
}

.tutorial-title {
    color: var(--color-accent);
    font-size: 1.4rem;
    margin-bottom: 25px;
    display: inline-block;
    background: var(--color-white);
    padding: 10px 20px;
    border-radius: 30px;
    border: 2px solid var(--color-accent);
    box-shadow: 2px 2px 0 var(--color-shadow);
}

.tutorial-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.tutorial-step {
    flex: 1;
    min-width: 200px;
    background: var(--color-white);
    padding: 25px 15px 15px;
    border-radius: 15px;
    box-shadow: 4px 4px 0px var(--color-shadow);
    border: 2px solid var(--color-main);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease;
}

.tutorial-step:hover {
    transform: translateY(-5px);
}

.tutorial-step .step-num {
    position: absolute;
    top: -15px;
    left: -15px;
    background: var(--color-accent);
    color: var(--color-white);
    font-weight: 900;
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid var(--color-white);
    box-shadow: 2px 2px 0 var(--color-shadow);
    transform: rotate(-10deg);
}

.tutorial-step .step-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.tutorial-step p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-main);
    line-height: 1.6;
}

.tutorial-step p strong {
    color: var(--color-accent);
    font-weight: 700;
}

/* Header Nav */
.header-nav {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 40px;
}

.header-nav h2 {
    font-size: 1.8rem;
    border-bottom: 3px dashed var(--color-accent);
    padding-bottom: 5px;
}

/* Timeline Layout (猫が歩く小道風) */
.timeline-container {
    width: 100%;
    max-width: 800px;
    position: relative;
}

.timeline-meta {
    background: var(--color-white);
    border: 2px solid var(--color-accent);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 40px;
    box-shadow: 4px 4px 0 var(--color-shadow);
    text-align: center;
}

.target-date {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 5px;
}

/* タイムラインの道筋 */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 6px;
    background-color: var(--color-bg-alt);
    border-radius: 10px;
    /* 点線にする */
    background-image: linear-gradient(var(--color-accent) 50%, rgba(255, 255, 255, 0) 0%);
    background-position: right;
    background-size: 6px 20px;
    background-repeat: repeat-y;
}

/* タイムラインの各項目 */
.timeline-item {
    position: relative;
    margin-bottom: 40px;
    background: var(--color-white);
    border-radius: 15px 30px 15px 30px;
    padding: 25px;
    box-shadow: 0 5px 15px var(--color-shadow);
    transition: var(--transition-soft);
    border-left: 5px solid var(--color-accent);
    cursor: default;
}

.timeline-item:hover {
    transform: translateX(5px) translateY(-2px);
    box-shadow: 5px 8px 20px var(--color-shadow);
}

/* 足跡マーカー */
.timeline-item::before {
    content: '🐾';
    position: absolute;
    left: -40px;
    top: 20px;
    font-size: 1.5rem;
    background: var(--color-base);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.period {
    display: inline-block;
    background: var(--color-bg-alt);
    color: var(--color-main);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.timeline-title {
    font-size: 1.3rem;
    color: var(--color-main);
    margin-bottom: 15px;
}

.task-list {
    list-style: none;
    padding-left: 10px;
}

.task-list li {
    position: relative;
    margin-bottom: 8px;
    padding-left: 20px;
}

.task-list li::before {
    content: '・';
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
}

/* ひょっこり吹き出し (Hover Interaction) */
.thought-bubble {
    position: absolute;
    bottom: 100%;
    right: 20px;
    background: var(--color-accent);
    color: var(--color-white);
    padding: 10px 15px;
    border-radius: 20px 20px 0 20px;
    font-size: 0.9rem;
    font-weight: bold;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    z-index: 10;
}

.thought-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 15px;
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: var(--color-accent) transparent transparent transparent;
}

.timeline-item:hover .thought-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(-10px) scale(1);
}

/* Tuna Generator UI */
.generator-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 進捗インジケーター (猫が歩くゲージ) */
.progress-container {
    position: relative;
    width: 100%;
    padding-top: 30px;
    /* 猫のためのスペース */
    margin-bottom: 10px;
}

.cat-walker {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 1.8rem;
    transform: translateX(-50%);
    transition: left 0.5s ease;
    z-index: 2;
}

.progress-track {
    width: 100%;
    height: 12px;
    background-color: var(--color-bg-alt);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 2px solid var(--color-main);
}

.progress-fill {
    height: 100%;
    background-color: var(--color-accent);
    width: 0%;
    transition: width 0.5s ease;
    background-image: linear-gradient(45deg,
            rgba(255, 255, 255, 0.2) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0.2) 75%,
            transparent 75%,
            transparent);
    background-size: 1rem 1rem;
}

.qa-board {
    background: var(--color-white);
    border-radius: var(--border-radius-blob);
    padding: 40px 30px;
    box-shadow: 0 10px 30px var(--color-shadow);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cat-whisper-container {
    text-align: right;
    position: relative;
}

.btn-hint {
    background: var(--color-bg-alt);
    border: 2px dashed var(--color-accent);
    color: var(--color-accent);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
}

.btn-hint:hover {
    background: var(--color-accent);
    color: var(--color-white);
}

.hint-bubble {
    position: absolute;
    bottom: calc(100% + 15px);
    right: 0;
    background: var(--color-white);
    border: 2px solid var(--color-main);
    padding: 15px;
    border-radius: 20px 20px 0 20px;
    color: var(--color-main);
    font-weight: bold;
    box-shadow: 4px 4px 0 var(--color-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    width: max-content;
    max-width: 250px;
    text-align: left;
}

.hint-bubble.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* QA Board Inner Styles */
#qa-container {
    transition: opacity 0.3s ease;
}

.question-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 10px;
    text-align: center;
}

.question-text {
    font-size: 1.4rem;
    color: var(--color-main);
    margin-bottom: 30px;
    text-align: center;
}

/* --- Mad-Libs UI & Mentor --- */
.madlib-container {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 2.2;
    color: var(--color-main);
    text-align: center;
    margin-bottom: 30px;
}

.madlib-wrapper {
    display: inline-block;
    padding: 0 10px;
}

.madlib-input {
    width: 100%;
    min-width: 300px;
    padding: 10px 15px;
    font-size: 1.2rem;
    font-family: var(--font-main);
    color: var(--color-accent);
    border: none;
    border-bottom: 3px dashed var(--color-accent);
    background-color: transparent;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s ease;
}

.madlib-input:focus {
    outline: none;
    border-bottom: 3px solid var(--color-accent);
    background-color: var(--color-bg-alt);
    border-radius: 10px 10px 0 0;
}

.signature-input {
    min-width: 200px;
    border-bottom: 3px solid var(--color-main);
    color: var(--color-main);
}

.mentor-box {
    background: var(--color-bg-alt);
    border: 3px solid var(--color-main);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
    position: relative;
    box-shadow: 4px 4px 0 var(--color-shadow);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.mentor-icon {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: 10px;
}

.mentor-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-main);
    margin-bottom: 15px;
}

.mentor-prompt {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--color-white);
    background: var(--color-accent);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
}

.help-chip {
    background-color: var(--color-white) !important;
    border-color: #E29350 !important;
    color: #E29350 !important;
}

.help-chip:hover {
    background-color: #E29350 !important;
    color: var(--color-white) !important;
}

.madlib-result-list {
    list-style: none !important;
    padding-left: 0 !important;
}

.madlib-statement {
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 10px;
    padding: 15px;
    background: var(--color-bg-alt);
    border-left: 5px solid var(--color-accent);
    border-radius: 10px;
}

.madlib-statement strong {
    color: var(--color-accent);
    font-weight: bold;
    font-size: 1.25rem;
    text-decoration: underline;
    text-decoration-color: var(--color-main);
    text-underline-offset: 4px;
}

/* 新しいテキスト＆チップUI */
.qa-textarea,
.qa-input-month {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-family: var(--font-main);
    color: var(--color-main);
    border: 3px solid var(--color-main);
    border-radius: 15px;
    background-color: var(--color-white);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.05);
}

.qa-textarea {
    min-height: 100px;
    resize: vertical;
    margin-bottom: 20px;
}

.qa-input-month {
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}

.qa-textarea:focus,
.qa-input-month:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(244, 164, 96, 0.3);
}

.suggest-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.suggest-chip {
    background-color: var(--color-bg-alt);
    color: var(--color-main);
    border: 2px dashed var(--color-main);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    transition: var(--transition-soft);
}

.suggest-chip:hover {
    background-color: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.qa-actions {
    text-align: center;
}

.btn-next {
    min-width: 200px;
    justify-content: center;
}

.btn-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc;
    border-color: #aaa;
    color: #fff;
    box-shadow: none;
    transform: none;
}

/* 遊び心：レスポンシブな微調整 */
@media (max-width: 600px) {
    .glass-board {
        padding: 40px 20px;
    }

    .timeline-item {
        padding: 20px 15px;
    }

    .timeline-item::before {
        left: -35px;
        width: 24px;
        height: 24px;
        font-size: 1.2rem;
    }

    /* ホバーが効きにくいスマホ向けに吹き出しを少し見やすく */
    .thought-bubble {
        position: relative;
        bottom: auto;
        right: auto;
        opacity: 1;
        visibility: visible;
        transform: none;
        margin-bottom: 15px;
        display: inline-block;
        border-radius: 20px;
    }

    .thought-bubble::after {
        display: none;
    }
}