/**
 * 借用書ジェネレーター - フロントエンドCSS（モバイル最適化版）
 *
 * @package Loan_Agreement_Generator
 */

/* ===========================================
   変数定義
   =========================================== */
:root {
    --lag-primary-color: var(--color_main, #2563eb);
    --lag-primary-hover: var(--color_main_dark, #1d4ed8);
    --lag-secondary-color: #64748b;
    --lag-success-color: #10b981;
    --lag-error-color: #ef4444;
    --lag-border-color: #e2e8f0;
    --lag-bg-color: #f8fafc;
    --lag-text-color: #1e293b;
    --lag-text-muted: #64748b;
    --lag-radius: 8px;
    --lag-radius-lg: 12px;
    --lag-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --lag-shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    --lag-safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===========================================
   メインラッパー
   =========================================== */
.lag-generator-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans CJK JP", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--lag-text-color);
    box-sizing: border-box;
}

.lag-generator-wrapper *,
.lag-generator-wrapper *::before,
.lag-generator-wrapper *::after {
    box-sizing: border-box;
}

/* ===========================================
   プログレスバー（改善版）
   =========================================== */
.lag-progress {
    margin-bottom: 20px;
}

.lag-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.lag-progress-message {
    font-size: 14px;
    color: var(--lag-text-color);
    font-weight: 500;
}

.lag-steps-remaining {
    color: var(--lag-primary-color);
    font-weight: 700;
    margin: 0 2px;
}

.lag-progress-percent {
    font-size: 14px;
    font-weight: 600;
    color: var(--lag-primary-color);
}

.lag-progress-bar {
    height: 6px;
    background-color: var(--lag-border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.lag-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lag-primary-color), var(--lag-primary-hover));
    transition: width 0.4s ease;
    border-radius: 3px;
}

/* ステップインジケーター */
.lag-step-indicators {
    display: flex;
    justify-content: space-between;
    position: relative;
}

.lag-step-indicators::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--lag-border-color);
    z-index: 0;
}

.lag-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.lag-step-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--lag-border-color);
    margin-bottom: 4px;
    transition: all 0.3s ease;
}

.lag-step-indicator-active .lag-step-dot,
.lag-step-indicator-completed .lag-step-dot {
    background: var(--lag-primary-color);
    border-color: var(--lag-primary-color);
}

.lag-step-indicator-completed .lag-step-dot::after {
    content: '✓';
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.lag-step-label {
    font-size: 10px;
    color: var(--lag-text-muted);
    text-align: center;
    white-space: nowrap;
}

.lag-step-indicator-active .lag-step-label {
    color: var(--lag-primary-color);
    font-weight: 600;
}

/* ===========================================
   コンテナレイアウト
   =========================================== */
.lag-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

/* ===========================================
   フォームエリア
   =========================================== */
.lag-form-area {
    background: #fff;
    border: 1px solid var(--lag-border-color);
    border-radius: var(--lag-radius-lg);
    padding: 20px;
    box-shadow: var(--lag-shadow);
    height: auto;
}

/* ステップ表示制御 */
.lag-step {
    display: none;
}

.lag-step.lag-active {
    display: block;
    animation: lag-fadeIn 0.3s ease;
}

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

/* ステップタイトル */
.lag-step-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--lag-primary-color);
    color: var(--lag-text-color);
}

/* フォームグループ */
.lag-form-group {
    margin-bottom: 12px;
}

.lag-form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 13px;
    color: var(--lag-text-color);
}

.lag-required {
    color: var(--lag-error-color);
    margin-left: 2px;
}

/* 入力フィールド */
.lag-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--lag-border-color);
    border-radius: var(--lag-radius);
    font-size: 16px;
    color: var(--lag-text-color);
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
    min-height: 42px;
}

