/* ===== リセットと基本スタイル ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --gray-light: #ecf0f1;
    --gray: #95a5a6;
    --gray-dark: #7f8c8d;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

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

/* ===== ヘッダー ===== */
header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 20px 0;
}

.site-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 5px;
    font-weight: 700;
}

.site-subtitle {
    text-align: center;
    color: var(--gray-dark);
    font-size: 0.95rem;
}

.home-icon {
    font-size: 2rem;
    color: var(--secondary-color);
    text-decoration: none;
    display: inline-block;
    transition: color 0.3s;
}

.home-icon:hover {
    color: var(--primary-color);
}

.page-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    display: inline-block;
    margin-left: 20px;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-button {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-button:hover {
    background: var(--primary-color);
}

/* ===== メインビジュアル ===== */
.hero-section {
    margin: 30px 0;
}

.hero-image {
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== セクション ===== */
section {
    margin: 50px 0;
}

.section-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
}

/* ===== ジャンルグリッド ===== */
.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.genre-card {
    background: var(--white);
    padding: 40px 20px;
    text-align: center;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
    cursor: pointer;
}

.genre-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.genre-card i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.genre-card h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.genre-card-placeholder {
    opacity: 0.5;
    cursor: not-allowed;
}

.genre-card-placeholder:hover {
    transform: none;
}

/* ===== カスタム戦車アイコン ===== */
.tank-icon {
    width: 60px;
    height: 48px;
    margin: 0 auto 15px;
    position: relative;
}

.tank-turret {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 20px;
    background: var(--secondary-color);
    border-radius: 10px 10px 0 0;
}

.tank-turret::after {
    content: '';
    position: absolute;
    top: 8px;
    right: -15px;
    width: 18px;
    height: 4px;
    background: var(--secondary-color);
    border-radius: 0 2px 2px 0;
}

.tank-body {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 18px;
    background: var(--secondary-color);
    border-radius: 3px;
}

.tank-tracks {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 12px;
    background: var(--secondary-color);
    border-radius: 6px;
    border: 2px solid var(--secondary-color);
}

.tank-tracks::before,
.tank-tracks::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--white);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.tank-tracks::before {
    left: 8px;
}

.tank-tracks::after {
    right: 8px;
}

/* ===== 新着作品 ===== */
.new-works-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.new-work-item {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
}

.new-work-item:hover {
    box-shadow: var(--shadow-hover);
}

.new-work-item img {
    width: 150px;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
}

.new-work-info h3 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.new-badge {
    background: var(--accent-color);
    color: var(--white);
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-left: 10px;
    font-weight: bold;
}

/* ===== ギャラリーグリッド ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.gallery-item {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.gallery-item-info {
    padding: 20px;
}

.gallery-item-info h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.gallery-item-info p {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

.no-works {
    text-align: center;
    padding: 50px;
    color: var(--gray-dark);
}

/* ===== 作品詳細 ===== */
.work-detail {
    background: var(--white);
    margin: 30px auto;
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.work-header {
    text-align: center;
    margin-bottom: 30px;
}

.work-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.work-date {
    color: var(--gray-dark);
    font-size: 1rem;
}

.work-main-image {
    margin: 30px 0;
    border-radius: 10px;
    overflow: hidden;
}

.work-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

.work-description {
    margin: 40px 0;
}

.work-description h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.work-description p {
    line-height: 1.8;
    margin-bottom: 15px;
}

.work-detail-text {
    line-height: 1.9;
}

.work-detail-text p {
    margin-bottom: 1.4em;
    line-height: 1.9;
}

.additional-images-section {
    margin: 40px 0;
}

.additional-images-section h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.additional-image-item {
    margin-bottom: 40px;
}

.additional-image-item img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 15px;
}

.additional-image-item p {
    color: var(--gray-dark);
    line-height: 1.8;
}

/* ===== いいねボタン ===== */
.like-section {
    text-align: center;
    margin: 40px 0;
}

.like-button {
    background: var(--white);
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.like-button:hover {
    background: var(--accent-color);
    color: var(--white);
}

.like-button.liked {
    background: var(--accent-color);
    color: var(--white);
}

/* ===== コメントセクション ===== */
.comments-section {
    margin: 50px 0;
}

.comments-section h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.comment-form {
    margin-bottom: 40px;
}

.comment-form textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--gray-light);
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.submit-button {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 10px;
    transition: background 0.3s;
}

.submit-button:hover {
    background: var(--primary-color);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid var(--secondary-color);
}

.comment-text {
    line-height: 1.8;
    margin-bottom: 10px;
}

.comment-reply {
    background: var(--white);
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
    border-left: 4px solid var(--accent-color);
}

.comment-reply-label {
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 5px;
}

