/* 城ドラ ティア表メーカー - スタイル（モダンテーマ統合版）
   style-modern.css のテーマ変数（var(--color-*)）を使用してダーク/ライト両対応 */

.tier-container {
    max-width: 100%;
    margin: 20px 0;
}

/* テーマ一覧（カード） */
.tier-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.tier-theme-card {
    border: 1px solid #3a4055;
    border-radius: var(--radius);
    padding: 18px 14px;
    background: var(--color-surface);
    text-align: center;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--color-text);
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.03);
}

.tier-theme-card:hover {
    background: var(--color-surface-2);
    border-color: var(--color-accent);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,184,77,0.25);
    transform: translateY(-2px);
    color: var(--color-text);
}

[data-theme="light"] .tier-theme-card {
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
[data-theme="light"] .tier-theme-card:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.10), 0 0 0 1px rgba(217,119,6,0.25);
}

.tier-theme-card .icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.tier-theme-card .name {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-accent);
    margin-bottom: 5px;
}

.tier-theme-card .desc {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ティア表編集画面 */
.tier-editor {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: linear-gradient(135deg, #1a1c25, #14161e);
    color: #fff;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: var(--shadow-card);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.tier-row {
    display: flex;
    border-bottom: 1px solid #2a2e3f;
    min-height: 80px;
}

.tier-row:last-child {
    border-bottom: none;
}

.tier-label {
    flex: 0 0 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 900;
    color: #1a1a1a;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
    font-family: 'Inter', sans-serif;
}

.tier-label-S { background: linear-gradient(135deg, #ff7f7f, #ff5757); }
.tier-label-A { background: linear-gradient(135deg, #ffbf7f, #ff9947); }
.tier-label-B { background: linear-gradient(135deg, #ffdf7f, #ffc247); }
.tier-label-C { background: linear-gradient(135deg, #ffff7f, #f5e547); }
.tier-label-D { background: linear-gradient(135deg, #bfff7f, #8af547); }
.tier-label-P { background: linear-gradient(135deg, #888, #555); color: #fff; text-shadow: none; font-size: 18px; flex-direction: column; line-height: 1.1; gap: 2px; }
.tier-label-P .tier-label-P-icon { font-size: 22px; }
.tier-label-P .tier-label-P-text { font-size: 11px; font-weight: 700; }
.tier-row-pending { border-top: 2px dashed #444; background: rgba(0,0,0,0.25); }
.tier-rank-btn-P { background: #888; color: #fff; text-shadow: none; }

.tier-slot {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    padding: 8px;
    min-height: 80px;
    gap: 5px;
    background: rgba(255,255,255,0.02);
}

.tier-slot.sortable-ghost {
    background: rgba(255,184,77,0.15);
}

/* キャラプール */
.tier-pool {
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-top: 20px;
    min-height: 100px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.tier-pool-title {
    color: var(--color-text-muted);
    font-size: 13px;
    margin-bottom: 10px;
    font-weight: 600;
}

.tier-pool-chars {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 70px;
}

.tier-pool-cost-group {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--color-border);
}

.tier-pool-cost-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* 未配置キャラが0体のコストグループは非表示（戻せば自動的に再表示） */
.tier-pool-cost-group:has(.tier-pool-chars:empty) {
    display: none;
}

.tier-pool-cost-label {
    color: var(--color-accent);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    padding-left: 4px;
    letter-spacing: 0.05em;
}

/* キャラアイコン */
.tier-char {
    width: 60px;
    height: 60px;
    cursor: grab;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: border-color 0.1s, transform 0.1s;
    background: #fff;
    display: block;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.tier-char:hover {
    transform: scale(1.05);
    border-color: var(--color-accent);
}

.tier-char:active {
    cursor: grabbing;
}

.tier-char img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    display: block;
}

.tier-char.sortable-chosen {
    border-color: var(--color-accent);
}

.tier-char.sortable-drag {
    opacity: 0.7;
}

/* 保存フォーム */
.tier-save-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
}

.tier-save-form label {
    display: block;
    margin: 10px 0 5px;
    font-weight: 700;
    font-size: 13px;
    color: var(--color-text);
}

.tier-save-form input[type="text"],
.tier-save-form input[type="url"],
.tier-save-form textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}

.tier-save-form input[type="text"]:focus,
.tier-save-form input[type="url"]:focus,
.tier-save-form textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* 親テーマ simplicity2 の generic button{} と兄弟 <a> の高さズレを防ぐため、
   margin / padding / line-height などを明示的に上書き */
.tier-btn {
    display: inline-block;
    background: var(--gradient-accent);
    color: #1a1a1a;
    border: 1px solid transparent; /* secondary が 1px border 持つので primary も同じ高さに */
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
    text-decoration: none;
    box-sizing: border-box;
    vertical-align: middle;
    margin: 10px 5px 0 0; /* 親テーマの margin-bottom:20px を打ち消す */
    font-family: inherit;
    transition: transform 0.1s, box-shadow 0.15s;
}
/* 親テーマの button{} 系セレクタを <button class="tier-btn"> に対しても確実に無効化 */
button.tier-btn,
input[type="button"].tier-btn,
input[type="submit"].tier-btn {
    padding: 10px 20px;
    margin: 10px 5px 0 0;
    line-height: 1.2;
    border: 1px solid transparent;
}
button.tier-btn.tier-btn-secondary {
    border: 1px solid var(--color-border);
}

.tier-btn:hover {
    color: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,184,77,0.3);
}

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

.tier-btn-secondary {
    background: var(--color-surface-2);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.tier-btn-secondary:hover {
    background: var(--color-surface-3);
    color: var(--color-text);
    box-shadow: var(--shadow-card);
}

.tier-btn-danger {
    background: rgba(220,53,69,0.15);
    border: 1px solid rgba(220,53,69,0.5);
    color: #ff5d6c;
}

.tier-btn-danger:hover {
    background: rgba(220,53,69,0.25);
    color: #ff5d6c;
}

/* カード内「上位:」プレビューキャラ icon */
.tier-preview-icon {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-2, var(--color-surface));
    object-fit: contain;
}

/* === 保存アクションの視覚階層 === */
/* 主操作グループ: 公開する + 下書き保存 */
.tier-save-actions { margin-top: 20px; }
.tier-save-actions-primary {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0;
}
/* 公開ボタンを大きく目立たせる */
.tier-btn.tier-btn-large,
button.tier-btn.tier-btn-large {
    padding: 14px 28px;
    font-size: 16px;
    box-shadow: 0 4px 14px rgba(255,184,77,0.3);
}
.tier-btn.tier-btn-large:hover,
button.tier-btn.tier-btn-large:hover {
    box-shadow: 0 6px 20px rgba(255,184,77,0.45);
}

/* 補助操作: テキストリンク風 */
.tier-save-actions-tertiary {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.tier-link-action,
button.tier-link-action,
a.tier-link-action {
    background: transparent !important;
    color: var(--color-text-muted) !important;
    border: none !important;
    padding: 4px 0 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-decoration: underline !important;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.tier-link-action:hover,
button.tier-link-action:hover,
a.tier-link-action:hover {
    color: var(--color-text) !important;
    background: transparent !important;
    transform: none !important;
}

/* 危険操作: 区切って右端に */
.tier-save-actions-danger {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed rgba(220,53,69,0.4);
    text-align: right;
}
.tier-btn-danger-small,
button.tier-btn-danger-small {
    background: transparent !important;
    color: #d33 !important;
    border: 1px solid #d33 !important;
    padding: 6px 14px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    margin: 0 !important;
    box-shadow: none !important;
}
.tier-btn-danger-small:hover,
button.tier-btn-danger-small:hover {
    background: rgba(221,51,51,0.1) !important;
}

/* 一覧（ティア表カード） */
.tier-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

/* カードはダークモードで輪郭が背景に溶けやすいため、
   - ボーダーをやや明るく
   - 控えめな drop shadow で「浮いてる感」を出す
   ライトモードは [data-theme="light"] で控えめに上書き */
.tier-list-card {
    border: 1px solid #3a4055;
    border-radius: var(--radius);
    padding: 0 0 16px;
    background: var(--color-surface);
    text-decoration: none;
    color: var(--color-text);
    display: block;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.03);
    transition: all 0.2s;
}

.tier-list-card:hover {
    color: var(--color-text);
    border-color: var(--color-accent);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,184,77,0.25);
    transform: translateY(-2px);
}

[data-theme="light"] .tier-list-card {
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
[data-theme="light"] .tier-list-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 6px 18px rgba(0,0,0,0.10), 0 0 0 1px rgba(217,119,6,0.25);
}

/* ===== カード共通パーツ（lib/card.php とペア） ===== */
/* テーマ名を主役にするヘッダーバー */
.tier-card-theme-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(217,119,6,0.18), rgba(217,119,6,0.06));
    border-bottom: 1px solid rgba(217,119,6,0.35);
    position: relative;
}
.tier-card-theme-bar::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--color-accent);
}
.tier-card-theme-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--color-accent);
    color: #fff;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.tier-card-theme-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.3;
    letter-spacing: 0.02em;
}
.tier-card-body { padding: 12px 14px 0; }
.tier-card-author {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 500;
}
.tier-card-date {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}
.tier-card-excerpt {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

/* トップ5キャラ */
.tier-card-top5 {
    display: flex;
    gap: 6px;
    margin: 10px 0 4px;
    flex-wrap: wrap;
}
.tier-card-top5-item {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0,0,0,0.25);
}
.tier-card-top5-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tier-card-top5-rank {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 0 0 6px 0;
    color: #1a1a1a;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
    z-index: 1;
}
.tier-rank-S { background: linear-gradient(135deg, #ff7f7f, #ff5757); }
.tier-rank-A { background: linear-gradient(135deg, #ffbf7f, #ff9947); }
.tier-rank-B { background: linear-gradient(135deg, #ffdf7f, #ffc247); }
.tier-rank-C { background: linear-gradient(135deg, #ffff7f, #f5e547); }
.tier-rank-D { background: linear-gradient(135deg, #bfff7f, #8af547); }

/* 旧クラス（互換目的・新カードでは未使用） */
.tier-list-card .title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 6px;
    color: var(--color-text);
}

.tier-list-card .meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.tier-list-card .creator {
    color: var(--color-accent);
}

.tier-list-card .stats {
    margin-top: 10px;
    font-size: 12px;
    color: var(--color-text-subtle);
}

.tier-list-card .stats span {
    margin-right: 12px;
}

/* ティア表詳細 */
.tier-detail-meta {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-top: 18px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: var(--color-text);
}

.tier-detail-meta a {
    color: var(--color-primary);
    text-decoration: none;
}

.tier-detail-meta a:hover {
    text-decoration: underline;
}

.tier-detail-meta .creator {
    color: var(--color-accent);
    font-weight: 700;
}

.tier-actions {
    margin: 15px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
/* gap で間隔を取るので、内部の margin-right はリセット */
.tier-actions .tier-btn,
.tier-actions .tier-like-btn {
    margin-right: 0;
}

/* いいねボタン
   ダークモード基準で見やすい鮮やかな赤を採用、ライトモードは [data-theme="light"] で上書き。
   親テーマ style-modern.css の `body.gt-modern .article button {background: gradient-accent}` が
   特異性で勝ってしまうため、要素+クラスで特異性を上げる + !important で確実に上書き */
.tier-like-btn,
button.tier-like-btn {
    display: inline-block;
    background: var(--color-surface) !important;
    border: 1.5px solid #ff5d6c !important;
    color: #ff5d6c !important;
    padding: 10px 20px;
    border-radius: 20px; /* pill 形状 */
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
    box-sizing: border-box;
    vertical-align: middle;
    margin: 10px 5px 0 0;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tier-like-btn:hover,
button.tier-like-btn:hover {
    background: rgba(255,93,108,0.12) !important;
}

.tier-like-btn.liked,
button.tier-like-btn.liked {
    background: #ff4458 !important;
    color: #fff !important;
    border-color: #ff4458 !important;
    box-shadow: 0 0 0 3px rgba(255,68,88,0.18);
}
.tier-like-btn.liked:hover,
button.tier-like-btn.liked:hover {
    background: #e63548 !important;
    border-color: #e63548 !important;
}

.tier-like-btn:disabled,
button.tier-like-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ライトモード（落ち着いた赤に上書き） */
[data-theme="light"] .tier-like-btn,
[data-theme="light"] button.tier-like-btn {
    border-color: #d33 !important;
    color: #d33 !important;
}
[data-theme="light"] .tier-like-btn:hover,
[data-theme="light"] button.tier-like-btn:hover {
    background: rgba(221,51,51,0.08) !important;
}
[data-theme="light"] .tier-like-btn.liked,
[data-theme="light"] button.tier-like-btn.liked {
    background: #d33 !important;
    border-color: #d33 !important;
    box-shadow: 0 0 0 3px rgba(221,51,51,0.18);
}
[data-theme="light"] .tier-like-btn.liked:hover,
[data-theme="light"] button.tier-like-btn.liked:hover {
    background: #b22 !important;
    border-color: #b22 !important;
}

/* コメント */
.tier-comments {
    margin-top: 30px;
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
}

.tier-comments h3 {
    margin: 0 0 15px;
    font-size: 18px;
    color: var(--color-text);
}

.tier-comment {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 0 8px 8px 0;
}

.tier-comment .name {
    font-weight: 700;
    font-size: 13px;
    color: var(--color-accent);
}

.tier-comment .date {
    font-size: 11px;
    color: var(--color-text-subtle);
    margin-left: 10px;
}

.tier-comment .body {
    margin-top: 5px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
}

.tier-comment-form textarea,
.tier-comment-form input[type="text"] {
    padding: 9px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    color: var(--color-text);
    font-family: inherit;
}

.tier-comment-form textarea {
    width: 100%;
    min-height: 80px;
}

.tier-comment-form textarea:focus,
.tier-comment-form input[type="text"]:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* ソート/ページング */
.tier-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.tier-sort-tabs a {
    display: inline-block;
    padding: 6px 14px;
    margin-right: 5px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    text-decoration: none;
    color: var(--color-text);
    font-size: 13px;
    background: var(--color-surface);
    transition: all 0.15s;
}

.tier-sort-tabs a:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.tier-sort-tabs a.active {
    background: var(--gradient-accent);
    color: #1a1a1a;
    border-color: transparent;
    font-weight: 700;
}

/* 作成者コメント */
.tier-creator-comment {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin: 15px 0;
}
.tier-creator-comment-label {
    font-size: 12px;
    color: var(--color-accent);
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.03em;
}
.tier-creator-comment-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--color-text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* SNSシェアボタン */
.tier-share {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.tier-share-btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    transition: opacity 0.15s, transform 0.1s;
}

.tier-share-btn:hover {
    opacity: 0.9;
    color: #fff;
    transform: translateY(-1px);
}

.tier-share-tw { background: #000; }
.tier-share-line { background: #06c755; }
.tier-share-fb { background: #1877f2; }
/* URL コピーボタン
   <button> 要素なので親テーマの button{} ルールで padding/border-radius が上書きされる。
   他のシェア <a> リンクと完全に揃うよう .tier-share-btn の値を !important で再適用。 */
button.tier-share-copy,
.tier-share-copy {
    display: inline-block;
    background: #6b7280 !important;
    color: #fff !important;
    border: none !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    cursor: pointer;
    font-family: inherit;
    box-shadow: none !important;
}
button.tier-share-copy:hover,
.tier-share-copy:hover {
    background: #4b5563 !important;
    transform: translateY(-1px);
}

/* YouTube埋め込み */
.tier-video-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 720px;
    margin: 10px 0;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.tier-video-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}

/* タップ → ランク選択ピッカー */
#tier-rank-picker {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    visibility: hidden;
}

#tier-rank-picker.open {
    visibility: visible;
    pointer-events: auto;
}

.tier-rank-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.2s;
}

#tier-rank-picker.open .tier-rank-picker-backdrop {
    opacity: 1;
}

.tier-rank-picker-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 16px 16px 0 0;
    padding: 18px;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid var(--color-border);
    border-bottom: none;
}

#tier-rank-picker.open .tier-rank-picker-sheet {
    transform: translateY(0);
}

.tier-rank-picker-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.tier-rank-picker-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: var(--color-surface-2);
    border-radius: 8px;
}

.tier-rank-picker-name {
    flex: 1;
    font-weight: 700;
    font-size: 15px;
    color: var(--color-text);
}

.tier-rank-picker-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0 8px;
    color: var(--color-text-muted);
}

.tier-rank-picker-close:hover {
    color: var(--color-text);
}

.tier-rank-picker-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.tier-rank-btn {
    padding: 18px 0;
    border: none;
    border-radius: 10px;
    font-size: 24px;
    font-weight: 900;
    color: #1a1a1a;
    cursor: pointer;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.6);
    transition: transform 0.1s;
    font-family: 'Inter', sans-serif;
}

.tier-rank-btn:active {
    transform: scale(0.95);
}

.tier-rank-btn-S { background: linear-gradient(135deg, #ff7f7f, #ff5757); }
.tier-rank-btn-A { background: linear-gradient(135deg, #ffbf7f, #ff9947); }
.tier-rank-btn-B { background: linear-gradient(135deg, #ffdf7f, #ffc247); }
.tier-rank-btn-C { background: linear-gradient(135deg, #ffff7f, #f5e547); }
.tier-rank-btn-D { background: linear-gradient(135deg, #bfff7f, #8af547); }

.tier-rank-pool-btn {
    width: 100%;
    padding: 12px;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.tier-rank-pool-btn:hover {
    background: var(--color-surface-3);
}

/* 投稿モード選択モーダル */
.tier-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
}

.tier-modal.open {
    display: block;
}

.tier-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.65);
}

.tier-modal-sheet {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 24px;
    width: calc(100% - 32px);
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.tier-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--color-text-muted);
    line-height: 1;
    padding: 4px 10px;
}

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

.tier-mode-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    background: var(--color-surface-2);
    border: 2px solid var(--color-border);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.15s;
    color: var(--color-text);
}

.tier-mode-card:hover {
    background: var(--color-surface-3);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-card);
}

.tier-mode-card.selected {
    background: rgba(74,222,128,0.08);
    border-color: var(--color-success);
}

.tier-mode-card-icon {
    font-size: 36px;
    flex: 0 0 auto;
}

.tier-mode-card-body {
    flex: 1;
}

.tier-mode-card-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--color-text);
}

.tier-mode-card-desc {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ご意見・ご要望 フローティングボタン */
.tier-feedback-fab {
    position: fixed;
    bottom: 20px;
    left: 16px;
    z-index: 95;
    background: var(--gradient-accent);
    color: #1a1a1a;
    border: none;
    border-radius: 28px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
.tier-feedback-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}
.tier-feedback-fab-icon { font-size: 16px; line-height: 1; }
.tier-feedback-fab-label { letter-spacing: 0.02em; }

@media (max-width: 600px) {
    .tier-feedback-fab {
        bottom: 16px;
        left: 12px;
        padding: 9px 14px;
        font-size: 13px;
    }
}

/* 通知バナー（テーマ対応） */
.tier-banner {
    padding: 14px 16px;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.7;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}
.tier-banner code {
    background: var(--color-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
}
.tier-banner-info {
    background: linear-gradient(135deg, rgba(91,141,239,0.10), rgba(91,141,239,0.04));
    border-color: rgba(91,141,239,0.35);
}
.tier-banner-warn {
    background: linear-gradient(135deg, rgba(255,184,77,0.12), rgba(255,184,77,0.04));
    border-color: rgba(255,184,77,0.45);
}
.tier-banner-warn-strong {
    background: linear-gradient(135deg, rgba(255,184,77,0.16), rgba(255,184,77,0.05));
    border: 2px dashed rgba(255,184,77,0.55);
    text-align: center;
    font-weight: 700;
}
.tier-banner-error {
    background: linear-gradient(135deg, rgba(220,53,69,0.12), rgba(220,53,69,0.04));
    border-color: rgba(220,53,69,0.45);
}
.tier-banner-muted {
    background: var(--color-surface);
    color: var(--color-text-muted);
    text-align: center;
}
.tier-banner small {
    color: var(--color-text-muted);
    font-size: 12px;
}

/* レスポンシブ（スマホ） */
@media (max-width: 575px) {
    .tier-label {
        flex: 0 0 45px;
        font-size: 24px;
    }
    .tier-char {
        width: 48px;
        height: 48px;
    }
    .tier-theme-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
    .tier-theme-card {
        padding: 12px 8px;
    }
    .tier-theme-card .icon {
        width: 60px;
        height: 60px;
    }
}

/* =========================================================
 * 共通トースト window.tierToast()
 *   実体は shirodora-tier/js/tier-id-modal.js が body に append する単一 <div>
 *   見た目だけここに集約
 * ========================================================= */
.tier-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    z-index: 11000;
    font-size: 13px;
    max-width: 90vw;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}
.tier-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =========================================================
 * オーナー操作バナー（list.php）
 *   sticky でスクロール時も画面上部に追従。
 *   サイトヘッダーが top:0 / z-index:100 なので、その下に重ねる（top:64px / z-index:50）
 *   ※ 既存の .charset-action-bar / .action-bar と同じパターンで揃えてある
 * ========================================================= */
.tier-owner-actions-sticky {
    position: sticky;
    top: 64px;
    z-index: 50;
    margin-top: 10px;
    /* スクロール時、下のコンテンツとの境界を強調 */
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    /* 半透明背景に blur — 既存 sticky 要素と同じ仕上がり */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
[data-theme="light"] .tier-owner-actions-sticky {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
}
