/* 統一フォント設定 - より強力な指定 */
html, body, *, *::before, *::after {
    font-family: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif !important;
}

/* 特定の要素にも個別指定 */
.navbar, .navbar-brand, .btn, .dropdown-menu, .dropdown-item, 
.form-control, .form-label, .card, .card-header, .card-body,
.badge, input, textarea, select, label, span, div, p, h1, h2, h3, h4, h5, h6 {
    font-family: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif !important;
}

.main-header,
.navbar {
    background: linear-gradient(90deg, #4e54c8 0%, #8f94fb 100%);
    color: #fff;
    padding: 0.5rem 0; /* パディングを元に戻す */
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(78, 84, 200, 0.10);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999; /* z-indexを最大値に設定 */
    border-bottom: 2px solid #e0eafc;
    min-height: 70px; /* 最小高さを小さくする */
    max-height: 120px; /* 最大高さを制限 */
}

.navbar-brand {
    margin-left: 0 !important;
    padding-left: 1.5rem; /* index.phpと統一 */
    font-size: 1.7rem; /* 他のページと統一 */
    font-weight: bold;
    letter-spacing: 0.07em; /* 他のページと統一 */
    color: #fff !important;
    text-shadow: 0 2px 6px rgba(78,84,200,0.18); /* index.phpと統一 */
    flex-shrink: 0; /* ブランドが縮まないようにする */
}

/* ヘッダーのボタン改善 */
.Admin_button {
    margin-bottom: 0;
    gap: 0.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    max-width: 70%;
    position: relative; /* ドロップダウン位置の基準点 */
    justify-content: flex-end; /* 右寄せで配置 */
}

/* ヘッダー内のドロップダウンを右端に固定 */
.Admin_button .dropdown {
    position: relative;
}

.Admin_button .btn {
    min-width: 85px;
    padding: 0.4rem 0.8rem;
    margin: 0.15rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    border: 2px solid transparent;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* ホバー時の統一エフェクト */
.Admin_button .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 0.7rem;
}

/* フォーカス時のアクセシビリティ改善 */
.Admin_button .btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(78, 84, 200, 0.3);
}

/* ヘッダーボタンの色設定 - 視認性を大幅改善 */
.Admin_button .btn-outline-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffcd39 100%);
    color: #212529;
    border-color: #ffc107;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.Admin_button .btn-outline-warning:hover {
    background: linear-gradient(135deg, #ffcd39 0%, #ffd60a 100%);
    color: #000;
    border-color: #ffcd39;
    transform: translateY(-2px) scale(1.05);
}

.Admin_button .btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0d6efd 100%);
    color: #fff;
    border-color: #007bff;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.Admin_button .btn-primary:hover {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: #fff;
    border-color: #0d6efd;
    transform: translateY(-2px) scale(1.05);
}

