:root {
    --primary-color: #d32f2f;
    --primary-hover: #b71c1c;
    --bg-main: #ffffff;
    --text-main: #333;
}

/* 画面の横揺れ・はみ出しを強制ブロック */
html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Avenir', "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* フッターを下に押し下げるため */
}

.wrapper {
    flex: 1; 
    padding: 30px 10px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw; /* 画面幅以上への広がりを防止 */
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.08);
    border: 1px solid #eaeaea;
    box-sizing: border-box;
    width: 100%; /* スマホでの横幅確保 */
}

h1, h2, h3 { text-align: center; color: #111; letter-spacing: 1px; }

.btn {
    display: block; width: 100%; padding: 16px; 
    background: linear-gradient(135deg, #ef5350, var(--primary-color)); 
    color: #fff;
    border: none; border-radius: 8px; font-size: 1.1em; font-weight: bold;
    cursor: pointer; text-align: center; text-decoration: none; box-sizing: border-box;
    transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(211, 47, 47, 0.4); }
.btn-secondary { background: linear-gradient(135deg, #78909c, #546e7a); box-shadow: 0 4px 15px rgba(84, 110, 122, 0.3); }

.form-group { margin-bottom: 22px; }
label { display: block; font-weight: bold; margin-bottom: 8px; color: #444; font-size: 0.95em; }
input[type="text"], input[type="password"], input[type="email"], select, textarea {
    width: 100%; padding: 14px; border: 1px solid #cfd8dc; border-radius: 8px; 
    box-sizing: border-box; font-size: 16px; background: #f8fafc;
}

.important-box {
    background: #fdfaf2; border-left: 5px solid #ffca28; padding: 20px; border-radius: 8px; margin: 20px 0;
}

table { width: 100%; border-collapse: collapse; margin: 20px 0; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.05); table-layout: fixed; }
th, td { border-bottom: 1px solid #eee; padding: 15px; text-align: left; word-wrap: break-word; }
th { background: #f8fafc; font-weight: bold; color: #555; }

/* --- ギャラリーのはみ出しを完全に防ぐ修正 --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
    width: 100%;
    box-sizing: border-box;
}
.gallery-item {
    background: #fff; 
    border-radius: 8px; 
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
    border: 1px solid #eee;
    min-width: 0; /* 【重要】Grid要素が画像サイズに引っ張られて巨大化するのを防ぐ */
    width: 100%;
    box-sizing: border-box;
}
.gallery-item img {
    width: 100%;
    max-width: 100%; /* 親要素の幅を超えない */
    height: 140px; 
    object-fit: cover; 
    display: block;
}
.gallery-info {
    padding: 8px; text-align: center; font-size: 0.9em; color: #444; font-weight: bold; background: #fafafa;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; /* 名前が長すぎても省略する */
}

/* --- フッター（グレー背景・中央寄せ） --- */
.site-footer {
    background-color: #e0e0e0; /* 明確なグレーに指定 */
    text-align: center;
    padding: 30px 15px;
    width: 100%;
    box-sizing: border-box;
    margin-top: auto; /* 画面下部に押し付け */
    border-top: 1px solid #ccc;
}
.site-footer .provider {
    color: #555;
    font-size: 14px;
    margin: 0 0 5px 0;
    font-style: italic;
    letter-spacing: 1px;
}
.site-footer a {
    color: #777;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.3s;
}
.site-footer a:hover {
    color: var(--primary-color);
}

@media (max-width: 600px) {
    .wrapper { padding: 15px 10px; }
    .container { padding: 20px 15px; }
    .gallery-item img { height: 110px; }
}
