/* Section Background Design */

/* 基本カラー定義 */
:root {
    --color-text-primary: #333;
    --color-text-secondary: #444;
    --color-text-muted: #999;
    --color-accent: #f08080;
    --color-accent-hover: #e06060;
    --color-bg: #fff;
    --color-bg-section: #f9f9f9;
    --color-bg-header: #f0f0f0;
    --color-border: #ddd;
    --shadow-card: 0 1px 4px rgba(0,0,0,0.1);
}

/* ページ全体の背景 */
body {
    background-color: var(--color-bg-section);
}

/* セクションカード */
.tts-section {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    margin-bottom: 2.5rem;
}

.tts-section-header {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text-primary);
    padding: 1rem 1.5rem;
    background: var(--color-bg-header);
    border-bottom: 1px solid var(--color-border);
    letter-spacing: 0.02em;
}

.tts-section-header i {
    color: var(--color-accent);
    margin-right: 0.5rem;
}

.tts-section-body {
    padding: 2rem;
}

/* ページヘッダー */
.page-header {
    padding: 2.4rem 0 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text-primary);
    letter-spacing: 0.03em;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    font-weight: 400;
}

.sample-link {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 1.1rem;
    color: var(--color-accent);
    text-decoration: none;
}
.sample-link:hover {
    opacity: 0.8;
}

/* スライダー */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.625rem;
}

.slider-label-text {
    font-size: 0.875rem;
    color: var(--color-text-primary);
    min-width: 2.5rem;
}

.slider-value {
    min-width: 90px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    background: var(--color-bg-header);
    border: 1px solid var(--color-border);
    padding: 0.375rem 0.75rem;
    font-weight: 500;
}

.slider-value-inline {
    font-size: 0.875rem;
    color: var(--color-text-primary);
    font-weight: 400;
    margin-left: 0.5rem;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: var(--color-border);
    outline: none;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-accent);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--color-accent-hover);
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* フォームラベル */
.form-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.75rem;
    display: block;
}

/* テキストエリア */
.form-control {
    border: 1px solid var(--color-border);
    padding: 1rem;
    font-size: 1rem;
    color: var(--color-text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(240, 128, 128, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

/* セレクト */
.form-select {
    border: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--color-text-primary);
}

.form-select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(240, 128, 128, 0.1);
    outline: none;
}

.voice-setting,
.seed-setting,
.quality-setting {
    display: flex;
    align-items: center;
}

.voice-setting,
.seed-setting {
    gap: 0.375rem;
}

.voice-setting label,
.seed-setting label {
    flex: 0 0 auto;
    white-space: nowrap;
}

.voice-setting select,
.seed-setting input {
    flex: 1 1 auto;
    min-width: 0;
}

.seed-setting input {
    padding: 0.375rem 0.75rem;
}

.quality-setting {
    justify-content: flex-end;
}

@media (max-width: 767.98px) {
    .voice-seed-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        column-gap: 0.5rem;
        row-gap: 0.75rem;
        align-items: center;
        margin-left: 0;
        margin-right: 0;
    }

    .voice-seed-row .voice-setting {
        grid-column: 1;
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    .voice-seed-row .seed-setting {
        grid-column: 2;
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    .voice-seed-row .quality-setting {
        grid-column: 1 / -1;
        max-width: none;
        padding-left: 0;
        padding-right: 0;
        justify-content: flex-start;
    }
}

#clear-text-btn.btn-outline-secondary {
    border-color: #d7dbe0;
    color: #66707a;
}

#clear-text-btn.btn-outline-secondary:hover,
#clear-text-btn.btn-outline-secondary:focus {
    border-color: #c6ccd3;
    color: #5a646e;
}

/* 送信ボタン */
.submit-btn {
    background: var(--color-accent);
    color: #fff;
    border: none;
    padding: 0.625rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    width: 100%;
    margin-top: 0.75rem;
    box-shadow: var(--shadow-card);
}

.submit-btn:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.submit-btn i {
    margin-right: 0.5rem;
}

/* 小さめの送信ボタン */
.submit-btn-sm {
    background: var(--color-accent);
    color: #fff;
    border: none;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    box-shadow: var(--shadow-card);
}

.submit-btn-sm:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
}

.submit-btn-sm:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.submit-btn-sm i {
    margin-right: 0.375rem;
}

/* リセットボタン */
.reset-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.reset-btn:hover {
    color: var(--color-accent);
}

/* 結果表示 */
.result-card {
    background: var(--color-bg);
}

