/* リセットとベース設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 62.5%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Yu Gothic", "Hiragino Sans", sans-serif;
    font-size: 1.6rem;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding: 1rem 0;
}

@media (min-width: 769px) {
    body {
        padding: 2rem 0;
    }
}

/* コンテナ */
.container {
    max-width: 800px;
    margin: 3rem auto;
    padding: 3rem 2rem;
    background-color: #fff;
    min-height: calc(100vh - 6rem);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 1rem;
        box-shadow: none;
        border-radius: 8px;
        min-height: calc(100vh - 2rem);
    }
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e9ecef;
}

.logo-container {
    margin-bottom: 2rem;
}

.logo {
    max-width: 360px;
    height: auto;
}

@media (max-width: 768px) {
    .logo {
        max-width: 280px;
    }
}

.header h1 {
    font-size: 2.8rem;
    color: #2c5aa0;
    margin-bottom: 1rem;
    font-weight: 600;
}

.header p {
    font-size: 1.4rem;
    color: #6c757d;
}

.back-link {
    margin-top: 1.5rem;
}

.back-link a {
    color: #6c757d;
    text-decoration: none;
    font-size: 1.4rem;
    transition: color 0.3s ease;
}

.back-link a:hover {
    color: #2c5aa0;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .header {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }

    .header h1 {
        font-size: 2.2rem;
    }

    .header p {
        font-size: 1.3rem;
    }
    
    .back-link {
        margin-top: 1rem;
    }
    
    .back-link a {
        font-size: 1.3rem;
    }
}

/* メイン */
.main {
    margin-bottom: 3rem;
}

/* フォームセクション */
.form-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #2c5aa0;
}

.form-section h2 {
    font-size: 2rem;
    color: #2c5aa0;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .form-section {
        margin-bottom: 2rem;
        padding: 1.2rem;
        border-radius: 6px;
    }

    .form-section h2 {
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }
}

/* フォームグループ */
.form-group {
    margin-bottom: 2rem;
}

.form-group.required label::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 1.5rem;
    }
}

/* ラベル */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
    font-size: 1.4rem;
}

@media (max-width: 768px) {
    label {
        font-size: 1.3rem;
    }
}

/* 入力フィールド */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #ced4da;
    border-radius: 4px;
    font-size: 1.4rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

input[type="text"].error,
input[type="email"].error,
input[type="tel"].error,
input[type="date"].error,
input[type="number"].error,
textarea.error {
    border-color: #dc3545;
}

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

@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    input[type="number"],
    textarea {
        font-size: 1.6rem;
        padding: 0.8rem;
    }
}

/* セレクトボックス */
select {
    width: 100%;
    padding: 1rem;
    border: 2px solid #ced4da;
    border-radius: 4px;
    font-size: 1.4rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
    cursor: pointer;
    font-family: inherit;
}

select:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

select.error {
    border-color: #dc3545;
}

/* ラジオボタン */
.radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .radio-group {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: #fff;
    border: 2px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    font-weight: normal;
    margin-bottom: 0;
}

.radio-label:hover {
    border-color: #2c5aa0;
    background-color: #f8f9fa;
}

.radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ced4da;
    border-radius: 50%;
    margin-right: 0.8rem;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

.radio-custom::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #2c5aa0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: #2c5aa0;
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.radio-label:has(input[type="radio"]:checked) {
    background-color: #f0f4f8;
    border-color: #2c5aa0;
}

@media (max-width: 768px) {
    .radio-label {
        font-size: 1.3rem;
        padding: 0.8rem;
    }
}

/* fieldsetとlegendのスタイリング */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