.Admin_button .btn-outline-success {
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
    color: #fff;
    border-color: #28a745;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.Admin_button .btn-outline-success:hover {
    background: linear-gradient(135deg, #34ce57 0%, #40d463 100%);
    color: #fff;
    border-color: #34ce57;
    transform: translateY(-2px) scale(1.05);
}

.Admin_button .btn-outline-info {
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
    color: #fff;
    border-color: #17a2b8;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.Admin_button .btn-outline-info:hover {
    background: linear-gradient(135deg, #20c997 0%, #6cc04a 100%);
    color: #fff;
    border-color: #20c997;
    transform: translateY(-2px) scale(1.05);
}

.Admin_button .btn-outline-light {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    border-color: #f8f9fa;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.Admin_button .btn-outline-light:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    color: #212529;
    border-color: #e9ecef;
    transform: translateY(-2px) scale(1.05);
}

body {
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    min-height: 100vh;
    color: #222;
    padding-top: 80px !important; /* 上部余白を大幅に縮小 */
    font-family: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
    margin-top: 0 !important;
    position: relative;
}

/* タブスタイル */
.nav-pills {
    margin-top: 5px !important; /* タブ上部余白を大幅に縮小 */
    padding-top: 5px !important;
    position: relative;
    z-index: 1; /* ヘッダーより下に配置 */
}

.nav-pills .nav-link {
    border-radius: 2rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
}

.nav-pills .nav-link:not(.active) {
    color: #6c757d;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.nav-pills .nav-link.active {
    background: linear-gradient(90deg, #4e54c8 0%, #8f94fb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(78, 84, 200, 0.3);
}

.nav-pills .nav-link:hover:not(.active) {
    background: #e9ecef;
    color: #4e54c8;
}

/* フォーム改善 */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

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

.form-control:focus {
    border-color: #4e54c8;
    box-shadow: 0 0 0 0.2rem rgba(78, 84, 200, 0.25);
}

/* 能力値セクション */
.ability-section {
    background: #f8f9fa;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border-left: 4px solid #4e54c8;
}

.ability-title {
    color: #4e54c8;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* 特技・シナリオアイテム */
.power-item,
.scenario-item,
.growth-history-item {
    background: #f8f9fa;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem !important; /* デフォルトの mb-3 (1.5rem) から縮小 */
    padding: 0.75rem !important; /* デフォルトの p-3 (1rem) から縮小 */
}

.power-item .row,
.scenario-item .row,
.growth-history-item .row {
    margin-bottom: 0.5rem; /* 行間の余白を縮小 */
}

.power-item .row:last-child,
.scenario-item .row:last-child,
.growth-history-item .row:last-child {
    margin-bottom: 0; /* 最後の行のマージンを削除 */
}

.power-item .col-md-3,
.power-item .col-md-6,
.power-item .col-md-12,
.scenario-item .col-md-3,
.scenario-item .col-md-6,
.scenario-item .col-md-8,
.growth-history-item .col-md-3,
.growth-history-item .col-md-8,
.growth-history-item .col-md-1 {
    padding-left: 0.5rem; /* 左パディングを縮小 */
    padding-right: 0.5rem; /* 右パディングを縮小 */
    margin-bottom: 0.5rem; /* 下マージンを縮小 */
}

.power-item:hover,
.scenario-item:hover,
.growth-history-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* フローティング保存ボタン */
.floating-save-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1050;
}

/* パワー・シナリオ・成長履歴のフォーム要素の余白調整 */
.power-item .form-label,
.scenario-item .form-label,
.growth-history-item .form-label {
    margin-bottom: 0.25rem; /* ラベルの下マージンを縮小 */
    font-size: 0.9rem; /* ラベルのフォントサイズを少し小さく */
}

.power-item .form-control,
.scenario-item .form-control,
.growth-history-item .form-control {
    margin-bottom: 0.25rem; /* 入力フィールドの下マージンを縮小 */
    padding: 0.375rem 0.5rem; /* 入力フィールドのパディングを調整 */
}

.power-item .form-check,
.scenario-item .form-check,
.growth-history-item .form-check {
    margin-bottom: 0.25rem; /* チェックボックスの下マージンを縮小 */
    padding-left: 1.25rem; /* チェックボックスのパディングを調整 */
}

.power-item .btn,
.scenario-item .btn,
.growth-history-item .btn {
    margin-top: 0.25rem; /* ボタンの上マージンを縮小 */
    padding: 0.25rem 0.5rem; /* ボタンのパディングを縮小 */
    font-size: 0.875rem; /* ボタンのフォントサイズを縮小 */
}

/* 成長点サマリーのスタイル調整 */
.growth-points-summary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.75rem; /* パディングを縮小 */
    margin-bottom: 0.75rem; /* マージンを縮小 */
}

.growth-points-summary .row {
    margin-bottom: 0.25rem; /* 行間を縮小 */
}

.growth-points-summary .row:last-child {
    margin-bottom: 0;
}

/* 成長履歴テーブルのスタイル */
#growth-histories-table {
    margin-bottom: 1rem;
}

#growth-histories-table th {
    background-color: #343a40 !important;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

#growth-histories-table td {
    padding: 0.5rem;
    vertical-align: middle;
}

#growth-histories-table .form-control-sm {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

#growth-histories-table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* パワーテーブルのスタイル */
#powers-table {
    margin-bottom: 1rem;
}