.result-actions {
    align-items: center;
    gap: 0.75rem;
}

.result-seed {
    align-items: center;
    color: var(--color-text-secondary);
    display: inline-flex;
    font-size: 0.9375rem;
    gap: 0.375rem;
}

.result-seed-pin {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--color-accent);
    cursor: pointer;
    display: inline-flex;
    font-size: 1rem;
    padding: 0.25rem;
}

.result-seed-pin:hover,
.result-seed-pin:focus {
    color: var(--color-accent-hover);
    outline: none;
}

.result-info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
}

.result-info-item:not(:last-child) {
    border-bottom: 1px solid var(--color-border);
}

.result-info-label {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.result-info-label i {
    margin-right: 0.5rem;
    color: var(--color-accent);
}

.result-info-value {
    font-weight: 600;
    color: var(--color-text-primary);
}

/* ローディング */
.loading-overlay {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
}

.loading-overlay .fa-spinner {
    font-size: 3rem;
    color: var(--color-accent);
}

.loading-hints {
    display: grid;
    align-items: center;
    width: 100%;
    max-width: 640px;
    /* 全26ロケール実測の最大ヒント高さ（デスクトップ59px・モバイル98px）+ バッファ。レイアウトシフト防止。
       例外: el ログイン時カード117pxのみモバイル値を僅かに超過（クリップはされず軽微なシフトのみ、許容） */
    min-height: 5rem;
    margin-top: 0.5rem;
}

.loading-hint-group {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 500ms ease, visibility 0s linear 500ms;
}

.loading-hint-group.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 500ms ease, visibility 0s linear 0s;
}

.loading-hint-text,
.loading-hint-card {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.loading-hint-card {
    background: var(--color-bg-header);
    border: 1px solid var(--color-border);
    padding: 0.625rem 1rem;
    border-radius: 4px;
}

.loading-hint-link {
    color: var(--color-accent);
    font-weight: bold;
}

@media (max-width: 767.98px) {
    .loading-hints {
        min-height: 7.5rem;
    }
}

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

@keyframes quotaCtaPulse {
    0%   { box-shadow: 0 4px 10px rgba(222, 124, 124, 0.2); }
    50%  { box-shadow: 0 4px 22px rgba(222, 124, 124, 0.55); }
    100% { box-shadow: 0 4px 10px rgba(222, 124, 124, 0.2); }
}

@media (prefers-reduced-motion: reduce) {
    #quota-cta-signup-link.quota-cta-btn {
        animation: none;
    }
}

/* エラーアラート */
.error-alert {
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    color: #c0392b;
    padding: 1rem 1.5rem;
}

.error-alert i {
    margin-right: 0.5rem;
}

/* アクションボタン */
.action-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.action-btn-primary {
    background: var(--color-accent);
    color: #fff;
}

.action-btn-primary:hover {
    background: var(--color-accent-hover);
}

.action-btn-secondary {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.action-btn-secondary:hover {
    background: var(--color-bg-header);
}

.action-btn i {
    margin-right: 0.5rem;
}

/* クォータ超過時のCTA */
.quota-cta-shell {
    margin-top: 0.875rem;
}

.quota-cta-panel {
    border: 1px solid #ec9c9c;
    border-radius: 14px;
    padding: 1.25rem 1.25rem 1.125rem;
    background:
        radial-gradient(circle at top right, rgba(240, 128, 128, 0.22), transparent 60%),
        linear-gradient(145deg, #fffdfd 0%, #ffeeee 100%);
    box-shadow: 0 10px 24px -10px rgba(192, 57, 43, 0.25);
}

.quota-cta-panel--member {
    border-color: #f2aaaa;
}

.quota-cta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.625rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: #ffd8d8;
    color: #a4302f;
}

.quota-cta-title {
    margin: 0 0 0.375rem;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.35;
    color: #5f2424;
    font-family: "Avenir Next", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}

.quota-cta-lead {
    margin: 0 0 1rem;
    color: #7a3c3c;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.quota-cta-highlight {
    color: #ce4f4f;
    font-weight: 700;
}

.quota-cta-point-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0 0 1rem;
}

.quota-cta-point-card {
    border: 1px solid #f4d1d1;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    padding: 0.625rem 0.75rem;
}

.quota-cta-point-title {
    margin: 0;
    color: #9b3b3b;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.quota-cta-point-value {
    margin: 0.1875rem 0 0;
    color: #6f2e2e;
    font-size: 0.9375rem;
    font-weight: 700;
}

