/* 基本レイアウト */
body {
    font-family: "Noto Sans JP", sans-serif;
    margin: 0;
    background-color: #f8f9fa;
    color: #333;
}
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 15px;
}
.margin-top-20 { margin-top: 20px; }
.margin-top-40 { margin-top: 40px; }
.text-center { text-align: center; }
.text-bold { font-weight: bold; }
.margin-y-10 { margin: 10px 0; }
.margin-y-20 { margin: 20px 0; }
.margin-top-50 { margin-top: 50px; }
.margin-bottom-25 { margin-bottom: 25px; }
.margin-bottom-10 { margin-bottom: 10px; }
.margin-left-10 { margin-left: 10px; }
.margin-top-15 { margin-top: 15px; }
.margin-20 { margin: 20px; }
.margin-0 { margin: 0; }
.width-100 { width: 100%; }
.width-80 { width: 80%; }
.max-width-100 { max-width: 100%; }
.max-height-80 { max-height: 80%; }
.font-size-24 { font-size: 24px; }
.display-none { display: none; }
.justify-content-between { justify-content: space-between; }
.align-items-start { align-items: flex-start; }
.flex-grow-1 { flex-grow: 1; }
.margin-left-auto { margin-left: auto; }
.margin-left-5 { margin-left: 5px; }
.color-muted { color: #666; }
.height-60 { height: 60px; }
.position-relative { position: relative; }
.gap-30 { gap: 30px; }
.grabbing { cursor: grabbing !important; }
.loading-state { opacity: 0.5; pointer-events: none; transition: opacity 0.2s; }

/* ヘッダー */
header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 20px;
}
header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.app-info .logo { height: 40px; }
.app-title { font-weight: bold; font-size: 1.2rem; }
.user-info {
    text-align: right;
    padding: 5px 15px;
    background: #f0f0f0;
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.user-info a { text-decoration: none; color: #333; }

/* カードコンテナ */
.card {
    background-color: #ffffff;
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.card hr { border: 0; border-top: 1px solid #eee; margin: 15px 0; }
.card h1, .card h2 { margin-top: 0; }
.card h2 { color: #666; font-size: 1.2rem; }

/* メッセージ表示 */
.success {
    color: #2e7d32;
    background-color: #e8f5e9;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c8e6c9;
}
.error {
    color: #d32f2f;
    background-color: #fdecea;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

/* フォーム要素 */
.form-group { margin-bottom: 15px; }
.form-row { margin-bottom: 20px; }
.form-flex { display: flex; gap: 20px; margin-bottom: 10px; }
.form-flex-inline { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.form-check-label { display: flex; align-items: center; font-weight: normal; cursor: pointer; }
.form-check-label input { width: auto; margin-right: 5px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group label.label-block-mt5 { display: block; margin-top: 5px; font-weight: normal; }
.form-help-text { font-size: 0.85em; color: #666; margin-top: 4px; }
.form-inline-group { display: flex; align-items: center; }
.form-group label.display-inline { display: inline-block; font-weight: normal; margin-left: 10px; }
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
}
.form-control-flex { flex: 1; min-width: 120px; }
.form-control-inline-auto { width: auto; display: inline-block; margin-right: 5px; }
.form-control-inline-auto { width: auto; display: inline-block; margin-right: 5px; }
.form-control:disabled { background-color: #f8f9fa; cursor: not-allowed; }
.hissu { color: red; font-weight: normal; font-size: 0.8rem; margin-left: 5px; }
.notice-box {
    margin: 20px 0;
    padding: 15px;
    background-color: #fff0f0;
    border: 1px solid #ffcccc;
    border-radius: 4px;
}
.notice-box label { color: #d9534f; font-weight: bold; }
textarea.form-control { resize: vertical; }

/* ボタンエリア */
.btn-area {
    display: flex;
    gap: 10px;
    margin-top: 40px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-area-left { display: flex; gap: 10px; justify-content: flex-start; margin-top: 0; }
.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    color: white;
    min-width: 120px;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.8; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-flex-max120 { flex: 1; max-width: 120px; }
.btn-inline { padding: 5px 10px; vertical-align: middle; display: inline-block; }

/* ボタン色バリエーション */
.btn-submit { background-color: #0056b3; }
.btn-normal { background-color: #6c757d; }
.btn-registration { background-color: #28a745; }
.btn-mainmenu { background-color: #4f97df; }
.btn-info { background-color: #17a2b8; }
.btn-danger, .btn-delete { background-color: #dc3545; }
.btn-passchange { color: #004494; background-color: #bbeaf0; }
.btn-passchange:hover { background-color: #a5dee6; }
.btn-clear { color: #0056b3; background-color: #d8aed2; }
.btn-clear:hover { opacity: 0.8; }
.btn-submit:hover { background-color: #004494; }
.btn-text { color: #0056b3; text-decoration: none; font-weight: bold; white-space: nowrap; }
.btn-text:hover { text-decoration: underline; }

/* 利用規約 (terms.php) */
.terms-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
}
.terms-text { white-space: pre-wrap; line-height: 1.6; }

/* バトルアイテム一覧 (bi_list.php) */
#battle-items-list {
    overflow-x: auto;
    padding: 0;
    list-style: none;
    -webkit-overflow-scrolling: touch;
    user-select: none;
    cursor: grab;
}
.item-list-header {
    display: flex;
    align-items: center;
    white-space: nowrap;
    padding: 10px 5px;
    background-color: #f2f2f2;
    border-bottom: 2px solid #ccc;
    min-width: max-content;
    position: sticky;
    top: 0;
    z-index: 10;
}
.item-list-row {
    display: flex;
    align-items: center;
    white-space: nowrap;
    padding: 5px 5px;
    border-bottom: 1px solid #eee;
    min-width: max-content;
    cursor: pointer;
    transition: background-color 0.1s;
}
.item-list-row:hover { background-color: #f9f9f9; }
.item-list-row.selected {
    background-color: #6fa7e3 !important;
    border-left: 5px solid #054f9f;
    padding-left: 0px !important;
}
.col-img { width: 45px; flex-shrink: 0; }
.col-img img { width: 32px; height: 32px; vertical-align: middle; }
.col-remaining { width: 80px; flex-shrink: 0; margin-right: 15px; font-weight: bold; }
.col-liver { width: 300px; flex-shrink: 0; margin-right: 15px; overflow: hidden; text-overflow: ellipsis; }
.col-expiry { width: 110px; flex-shrink: 0; margin-right: 15px; color: #666; font-size: 0.9em; }
.col-name { flex-grow: 1; min-width: 300px; }
.item-filter-label { cursor: pointer; display: inline-block; }
.item-filter-label img { vertical-align: middle; width: 32px; height: 32px; }

/* マイページ (index.php) */
.card.owned-battle-items { background-color: #fff8dc; }
.card.liver-menu { background-color: #ffe5e5; }
.ipselect-container {
    font-size: 18px;
    position: relative;
    display: flex;
    align-items: center;
    flex-grow: 1;
    border: 2px solid #1d6580;
    border-radius: 10px;
    background: linear-gradient(0deg, #d0ebf5, #ffffff);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    margin-right: 5px;
}
.ipselect-container select,
.cp_ipselect04 select {
    font-size: 18px; width: 100%; padding: 10px;
    color: #000; border: none; appearance: none;
    outline: none; background: transparent; cursor: pointer;
    text-overflow: ellipsis; z-index: 1; position: relative;
}
.item-flex-list {
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 10px 15px;
    min-height: 40px;
    margin: 0;
}
.item-flex-list li { font-size: 1.2em; display: inline; white-space: nowrap; }
.item-flex-list li img { vertical-align: middle; width: 30px; margin-right: 5px; }
.item-flex-list li.loading { font-size: 1rem; color: #666; }

/* カスタムセレクト (bi_register.php) */
.custom-select-container { position: relative; width: 100%; box-sizing: border-box; }
.custom-select-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    min-height: 48px;
    box-sizing: border-box;
    position: relative;
    transition: border-color 0.2s;
}
.custom-select-trigger:hover { border-color: #999; }
.custom-select-trigger img { width: 32px; height: 32px; object-fit: contain; }
.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 8px 8px;
}
.custom-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}
.custom-option:hover { background-color: #f0f7ff; }
.custom-option img { width: 32px; height: 32px; object-fit: contain; }
.custom-option .no-item-icon {
    width: 32px; height: 32px; background: #eee; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
}
.custom-option .no-item-icon .material-icons {
    font-size: 16px;
    color: #999;
}
.margin-top-5 { margin-top: 5px; }