.lag-input:focus {
    outline: none;
    border-color: var(--lag-primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.lag-input::placeholder {
    color: #94a3b8;
}

.lag-input.lag-error {
    border-color: var(--lag-error-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.lag-input.lag-valid {
    border-color: var(--lag-success-color);
}

/* 入力ステータス表示 */
.lag-input-status {
    height: 0;
    overflow: hidden;
    margin-top: 0;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: height 0.2s, margin 0.2s;
}

.lag-input-status.lag-status-valid,
.lag-input-status.lag-status-error {
    height: 14px;
    margin-top: 2px;
}

.lag-input-status.lag-status-valid {
    color: var(--lag-success-color);
}

.lag-input-status.lag-status-valid::before {
    content: '✓';
}

.lag-input-status.lag-status-error {
    color: var(--lag-error-color);
}

/* 日付入力のカスタマイズ */
.lag-input[type="date"] {
    min-height: 42px;
}

/* 数値入力のカスタマイズ */
.lag-input[type="number"] {
    -moz-appearance: textfield;
}

.lag-input[type="number"]::-webkit-outer-spin-button,
.lag-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 金額表示 */
.lag-amount-display {
    margin-top: 4px;
    font-size: 12px;
    color: var(--lag-primary-color);
    font-weight: 500;
    padding: 4px 8px;
    background-color: rgba(37, 99, 235, 0.05);
    border-radius: var(--lag-radius);
}

/* ヘルプテキスト */
.lag-help-text {
    margin-top: 4px;
    font-size: 10px;
    color: var(--lag-text-muted);
    line-height: 1.3;
}

/* ステップ注釈 */
.lag-step-note {
    margin-top: 16px;
    padding: 12px 14px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: var(--lag-radius);
    font-size: 13px;
    line-height: 1.6;
    color: #475569;
}

.lag-step-note p {
    margin: 0 0 8px 0;
}

.lag-step-note p:last-child {
    margin-bottom: 0;
}

.lag-step-note a {
    color: #475569;
    text-decoration: underline;
}

.lag-step-note a:hover {
    color: #334155;
}

/* ===========================================
   日付プリセットボタン
   =========================================== */
.lag-date-presets {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.lag-date-preset {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid var(--lag-border-color);
    border-radius: 16px;
    background: #fff;
    color: var(--lag-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.lag-date-preset:hover {
    border-color: var(--lag-primary-color);
    color: var(--lag-primary-color);
}

.lag-date-preset-active {
    background: var(--lag-primary-color);
    border-color: var(--lag-primary-color);
    color: #fff;
}

/* ===========================================
   セグメントコントロール
   =========================================== */
.lag-segment-control {
    display: flex;
    background: var(--lag-bg-color);
    border-radius: var(--lag-radius);
    padding: 3px;
    gap: 3px;
}

.lag-segment-control input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lag-segment-option {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--lag-text-muted);
    background: transparent;
    border-radius: calc(var(--lag-radius) - 2px);
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
}

.lag-segment-control input[type="radio"]:checked + .lag-segment-option {
    background: #fff;
    color: var(--lag-primary-color);
    box-shadow: var(--lag-shadow);
}

.lag-segment-control input[type="radio"]:focus + .lag-segment-option {
    outline: 2px solid var(--lag-primary-color);
    outline-offset: 2px;
}

/* 旧ラジオボタン（互換性のため残す） */
.lag-radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.lag-radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px 16px;
    border: 2px solid var(--lag-border-color);
    border-radius: var(--lag-radius);
    transition: all 0.2s;
    flex: 1;
    min-width: 100px;
    justify-content: center;
}

.lag-radio-label:hover {
    border-color: var(--lag-primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.lag-radio-label input[type="radio"] {
    margin-right: 8px;
    accent-color: var(--lag-primary-color);
    width: 16px;
    height: 16px;
}

.lag-radio-label:has(input[type="radio"]:checked) {
    border-color: var(--lag-primary-color);
    background-color: rgba(37, 99, 235, 0.08);
}

/* チェックボックス */
.lag-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.lag-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
    accent-color: var(--lag-primary-color);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.lag-checkbox-label a {
    color: var(--lag-primary-color);
    text-decoration: none;
    font-weight: 500;
}

.lag-checkbox-label a:hover {
    text-decoration: underline;
}

/* プライバシー同意 */
.lag-privacy-agree {
    margin-top: 20px;
    padding: 14px;
    background-color: var(--lag-bg-color);
    border-radius: var(--lag-radius);
    border: 1px solid var(--lag-border-color);
}

/* ===========================================
   確認ステップ
   =========================================== */
.lag-confirm-content {
    background-color: var(--lag-bg-color);
    border-radius: var(--lag-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.lag-confirm-section {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--lag-border-color);
}

.lag-confirm-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.lag-confirm-label {
    font-weight: 600;
    font-size: 12px;
    color: var(--lag-text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lag-confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.lag-confirm-key {
    color: var(--lag-text-muted);
    font-size: 13px;
}

.lag-confirm-value {
    font-weight: 600;
    color: var(--lag-text-color);
    font-size: 14px;
}

/* ===========================================
   完了ステップ
   =========================================== */
.lag-complete-message {
    text-align: center;
    padding: 24px 16px;
    position: relative;
}

.lag-complete-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--lag-success-color), #059669);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: lag-pop 0.5s ease;
}

.lag-complete-icon svg {
    width: 36px;
    height: 36px;
}

@keyframes lag-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* コンフェッティ演出 */
.lag-confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    pointer-events: none;
    overflow: hidden;
}

.lag-confetti::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle, var(--lag-primary-color) 2px, transparent 2px),
        radial-gradient(circle, var(--lag-success-color) 2px, transparent 2px),
        radial-gradient(circle, #f59e0b 2px, transparent 2px);
    background-size: 30px 30px, 40px 40px, 25px 25px;
    background-position: 0 0, 15px 15px, 5px 25px;
    animation: lag-confetti-fall 2s ease-out forwards;
    opacity: 0;
}

.lag-step-complete.lag-active .lag-confetti::before {
    opacity: 1;
}

@keyframes lag-confetti-fall {
    0% { transform: translateY(-100%); opacity: 1; }
    100% { transform: translateY(100px); opacity: 0; }
}

.lag-complete-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--lag-text-color);
}

.lag-complete-text {
    color: var(--lag-text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.lag-download-buttons {
    margin-bottom: 16px;
}

.lag-btn-primary-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
    border: none;
    border-radius: var(--lag-radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    text-decoration: none;
}

.lag-btn-primary-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
    color: #fff;
}

.lag-btn-primary-download .lag-btn-icon {
    width: 20px;
    height: 20px;
}

.lag-btn-primary-download.lag-btn-disabled,
.lag-btn-primary-download:disabled {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.lag-btn-primary-download.lag-btn-disabled:hover,
.lag-btn-primary-download:disabled:hover {
    transform: none;
    box-shadow: none;
}

.lag-secondary-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.lag-btn-outline {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    color: var(--lag-text-muted);
    border: 1px solid var(--lag-border-color);
    border-radius: var(--lag-radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.lag-btn-outline:hover {
    border-color: var(--lag-primary-color);
    color: var(--lag-primary-color);
}

/* ===========================================
   ナビゲーションボタン
   =========================================== */
.lag-nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--lag-border-color);
    gap: 12px;
}

.lag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--lag-radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    min-height: 48px;
}

.lag-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.lag-btn-primary {
    background: linear-gradient(135deg, var(--lag-primary-color), var(--lag-primary-hover));
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.lag-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.lag-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.lag-btn-secondary {
    background-color: #fff;
    color: var(--lag-text-color);
    border: 1px solid var(--lag-border-color);
}

.lag-btn-secondary:hover:not(:disabled) {
    background-color: var(--lag-bg-color);
    border-color: var(--lag-secondary-color);
}

/* ===========================================
   プレビューエリア
   =========================================== */
.lag-preview-area {
    background: #fff;
    border: 1px solid var(--lag-border-color);
    border-radius: var(--lag-radius-lg);
    box-shadow: var(--lag-shadow);
    display: flex;
    flex-direction: column;
    max-height: 500px;
    height: 500px;
    position: sticky;
    top: 20px;
    overflow: hidden;
}

/* 注釈（全幅） */
.lag-notes {
    margin-top: 16px;
}

.lag-note-full {
    display: none;
}

.lag-notes.lag-notes-full .lag-note-short {
    display: none;
}

.lag-notes.lag-notes-full .lag-note-full {
    display: block;
}

.lag-preview-toggle {
    display: none;
}

.lag-preview-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--lag-bg-color), #fff);
    border-bottom: 1px solid var(--lag-border-color);
}

.lag-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--lag-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lag-preview-icon {
    width: 18px;
    height: 18px;
}

.lag-preview-chevron {
    width: 20px;
    height: 20px;
    transition: transform 0.3s;
}

.lag-preview-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 13px;
    line-height: 2;
    font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS Mincho", serif;
    -webkit-overflow-scrolling: touch;
}

.lag-preview-placeholder {
    color: var(--lag-text-muted);
    text-align: center;
    padding: 60px 20px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===========================================
   エラーメッセージ
   =========================================== */
.lag-error-message {
    background-color: #fef2f2;
    color: var(--lag-error-color);
    padding: 12px 16px;
    border-radius: var(--lag-radius);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid var(--lag-error-color);
    animation: lag-shake 0.5s ease;
}

@keyframes lag-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* ===========================================
   ローディング
   =========================================== */
.lag-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lag-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--lag-border-color);
    border-top-color: var(--lag-primary-color);
    border-radius: 50%;
    animation: lag-spin 0.8s linear infinite;
}

@keyframes lag-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================================
   タブレット対応 (768px - 900px)
   =========================================== */
@media (max-width: 900px) {
    .lag-container {
        grid-template-columns: 1fr;
    }

    .lag-preview-area {
        position: static;
        max-height: none;
        height: auto;
        order: 1;
        margin-bottom: 12px;
    }

    .lag-form-area {
        order: 2;
        height: auto;
    }

    /* モバイルでプレビューを折りたたみ式に */
    .lag-preview-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .lag-preview-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: auto;
        padding: 4px 6px;
        background: transparent;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        color: var(--lag-text-muted);
    }

    .lag-preview-toggle-icon {
        display: inline-block;
        transition: transform 0.3s ease;
    }

    .lag-preview-content {
        max-height: 0;
        padding: 0 16px;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .lag-preview-area.lag-preview-expanded .lag-preview-content {
        max-height: 400px;
        padding: 16px;
        overflow-y: auto;
    }

    .lag-preview-area.lag-preview-expanded .lag-preview-toggle-icon,
    .lag-preview-area.lag-preview-expanded .lag-preview-chevron {
        transform: rotate(180deg);
    }
}

/* ===========================================
   モバイル対応 (600px以下)
   =========================================== */
@media (max-width: 600px) {
    .lag-generator-wrapper {
        padding: 10px;
    }

    /* プログレス */
    .lag-progress {
        margin-bottom: 12px;
    }

    .lag-progress-header {
        margin-bottom: 4px;
    }

    .lag-progress-message {
        font-size: 12px;
    }

    .lag-progress-bar {
        height: 3px;
        margin-bottom: 8px;
    }

    .lag-step-indicators {
        display: flex;
    }

    .lag-step-indicators::before {
        top: 7px;
        left: 12px;
        right: 12px;
    }

    .lag-step-dot {
        width: 14px;
        height: 14px;
    }

    .lag-step-label {
        font-size: 8px;
    }

    /* フォーム */
    .lag-form-area {
        padding: 10px;
        border-radius: var(--lag-radius);
    }

    .lag-step-title {
        font-size: 14px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .lag-form-group {
        margin-bottom: 8px;
    }

    .lag-form-group label {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .lag-input {
        padding: 6px 8px;
        font-size: 16px;
        min-height: 34px;
        border-radius: 5px;
    }

    .lag-input[type="date"] {
        min-height: 34px;
    }

    /* 入力ステータス */
    .lag-input-status.lag-status-valid,
    .lag-input-status.lag-status-error {
        height: 10px;
        margin-top: 1px;
        font-size: 9px;
    }

    /* 日付プリセット */
    .lag-date-presets {
        gap: 2px;
        margin-bottom: 3px;
    }

    .lag-date-preset {
        padding: 2px 6px;
        font-size: 9px;
    }

    /* セグメントコントロール */
    .lag-segment-control {
        padding: 2px;
    }

    .lag-segment-option {
        padding: 5px 8px;
        font-size: 11px;
    }

    /* ナビボタン */
    .lag-nav-buttons.lag-nav-fixed {
        position: static;
        background: transparent;
        border-top: none;
        padding: 0;
        margin-top: 12px;
        box-shadow: none;
    }

    .lag-btn {
        flex: 1;
        padding: 10px 14px;
        font-size: 14px;
        min-height: 42px;
    }

    /* 確認ステップ */
    .lag-confirm-content {
        padding: 10px;
    }

    .lag-confirm-section {
        padding-bottom: 10px;
        margin-bottom: 10px;
    }

    .lag-confirm-row {
        padding: 3px 0;
    }

    .lag-confirm-key {
        font-size: 11px;
    }

    .lag-confirm-value {
        font-size: 12px;
    }

    /* 完了ステップ */
    .lag-complete-message {
        padding: 16px 10px;
    }

    .lag-complete-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 10px;
    }

    .lag-complete-icon svg {
        width: 28px;
        height: 28px;
    }

    .lag-complete-title {
        font-size: 17px;
    }

    .lag-complete-text {
        font-size: 12px;
        margin-bottom: 16px;
    }

    .lag-btn-primary-download {
        padding: 12px 18px;
        font-size: 14px;
    }

    .lag-secondary-actions {
        gap: 6px;
    }

    .lag-btn-outline {
        padding: 6px 14px;
        font-size: 12px;
    }

    /* プレビュー */
    .lag-preview-area {
        border-radius: var(--lag-radius);
        margin-bottom: 10px;
    }

    .lag-preview-toggle {
        padding: 10px 12px;
        font-size: 12px;
    }

    .lag-preview-area.lag-preview-expanded .lag-preview-content {
        max-height: 250px;
        padding: 10px;
    }

    .lag-preview-content {
        font-size: 10px;
        line-height: 1.7;
    }

    /* エラーメッセージ */
    .lag-error-message {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* 金額表示 */
    .lag-amount-display {
        font-size: 11px;
        padding: 3px 6px;
        margin-top: 3px;
    }

    /* ヘルプテキスト */
    .lag-help-text {
        font-size: 9px;
        margin-top: 2px;
    }

    /* プライバシー同意 */
    .lag-privacy-agree {
        margin-top: 12px;
        padding: 10px;
    }

    .lag-checkbox-label {
        font-size: 12px;
    }
}

/* ===========================================
   小さいモバイル対応 (375px以下)
   =========================================== */
@media (max-width: 375px) {
    .lag-generator-wrapper {
        padding: 5px;
    }

    .lag-form-area {
        padding: 8px;
    }

    .lag-step-title {
        font-size: 13px;
        margin-bottom: 6px;
        padding-bottom: 5px;
    }

    .lag-form-group {
        margin-bottom: 6px;
    }

    .lag-form-group label {
        font-size: 10px;
        margin-bottom: 1px;
    }

    .lag-input {
        padding: 5px 6px;
        min-height: 32px;
    }

    .lag-input[type="date"] {
        min-height: 32px;
    }

    .lag-input-status.lag-status-valid,
    .lag-input-status.lag-status-error {
        height: 9px;
        font-size: 8px;
    }

    .lag-date-preset {
        padding: 2px 5px;
        font-size: 8px;
    }

    .lag-segment-option {
        padding: 4px 6px;
        font-size: 10px;
    }

    .lag-btn {
        padding: 7px 10px;
        font-size: 12px;
        min-height: 36px;
    }

    .lag-step-dot {
        width: 10px;
        height: 10px;
    }

    .lag-step-label {
        font-size: 7px;
    }

    .lag-step-indicators::before {
        top: 5px;
        left: 8px;
        right: 8px;
    }

    .lag-amount-display {
        font-size: 9px;
        padding: 2px 4px;
    }

    .lag-help-text {
        font-size: 8px;
    }

    .lag-privacy-agree {
        margin-top: 8px;
        padding: 6px;
    }

    .lag-checkbox-label {
        font-size: 10px;
    }
}

/* ===========================================
   タッチデバイス対応
   =========================================== */
@media (hover: none) and (pointer: coarse) {
    .lag-btn:hover {
        transform: none;
    }

    .lag-btn:active:not(:disabled) {
        transform: scale(0.98);
    }

    .lag-date-preset:hover {
        border-color: var(--lag-border-color);
        color: var(--lag-text-muted);
    }

    .lag-date-preset:active {
        border-color: var(--lag-primary-color);
        color: var(--lag-primary-color);
    }

    .lag-date-preset-active:hover {
        background: var(--lag-primary-color);
        border-color: var(--lag-primary-color);
        color: #fff;
    }
}

/* ===========================================
   印刷用スタイル
   =========================================== */
@media print {
    .lag-generator-wrapper {
        max-width: none;
        padding: 0;
    }

    .lag-form-area,
    .lag-progress,
    .lag-nav-buttons {
        display: none !important;
    }

    .lag-preview-area {
        border: none;
        box-shadow: none;
        max-height: none;
        position: static;
    }

    .lag-preview-toggle,
    .lag-preview-header {
        display: none;
    }

    .lag-preview-content {
        max-height: none !important;
        padding: 0 !important;
        font-size: 12pt;
    }
}

/* ===========================================
   アクセシビリティ
   =========================================== */
@media (prefers-reduced-motion: reduce) {
    .lag-progress-fill,
    .lag-step.lag-active,
    .lag-btn,
    .lag-input,
    .lag-segment-option,
    .lag-error-message,
    .lag-complete-icon,
    .lag-confetti::before,
    .lag-preview-content,
    .lag-preview-chevron {
        transition: none;
        animation: none;
    }
}

/* フォーカス可視化 */
.lag-input:focus-visible,
.lag-btn:focus-visible,
.lag-date-preset:focus-visible,
.lag-preview-toggle:focus-visible,
.lag-checkbox-label:focus-within {
    outline: 2px solid var(--lag-primary-color);
    outline-offset: 2px;
}

/* ハイコントラストモード */
@media (prefers-contrast: high) {
    .lag-input {
        border-width: 2px;
    }

    .lag-btn {
        border: 2px solid currentColor;
    }
}