#powers-table th {
    background-color: #343a40 !important;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

#powers-table td {
    padding: 0.5rem;
    vertical-align: middle;
}

#powers-table .form-control-sm {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

#powers-table textarea.form-control-sm {
    min-height: 60px;
    resize: vertical;
}

/* シナリオテーブルのスタイル */
#scenarios-table {
    margin-bottom: 1rem;
}

#scenarios-table th {
    background-color: #343a40 !important;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

#scenarios-table td {
    padding: 0.5rem;
    vertical-align: middle;
}

#scenarios-table .form-control-sm {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

.floating-save-btn .btn {
    border-radius: 3rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* プレビューセクション */
.character-preview {
    background: #f8f9fa;
    border-radius: 1rem;
    padding: 2rem;
}

.preview-stat {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-value {
    color: #4e54c8;
}

/* 画像プレビュー */
.character-image {
    max-width: 250px;
    max-height: 250px;
    border-radius: 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    margin-bottom: 1rem;
    background: #f8f9fa;
    object-fit: cover;
}

.character-image-placeholder {
    border: 2px dashed #dee2e6;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.character-image-placeholder:hover {
    border-color: #4e54c8;
    background: #e0eafc;
}

/* レスポンシブ対応の改善 */
@media (max-width: 768px) {
    body {
        padding-top: 90px !important;
    }
    
    .container {
        margin-top: 15px !important;
        padding-top: 10px !important;
    }
    
    main {
        margin-top: 10px !important;
        padding-top: 5px !important;
    }
    
    .nav-pills {
        margin-top: 10px !important;
        padding-top: 5px !important;
    }
    
    .edit-card {
        padding: 1rem;
        margin-top: 10px !important;
        padding-top: 10px !important;
    }
    
    /* モバイル用ボタン改善 */
    .Admin_button {
        gap: 0.3rem;
        max-width: 90%;
        justify-content: center;
    }
    
    .Admin_button .btn {
        font-size: 0.7rem;
        min-width: 65px;
        padding: 0.3rem 0.6rem;
        margin: 0.1rem;
        border-radius: 0.4rem;
    }

    .character-image {
        max-width: 100%;
    }
    
    .floating-save-btn {
        bottom: 1rem;
        right: 1rem;
    }
    
    .floating-save-btn .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .nav-pills .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* モバイル用の小さなボタン */
    .btn-sm {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
        min-width: 55px;
    }
    
    /* 追加ボタンのモバイル調整 */
    #add-power,
    #add-scenario,
    #add-growth {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        letter-spacing: 0.3px;
    }
}

/* 小さなボタンの改善 */
.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 0.4rem;
    min-width: 70px;
    text-align: center;
}

.btn-sm:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* テーブル内の削除ボタン専用スタイル */
.remove-power,
.remove-scenario, 
.remove-growth {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
    color: #fff;
    border: 2px solid #dc3545;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.4rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 60px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.remove-power:hover,
.remove-scenario:hover,
.remove-growth:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-color: #e74c3c;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
    color: #fff;
}

/* 追加ボタンの統一スタイル */
#add-power,
#add-scenario,
#add-growth {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    border: 2px solid #28a745;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    border-radius: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#add-power:hover,
#add-scenario:hover,
#add-growth:hover {
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
    border-color: #20c997;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(32, 201, 151, 0.4);
    color: #fff;
}

/* 画像削除ボタン */
button[onclick="clearImagePreview();"] {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    color: #fff;
    border: 2px solid #dc3545;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

button[onclick="clearImagePreview();"]:hover {
    background: linear-gradient(135deg, #fd7e14 0%, #fd6c9e 100%);
    border-color: #fd7e14;
    box-shadow: 0 4px 16px rgba(253, 126, 20, 0.4);
    color: #fff;
}

/* フォームバリデーション */
.was-validated .form-control:invalid {
    border-color: #dc3545;
}

.was-validated .form-control:valid {
    border-color: #28a745;
}

/* ドロップダウンボタンとメニューの改善 */
.dropdown-toggle {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: #fff;
    border: 2px solid #6c757d;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dropdown-toggle:hover {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    color: #fff;
    border-color: #495057;
}

.dropdown-toggle:focus {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    color: #fff;
    border-color: #495057;
    box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.3);
}

/* ドロップダウンメニュー改善 - はみ出し防止 */
.dropdown-menu {
    border-radius: 0.5rem;
    border: 2px solid #dee2e6;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    min-width: 180px;
    max-width: 250px;
    /* はみ出し防止の設定 */
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    margin-top: 0.5rem;
}

/* Bootstrap の dropdown-menu-end クラスをさらに強化 */
.dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
}