legend {
    font-weight: 600;
    color: #495057;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

legend.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

@media (max-width: 768px) {
    legend {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }
}

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

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ced4da;
    border-radius: 3px;
    margin-right: 0.8rem;
    margin-top: 0.1rem;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.checkbox-custom::after {
    content: "";
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    position: absolute;
    top: 2px;
    left: 5px;
    transform: rotate(45deg) scale(0);
    transition: transform 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background-color: #2c5aa0;
    border-color: #2c5aa0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    transform: rotate(45deg) scale(1);
}

/* リンク */
a {
    color: #2c5aa0;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* エラーメッセージ */
.error-message {
    display: block;
    color: #dc3545;
    font-size: 1.2rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .error-message {
        font-size: 1.1rem;
    }
}

/* 情報ボックス */
.info-box {
    background-color: #e8f4f8;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 1.5rem;
    font-size: 1.3rem;
    line-height: 1.7;
}

.info-box p {
    margin: 0.5rem 0;
}

.info-box p:first-child {
    margin-top: 0;
}

.info-box p:last-child {
    margin-bottom: 0;
}

.info-box .small-text {
    font-size: 1.2rem;
    color: #495057;
}

/* スマホ用の情報ボックス調整 */
@media (max-width: 768px) {
    .info-box {
        padding: 1rem;
        font-size: 1.2rem;
        line-height: 1.6;
    }
    
    .info-box p {
        margin: 0.3rem 0;
    }
    
    .info-box .small-text {
        font-size: 1.1rem;
    }
}

/* 文字数カウント */
.char-count {
    text-align: right;
    font-size: 1.2rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* 送信セクション */
.submit-section {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e9ecef;
}

@media (max-width: 768px) {
    .submit-section {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
}

/* 送信ボタン */
.submit-btn {
    background: #2c5aa0;
    color: #fff;
    border: none;
    padding: 1.5rem 3rem;
    font-size: 1.6rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 200px;
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.3);
}

.submit-btn:hover:not(:disabled) {
    background: #1e3a5f;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 90, 160, 0.4);
}

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

.submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@media (max-width: 768px) {
    .submit-btn {
        width: 100%;
        max-width: 300px;
        padding: 1.2rem 2rem;
        font-size: 1.4rem;
    }
}

/* ボタン共通 */
.btn {
    border: none;
    padding: 1.5rem 3rem;
    font-size: 1.6rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.btn-primary {
    background: #2c5aa0;
    color: #fff;
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: #1e3a5f;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 90, 160, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

@media (max-width: 768px) {
    .btn {
        width: 100%;
        padding: 1.2rem 1.5rem;
        font-size: 1.4rem;
        min-width: auto;
    }
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 2.5rem;
    border-radius: 8px;
    text-align: center;
    max-width: 500px;
    margin: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #2c5aa0;
    font-weight: 600;
}

.modal-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 1.4rem;
}

@media (max-width: 768px) {
    .modal-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .modal-content h3 {
        font-size: 1.8rem;
    }

    .modal-content p {
        font-size: 1.3rem;
    }
}

/* フッター */
.footer {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
    color: #6c757d;
    font-size: 1.3rem;
    line-height: 1.8;
}

.footer p {
    margin: 0.3rem 0;
}

/* アクセシビリティ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* フォーカス指示 */
input:focus,
textarea:focus,
select:focus,
button:focus,
.checkbox-label:focus-within {
    outline: 2px solid #2c5aa0;
    outline-offset: 2px;
}

/* 完了画面 */
#successScreen {
    padding: 8rem 2rem;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
}

.success-card {
    max-width: 700px;
    margin: 0 auto;
    padding: 5rem 4rem;
    background-color: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
    border-top: 4px solid #2c5aa0;
}

.success-card h2 {
    font-size: 2.8rem;
    color: #1a1a1a;
    margin-bottom: 3rem;
    font-weight: 400;
    letter-spacing: 0.05em;
}

.success-card p {
    font-size: 1.5rem;
    line-height: 2;
    color: #4a4a4a;
    margin: 1.2rem 0;
    font-weight: 300;
}

.btn-back-home {
    display: inline-block;
    margin-top: 4rem;
    padding: 1.4rem 4rem;
    background: #2c5aa0;
    color: #fff;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 400;
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.15);
    letter-spacing: 0.08em;
}

.btn-back-home:hover {
    background: #234780;
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.25);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    #successScreen {
        padding: 5rem 1.5rem;
    }

    .success-card {
        padding: 4rem 2.5rem;
    }

    .success-card h2 {
        font-size: 2.2rem;
        margin-bottom: 2.5rem;
    }

    .success-card p {
        font-size: 1.4rem;
        line-height: 1.9;
    }

    .btn-back-home {
        width: 100%;
        max-width: 320px;
        padding: 1.3rem 2rem;
        font-size: 1.4rem;
        margin-top: 3rem;
    }
}