.quota-cta-benefit-list {
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.4375rem;
}

.quota-cta-benefit-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: #5f2424;
    font-size: 0.875rem;
    line-height: 1.5;
}

.quota-cta-benefit-item i {
    margin-top: 0.1875rem;
    color: #d35f5f;
}

.quota-cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.quota-cta-btn {
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 700;
    padding: 0.6875rem 1.375rem;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(222, 124, 124, 0.2);
}

.quota-cta-btn.action-btn-secondary {
    box-shadow: none;
}

/* pulse animation: ゲスト日本語の signup ボタンを 2 回だけ光らせる。
   ログイン済み A/B テスト中の pricing ボタンは対象外なため、ID で限定する。
   reduced-motion 対応は @keyframes 近傍の @media で一括指定済み */
#quota-cta-signup-link.quota-cta-btn {
    animation: quotaCtaPulse 1.8s ease-out 2;
}

/* 文字数カウント */
.char-count {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* 設定行のラベル */
.setting-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.setting-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.setting-label i {
    color: var(--color-accent);
    margin-right: 0.375rem;
}

/* 補足テキスト */
.help-text {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
}

/* --- Integrated Card Layout --- */
.integrated-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    margin-bottom: 2.5rem;
}

.card-section {
    padding: 1.5rem 1.75rem;
}

/* 生成結果エリアのパディング調整 */
#result-area {
    padding: 0;
    margin: 0;
}

#result-area .result-card {
    margin: 0;
}

.card-section-settings {
    /* 背景色を削除して白に統一 */
}

/* 設定セクション */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

/* トグルスイッチ */
.toggle-container-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
}

.toggle-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    height: 24px;
}

.toggle-label.active {
    color: var(--color-text-primary);
    font-weight: 600;
}


.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-accent);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #8B5CF6;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* インフォツールチップ */
.info-tooltip {
    color: var(--color-text-muted);
    cursor: help;
    margin-left: 0.375rem;
    position: relative;
}

.info-tooltip:hover,
.info-tooltip:focus {
    color: var(--color-accent);
    outline: none;
}

.info-tooltip:hover::after,
.info-tooltip:focus::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    bottom: 130%;
    background: #fff;
    color: var(--color-text-primary);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.6;
    width: 280px;
    max-width: min(280px, calc(100vw - 2rem));
    white-space: normal;
    overflow-wrap: break-word;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--color-border);
}

/* モバイル対応 */
@media (max-width: 768px) {
    .page-title {
        font-size: 1.5rem;
    }

    .tts-section-body {
        padding: 1.25rem;
    }

    .slider-container {
        flex-wrap: wrap;
    }

    .slider-value {
        width: 100%;
        margin-top: 0.75rem;
    }

    .submit-btn {
        font-size: 1rem;
        padding: 0.5rem 1.5rem;
    }

    .card-section {
        padding: 1rem 1.25rem;
    }

    .quota-cta-panel {
        padding: 1rem 1rem 0.9375rem;
    }

    .quota-cta-title {
        font-size: 1.25rem;
    }

    .quota-cta-point-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .quota-cta-actions .quota-cta-btn {
        width: 100%;
        justify-content: center;
    }

    .info-tooltip:hover::after,
    .info-tooltip:focus::after {
        width: 240px;
        max-width: calc(100vw - 2rem);
        left: auto;
        right: -1rem;
    }
}

/* FAQ アコーディオン（gemini_tts_beta_faq.html 用） */
.beta-faq-item {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.beta-faq-item:last-child {
    margin-bottom: 0;
}
.beta-faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    outline: none;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-text-primary);
    cursor: pointer;
    text-align: left;
}
.beta-faq-group-title {
    font-size: 1.125rem;
}
.beta-faq-question:focus {
    outline: none;
    box-shadow: none;
}
.beta-faq-question:focus-visible {
    outline: 2px solid var(--color-accent-hover);
    outline-offset: 2px;
}
.beta-faq-question:hover {
    color: var(--color-accent);
    background: rgba(0, 0, 0, 0.02);
}
.beta-faq-question .faq-chevron {
    color: var(--color-accent);
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 1rem;
}
.beta-faq-question[aria-expanded="true"] .faq-chevron {
    transform: rotate(180deg);
}
.beta-faq-answer {
    margin: 0;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
}
.beta-faq-answer a {
    color: var(--color-accent);
    text-decoration: underline;
}
.beta-faq-answer a:hover,
.beta-faq-answer a:focus {
    color: var(--color-accent-hover);
}