/* Admin_buttonエリア内のドロップダウン特別対応 */
.Admin_button .dropdown-menu,
.Admin_button .dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    position: absolute !important;
    z-index: 9999 !important;
    margin-right: 0 !important;
    margin-left: auto !important;
}

/* ナビゲーションバー内でのドロップダウン位置調整 */
.navbar .dropdown-menu,
.navbar .dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
}

/* レスポンシブ対応でのドロップダウン位置調整 */
@media (max-width: 768px) {
    .dropdown-menu,
    .dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
        min-width: 160px;
        max-width: 200px;
        font-size: 0.9rem;
    }
    
    .Admin_button .dropdown-menu,
    .Admin_button .dropdown-menu-end {
        right: -5px !important;
        left: auto !important;
    }
}

@media (max-width: 576px) {
    .dropdown-menu,
    .dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
        min-width: 140px;
        max-width: 180px;
        font-size: 0.85rem;
    }
    
    .Admin_button .dropdown-menu,
    .Admin_button .dropdown-menu-end {
        right: -10px !important;
        left: auto !important;
    }
}

.dropdown-item {
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item:hover {
    background: linear-gradient(90deg, #4e54c8 0%, #8f94fb 100%);
    color: #fff;
}

/* アクセシビリティ改善 */
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none !important;
    box-shadow: none !important;
}

/* キーボードナビゲーション改善 */
.btn:focus-visible {
    outline: 3px solid #4e54c8;
    outline-offset: 2px;
}

/* ローディング状態のボタン */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: currentColor;
    animation: button-loading-spinner 1s ease infinite;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

/* フォーム内ボタンの改善 */
.btn {
    border-radius: 0.5rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(78, 84, 200, 0.3);
}

/* 成功ボタン（追加系） */
.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    border-color: #28a745;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
    color: #fff;
    border-color: #20c997;
    box-shadow: 0 4px 16px rgba(32, 201, 151, 0.4);
}

/* 危険ボタン（削除系） */
.btn-outline-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #fff;
    border-color: #dc3545;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-outline-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    color: #fff;
    border-color: #c82333;
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.4);
}

/* 警告ボタン（ロック解除など） */
.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: #212529;
    border-color: #ffc107;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #fd7e14 0%, #fd6c9e 100%);
    color: #fff;
    border-color: #fd7e14;
    box-shadow: 0 4px 16px rgba(253, 126, 20, 0.4);
}

/* 情報ボタン（閲覧モードなど） */
.btn-outline-info {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
    color: #fff;
    border-color: #17a2b8;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-outline-info:hover {
    background: linear-gradient(135deg, #6f42c1 0%, #6610f2 100%);
    color: #fff;
    border-color: #6f42c1;
    box-shadow: 0 4px 16px rgba(111, 66, 193, 0.4);
}

/* セカンダリボタン */
.btn-outline-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: #fff;
    border-color: #6c757d;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-outline-secondary:hover {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    color: #fff;
    border-color: #495057;
    box-shadow: 0 4px 16px rgba(108, 117, 125, 0.4);
}

.character-image {
    max-width: 220px;
    max-height: 220px;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    margin-bottom: 1rem;
    background: #f8f9fa;
}

.Admin_button {
    margin-bottom: 1rem;
}

/* 改善された能力値・技能フォーム */
.skill-item {
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0 !important;
    background: #fafafa !important;
}

