/* 基本的なリセットとフォント設定 */
:root {
    --primary-color: #00529B;
    --secondary-color: #e9f5ff;
    --text-color: #333;
    --background-color: #f8f9fa;
    --border-color: #dee2e6;
    --link-color: #007bff;
    --link-hover-color: #0056b3;
    --guest-color: #6c757d;
    --guest-bg: #f8f9fa;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    line-height: 1.7;
    background-color: var(--background-color);
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ヘッダー */
.site-header {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 2rem;
    width: 100%;
}

.header-left {
    text-align: left;
    flex: 0 1 auto;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
}

.site-header h1 {
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-link {
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
}

.home-link:hover {
    color: var(--secondary-color);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.home-link:active {
    transform: scale(0.98);
}

/* メインコンテンツ */
.site-main {
    padding-bottom: 2rem;
}

/* 価格セクション */
.pricing-section {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 2rem;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.pricing-section:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.pricing-content {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.pricing-left {
    flex: 0 0 auto;
}

.pricing-image {
    max-width: 200px;
    height: auto;
    border-radius: 8px;
}

.pricing-right {
    flex: 1;
}

.pricing-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.pricing-description {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text-color);
    margin: 0;
}

/* 価格セクションのレスポンシブ対応 */
@media (max-width: 768px) {
    .pricing-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .pricing-title {
        font-size: 2rem;
    }
    
    .pricing-description {
        font-size: 1.1rem;
    }
    
    .pricing-image {
        max-width: 150px;
    }
}

.chapter {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 2rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.chapter:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.chapter h2 {
    color: var(--primary-color);
    margin-bottom: 0; /* Reset margin as it's now in a flex container */
    flex-grow: 1;
    font-weight: 600;
    transition: color 0.3s ease;
}

.chapter-toggle:hover h2 {
    color: var(--primary-color);
    text-shadow: 0 1px 2px rgba(0, 93, 155, 0.1);
}

.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--secondary-color);
    transition: all 0.3s ease;
}

.chapter-title-container {
    display: flex;
    align-items: center;
    flex-grow: 1;
    min-width: 0;
}

.chapter-toggle {
    background: white;
    border: none;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    text-align: left;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.chapter-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ffffff 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.chapter-toggle:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 93, 155, 0.15);
}

.chapter-toggle:hover::before {
    opacity: 1;
}

.chapter-toggle:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 93, 155, 0.2);
}

.chapter-content {
    transition: all 0.3s ease-in-out;
    overflow: hidden;
}