.comment-date {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

/* ===== SNSリンク ===== */
.links-section {
    text-align: center;
}

.social-links {
    margin-bottom: 20px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.social-link:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.social-link i {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.link-message {
    color: var(--gray-dark);
    margin-top: 20px;
}

.link-message i {
    color: var(--secondary-color);
    margin-right: 5px;
}

/* ===== ページトップボタン ===== */
.page-top {
    text-align: center;
    margin: 40px 0;
}

.scroll-top-button {
    background: var(--gray);
    color: var(--white);
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.scroll-top-button:hover {
    background: var(--gray-dark);
}

/* ===== フッター ===== */
footer {
    background: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
}

footer p {
    margin-bottom: 10px;
}

.admin-link a {
    color: var(--gray-light);
    text-decoration: none;
    font-size: 0.9rem;
}

.admin-link a:hover {
    color: var(--white);
}

/* ===== 管理画面 - ログイン ===== */
.login-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-box input {
    padding: 15px;
    border: 1px solid var(--gray-light);
    border-radius: 5px;
    font-size: 1rem;
}

.login-box button {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 15px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.login-box button:hover {
    background: var(--primary-color);
}

.error-message {
    color: var(--accent-color);
    text-align: center;
    font-size: 0.9rem;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--secondary-color);
    text-decoration: none;
}

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

/* ===== 管理画面 - メイン ===== */
.admin-section header {
    background: var(--primary-color);
    color: var(--white);
}

.admin-section h1 {
    color: var(--white);
    display: inline-block;
}

.admin-header-buttons {
    float: right;
    display: flex;
    gap: 10px;
}

.button {
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: all 0.3s;
}

.button-primary {
    background: var(--secondary-color);
    color: var(--white);
}

.button-primary:hover {
    background: #2980b9;
}

.button-secondary {
    background: var(--gray);
    color: var(--white);
}

.button-secondary:hover {
    background: var(--gray-dark);
}

.button-danger {
    background: var(--accent-color);
    color: var(--white);
}

.button-danger:hover {
    background: #c0392b;
}

/* ===== タブ ===== */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin: 30px 0;
    border-bottom: 2px solid var(--gray-light);
}

.tab-button {
    background: none;
    border: none;
    padding: 15px 30px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--gray-dark);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--secondary-color);
    font-weight: bold;
}

.tab-content {
    display: none;
    padding: 30px 0;
}

.tab-content.active {
    display: block;
}

/* ===== 管理画面ツールバー ===== */
.admin-toolbar {
    margin-bottom: 30px;
}

/* ===== 作品リスト（管理画面） ===== */
.works-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.work-item {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.work-item:hover {
    box-shadow: var(--shadow-hover);
}

.work-item img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
}

.work-item-info {
    flex: 1;
}

.work-item-info h3 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.work-item-info p {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

.work-item-badge {
    background: var(--accent-color);
    color: var(--white);
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-left: 10px;
}

/* ===== モーダル ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: 10px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray);
}

.modal-close:hover {
    color: var(--primary-color);
}

/* ===== フォーム ===== */
form {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-weight: 500;
}

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

.form-group textarea {
    resize: vertical;
}

.form-group small {
    display: block;
    color: var(--gray-dark);
    font-size: 0.85rem;
    margin-top: 5px;
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    border-top: 1px solid var(--gray-light);
}

/* ===== コメント管理 ===== */
.admin-comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-comment-item {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.admin-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.admin-comment-work {
    color: var(--secondary-color);
    font-weight: bold;
}

.admin-comment-text {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.admin-comment-reply-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-light);
    border-radius: 5px;
    font-family: inherit;
    margin-bottom: 10px;
    resize: vertical;
}

.admin-comment-actions {
    display: flex;
    gap: 10px;
}

/* ===== レスポンシブデザイン ===== */

/* タブレット */
@media (max-width: 768px) {
    .site-title {
        font-size: 1.4rem;
    }
    
    .genre-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .gallery-item img {
        height: 200px;
    }
    
    .new-work-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .new-work-item img {
        width: 100%;
        height: 200px;
    }
    
    .work-detail {
        padding: 30px 20px;
    }
    
    .admin-header-buttons {
        float: none;
        margin-top: 15px;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* スマートフォン */
@media (max-width: 480px) {
    .site-title {
        font-size: 1.2rem;
    }
    
    .site-subtitle {
        font-size: 0.8rem;
    }
    
    .genre-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .work-title {
        font-size: 1.5rem;
    }
    
    .work-detail {
        padding: 20px 15px;
    }
    
    .admin-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        padding: 10px 20px;
    }
    
    .modal-content {
        margin: 20px;
    }
}

/* iPad対応の最適化 */
@media (min-width: 768px) and (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .genre-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* JSON生成ツールモーダル */
#jsonGeneratorModal .modal-content {
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#jsonGeneratorModal .modal-body {
    overflow-y: auto;
    padding: 20px;
}

#jsonImageInputs {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}