.skill-item:hover {
    background: #f0f0f0 !important;
    border-color: #d0d0d0 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.skill-label,
.skill-equals,
.skill-percent {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    min-width: auto;
}

.skill-equals {
    color: #28a745;
    font-weight: bold;
}

.skill-percent {
    color: #007bff;
}

/* 能力値入力欄の強調 */
input[name="body"] {
    border-color: #2196f3 !important;
    box-shadow: 0 0 0 0.1rem rgba(33, 150, 243, 0.25) !important;
}

input[name="mental"] {
    border-color: #9c27b0 !important;
    box-shadow: 0 0 0 0.1rem rgba(156, 39, 176, 0.25) !important;
}

input[name="env"] {
    border-color: #4caf50 !important;
    box-shadow: 0 0 0 0.1rem rgba(76, 175, 80, 0.25) !important;
}

/* 技能レベル入力欄 */
input[name*="_s"]:not([name*="_total"]) {
    border: 2px solid #dee2e6;
    transition: all 0.2s ease;
}

input[name*="_s"]:not([name*="_total"]):focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.1rem rgba(0, 123, 255, 0.25);
}

/* 計算結果表示欄 */
input[name*="_total"] {
    background: #007bff !important;
    border: 2px solid #0056b3 !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 1.1rem !important;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .skill-item {
        margin-bottom: 0.5rem;
    }
    
    .skill-item .d-flex {
        flex-direction: column;
        gap: 0.25rem !important;
        align-items: stretch !important;
    }
    
    .skill-item input {
        width: 100% !important;
    }
    
    .skill-label,
    .skill-equals,
    .skill-percent {
        text-align: center;
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    .edit-card {
        padding: 1rem;
    }

    .character-image {
        max-width: 100%;
    }
    
    .col-lg {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* コンテナの追加余白設定 */
.container {
    margin-top: 10px !important; /* コンテナ上部余白を大幅に縮小 */
    padding-top: 5px !important;
}

/* メインコンテンツエリアの追加保護 */
main {
    margin-top: 5px !important; /* メイン上部余白を大幅に縮小 */
    padding-top: 5px !important;
}

/* エディットカード自体の上部余白 */
.edit-card {
    margin-top: 5px !important; /* エディットカード上部余白を大幅に縮小 */
    padding-top: 10px !important;
}

/* ゲストモードのバッジを小さくする */
.badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* レスポンシブでボタンテキストを調整 */
@media (max-width: 1200px) {
    .navbar-brand {
        font-size: 1.5rem;
    }
    
    .Admin_button .btn {
        font-size: 0.7rem;
        min-width: 70px;
        padding: 0.2rem 0.5rem;
    }
}

@media (max-width: 992px) {
    .navbar-brand {
        font-size: 1.3rem;
    }
    
    .Admin_button .btn {
        font-size: 0.65rem;
        min-width: 60px;
        padding: 0.15rem 0.4rem;
    }
}

@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.2rem;
        padding-left: 0.7rem;
    }
}

/* アニメーション効果の追加 */
.tab-pane {
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-pane.show.active {
    opacity: 1;
}

/* カードとフォーム要素の改善 */
.card {
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: none;
    overflow: hidden;
}

.card-header {
    border-radius: 1rem 1rem 0 0 !important;
    padding: 1.5rem;
    font-weight: 700;
}

.card-body {
    padding: 2rem;
}

/* ロック画面専用のスタイル追加 */
.form-control-lg:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.25);
}

/* ホバー効果の強化 */
.btn:hover {
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 最優先：ドロップダウンメニューのはみ出し完全防止 */
.dropdown-menu[data-bs-popper] {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    inset: auto 0px auto auto !important;
}

/* 全てのドロップダウンメニューを右寄せに強制 */
*[class*="dropdown"] .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    transform: translateX(0) !important;
    margin: 0.125rem 0 0 !important;
}

/* ヘッダー内のドロップダウンメニュー特別処理 */
header .dropdown-menu,
.navbar .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    position: absolute !important;
    top: 100% !important;
    margin-top: 0.25rem !important;
}

/* 超小型デバイス用の調整 */
@media (max-width: 480px) {
    .dropdown-menu {
        min-width: 120px !important;
        max-width: 160px !important;
        right: 0 !important;
        left: auto !important;
    }
}