.progress-container {
    width: 200px;
    background-color: #e9ecef;
    border-radius: .25rem;
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.progress-bar {
    background-color: #28a745;
    height: 100%;
    border-radius: .25rem;
    position: absolute;
    left: 0;
    top: 0;
    transition: width 0.5s ease-in-out;
}

.progress-text {
    position: relative;
    z-index: 1;
    color: #333;
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 0 0 2px white, 0 0 4px white;
}

/* レッスンリスト */
.lesson-list {
    list-style: none;
}

.lesson-list li {
    margin-bottom: 0.75rem;
}

.lesson-list a {
    display: block;
    padding: 0.75rem 1rem;
    background-color: var(--secondary-color);
    color: var(--link-color);
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.lesson-list a > strong {
    flex-grow: 1;
    padding-right: 1rem;
}

.lesson-list a:hover {
    background-color: var(--primary-color);
    color: white;
}

/* フッター */
.site-footer {
    background-color: #343a40;
    color: #f8f9fa;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
    font-size: 0.9rem;
}

/* 検索フォーム */
.search-container {
    margin-bottom: 2rem;
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex-grow: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.search-btn {
    flex-shrink: 0;
}

/* 検索結果ページ */
.search-results-section {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-results-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* 管理者用リンク */
.admin-link-container {
    margin-bottom: 2rem;
    text-align: right;
}

/* 認証フォーム */
.auth-form {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    max-width: 400px;
    margin: 0 auto;
}

.auth-form h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
}

.auth-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: none;
}

.auth-container {
    margin-bottom: 2rem;
    display: flex;
    justify-content: flex-end;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 93, 155, 0.3);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #003d7a;
    border-color: #003d7a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 93, 155, 0.3);
}

/* ヘッダー用のボタンスタイル */
.header-right .btn-primary {
    background-color: #ffffff;
    color: var(--primary-color);
    border: 2px solid #ffffff;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

.header-right .btn-primary:hover {
    background-color: #f8f9fa;
    border-color: #f8f9fa;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.3);
}

.header-right .btn-outline {
    background-color: transparent;
    color: #ffffff;
    border: 2px solid #ffffff;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

.header-right .btn-outline:hover {
    background-color: #ffffff;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.3);
}

/* ヘッダーの認証リンクの間隔調整 */
.header-right .auth-links {
    gap: 0.8rem;
}

/* 新規レッスン作成フォーム */
.lesson-form {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--link-hover-color);
}

/* レッスン詳細ページ */
.lesson-content {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.lesson-title {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.lesson-body {
    margin-bottom: 2rem;
    line-height: 1.8;
    white-space: pre-line;
}

/* 動画セクション */
.video-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.video-section h3 {
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.video-container {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 1rem;
}

.video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.video-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
    padding: 0.75rem 1rem;
    background: rgba(0,82,155,0.05);
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .video-container {
        height: 250px;
    }
    
    .video-section {
        padding: 1rem;
        margin: 1.5rem 0;
    }
    
    .video-section h3 {
        font-size: 1.1rem;
    }
}

.lesson-body h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin: 1.5rem 0 0.8rem 0;
    font-weight: 600;
}

.lesson-body ul {
    margin: 0.5rem 0 1rem 1.5rem;
    padding-left: 0;
}

.lesson-body li {
    margin-bottom: 0.5rem;
    position: relative;
}

.lesson-body li:before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: -1.2rem;
}

.lesson-body ol {
    margin: 0.5rem 0 1rem 1.5rem;
    padding-left: 0;
    counter-reset: item;
}

.lesson-body ol li {
    margin-bottom: 0.8rem;
    position: relative;
    counter-increment: item;
}

.lesson-body ol li:before {
    content: counter(item) ".";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: -1.5rem;
    min-width: 1.5rem;
}

.lesson-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 200;
}

.back-link {
    color: var(--link-color);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--link-color);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.back-link:hover {
    background-color: var(--link-color);
    color: white;
}

.next-link {
    color: white;
    background-color: var(--primary-color);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.next-link:hover {
    background-color: #1e40af;
    border-color: #1e40af;
    color: white;
    transform: tr
    anslateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .lesson-navigation {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .back-link,
    .next-link {
        text-align: center;
        width: 100%;
    }
}

.lesson-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* クイズセクション */
.quiz-section {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.quiz-section h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.question {
    margin-bottom: 2rem;
}

.question-text {
    font-weight: bold;
    margin-bottom: 1rem;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s, border-color 0.2s;
}

.option-btn:hover {
    background-color: var(--secondary-color);
    border-color: var(--primary-color);
}

.option-btn.correct {
    background-color: #d4edda; /* 正解の色 */
    border-color: #c3e6cb;
    color: #155724;
    font-weight: bold;
}

.option-btn.incorrect {
    background-color: #f8d7da; /* 不正解の色 */
    border-color: #f5c6cb;
    color: #721c24;
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-btn:hover:disabled {
    background-color: #fff;
    border-color: var(--border-color);
}

.option-btn.correct:hover:disabled {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.option-btn.incorrect:hover:disabled {
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.quiz-feedback {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: .25rem;
}

.quiz-feedback.correct {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.quiz-feedback.incorrect {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.quiz-feedback.cleared {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .site-header h1 {
        font-size: 2rem;
    }

    .chapter h2 {
        font-size: 1.5rem;
    }

    .container {
        padding: 0 15px;
    }
}

/* レッスンリスト */
.lesson-list {
    list-style: none;
}

.lesson-list li {
    margin-bottom: 0.75rem;
}

.lesson-list a {
    display: block;
    padding: 0.75rem 1rem;
    background-color: var(--secondary-color);
    color: var(--link-color);
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.lesson-list a > strong {
    flex-grow: 1;
    padding-right: 1rem;
}

.lesson-list a:hover {
    background-color: var(--primary-color);
    color: white;
}

/* フッター */
.site-footer {
    background-color: #343a40;
    color: #f8f9fa;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
    font-size: 0.9rem;
}

/* 検索フォーム */
.search-container {
    margin-bottom: 2rem;
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex-grow: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.search-btn {
    flex-shrink: 0;
}

/* 検索結果ページ */
.search-results-section {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-results-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* 管理者用リンク */
.admin-link-container {
    margin-bottom: 2rem;
    text-align: right;
}

/* 新規レッスン作成フォーム */
.lesson-form {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--link-hover-color);
}

/* クイズセクション */
.quiz-section {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.quiz-section h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.question {
    margin-bottom: 2rem;
}

.question-text {
    font-weight: bold;
    margin-bottom: 1rem;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s, border-color 0.2s;
}

.option-btn:hover {
    background-color: var(--secondary-color);
    border-color: var(--primary-color);
}

.option-btn.correct {
    background-color: #d4edda; /* 正解の色 */
    border-color: #c3e6cb;
    color: #155724;
    font-weight: bold;
}

.option-btn.incorrect {
    background-color: #f8d7da; /* 不正解の色 */
    border-color: #f5c6cb;
    color: #721c24;
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-btn:hover:disabled {
    background-color: #fff;
    border-color: var(--border-color);
}

.option-btn.correct:hover:disabled {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.option-btn.incorrect:hover:disabled {
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.quiz-feedback {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: .25rem;
}

.quiz-feedback.correct {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.quiz-feedback.incorrect {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.quiz-feedback.cleared {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .site-header h1 {
        font-size: 2rem;
    }

    .chapter h2 {
        font-size: 1.5rem;
    }

    .container {
        padding: 0 15px;
    }
}

/* Chatbot styles */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10; /* デフォルトは小さなz座標 */
    transition: z-index 0s; /* z-indexの変更をスムーズにする */
}

#chatbot-container.active {
    z-index: 1000; /* チャットウィンドウが開いている時は大きなz座標 */
}

#chat-toggle-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s;
}

#chat-toggle-button:hover {
    background-color: var(--link-hover-color);
}

#chat-window {
    width: 350px;
    height: 500px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    transform-origin: bottom right;
}

#chat-window.hidden {
    transform: scale(0);
    opacity: 0;
}

.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

#close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

#chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    padding: 8px 12px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.4;
}

.user-message {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.bot-message {
    background-color: #f1f1f1;
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-input-container {
    display: flex;
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

#chat-input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 1rem;
    margin-right: 10px;
}

#chat-send {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#chat-send:hover {
    background-color: var(--link-hover-color);
}

#chat-send:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-left {
        text-align: center;
        flex: none;
    }
    
    .header-right {
        justify-content: center;
        margin-left: 0;
    }
    
    .auth-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .user-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .site-header h1 {
        font-size: 2rem;
        white-space: normal;
    }
    
    .container {
        padding: 0 15px;
    }
}

/* デスクトップ表示でのヘッダー配置を確実にする */
@media (min-width: 769px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .header-left {
        flex: 0 1 auto;
        margin-right: 2rem;
        min-width: 0;
    }
    
    .header-right {
        flex: 0 0 auto;
        margin-left: auto;
    }
    
    .auth-links {
        display: flex;
        gap: 1rem;
        align-items: center;
    }
    
    .site-header h1 {
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 1.5rem 0;
    }
    
    .site-header h1 {
        font-size: 1.8rem;
    }
    
    .auth-links a {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* ステッパーコンテナ */
#stepper-container {
    position: relative;
    z-index: 10; /* デフォルトは小さなz座標 */
    transition: z-index 0s;
}

#stepper-container.active {
    z-index: 1000; /* ステッパーが表示されている時は大きなz座標 */
}

/* 進捗アイコン（初期状態で表示） */
.progress-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 10;
}

/* 検索アイコン（初期状態で表示） */
.search-indicator {
    position: fixed;
    bottom: 20px;
    left: 100px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 10;
}

.search-indicator:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.search-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.search-text {
    font-size: 0.7rem;
    font-weight: bold;
}

.progress-indicator:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.progress-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.progress-text {
    font-size: 0.7rem;
    font-weight: bold;
}

/* ステッパー全体（初期状態では非表示） */
.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1000;
}

.stepper.hidden {
    display: none;
}

.stepper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.stepper-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background-color: var(--line-color, var(--border-color));
    z-index: 1;
}

.stepper-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--muted-color, #e9ecef);
    color: var(--muted-foreground, #6c757d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    z-index: 2;
    position: relative;
}

.stepper-item.active .stepper-indicator {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 93, 155, 0.3);
}

.stepper-item.completed .stepper-indicator {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.stepper-item.completed .stepper-indicator::after {
    content: '✓';
    font-size: 1.2rem;
    font-weight: bold;
}

.stepper-title {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    max-width: 120px;
}

.stepper-item.active .stepper-title {
    color: var(--primary-color);
    font-weight: 700;
}

.stepper-item.completed .stepper-title {
    color: var(--primary-color);
}

.stepper-description {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--muted-foreground, #6c757d);
    text-align: center;
    max-width: 120px;
    line-height: 1.3;
}

/* ステッパーのレスポンシブ対応 */
@media (max-width: 768px) {
    .stepper {
        flex-direction: column;
        gap: 1.5rem;
        max-width: 300px;
    }
    
    .stepper-item:not(:last-child)::after {
        display: none;
    }
    
    .stepper-title,
    .stepper-description {
        max-width: 200px;
    }
}

/* ステッパーのナビゲーション機能 */
.stepper-indicator.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.stepper-indicator.clickable:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 82, 155, 0.3);
}

.stepper-indicator.clickable:active {
    transform: scale(1.05);
}

/* 検索フォームのモーダル表示 */
.search-form-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1000;
    min-width: 400px;
}

.search-form-container.hidden {
    display: none;
}

/* ゲストモード用スタイル */
.guest-badge {
    background-color: var(--guest-bg);
    color: var(--guest-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    margin-right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.guest-badge::before {
    content: "👤";
    font-size: 0.75rem;
}

.guest-notice {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.guest-notice i {
    color: #f39c12;
}

.guest-notice a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.guest-notice a:hover {
    text-decoration: underline;
}