.main-wrapper{ box-sizing: border-box; }

.navigation-path { margin-bottom: 4px; font-weight: 500; font-size: 13px; display: flex; align-items: center; gap: 4px; }

.header-container{  padding: 0 0px; 
}

.upload-btn{ background: var(--border-red); color: #fff; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; padding: 8px 14px; font-size: 13px; text-decoration: none; white-space: nowrap; }

.upload-btn:hover{ background: rgba(255, 255, 255, 0.2); }

.inline-filters{ display: flex; gap: 16px; align-items: center; }

@media screen and (max-width: 640px) { .inline-filters{ padding-left: 8px ; }
}

.filter-item{ color: rgba(255,255,255,0.7); font-size: 14px; cursor: pointer; user-select: none; }

.filter-item.active{ color: #fff; font-weight: 700; }

.post-form { width: calc(100% - 320px); min-height: 290px; margin-right: 320px; margin: 0 0 32px 0; padding: 20px; box-sizing: border-box; background: var(--card-background); border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); border: 1px solid rgba(255, 255, 255, 0.5); }

.post-form form { display: flex; flex-direction: column; gap: 1rem; }

.post-form h2 { font-size: 16px; font-weight: 600; color: rgb(255, 255, 255, 0.9); margin : 0 0 30px 0; }

.tacticUrl, .tacticTitle, .tacticAuthor, .tacticComment { display: grid; grid-template-columns: 80px 1fr; gap: 0.5rem; align-items: center; }

.tacticUrl p, .tacticTitle p, .tacticAuthor p, .tacticComment p { color: rgb(255, 255, 255, 0.8); font-size: 14px; font-weight: 400; padding: 0px; margin: 0px; }

.post-form input { padding: 10px 20px 10px 20px; 
    background: rgba(255, 255, 255, 0.05); border-radius: 4px; font-size: 14px; }

.submit-container { display: flex; justify-content: flex-end; align-items: center; padding : 0 20px; }

.submit-container button { width: fit-content; color: rgb(255, 255, 255); cursor: pointer; z-index: 2; position: relative; white-space: nowrap; background: rgba(255, 255, 255, 0.1); border-width: 1px; border-style: solid; border-color: rgb(102, 102, 102); border-image: initial; padding: 8px 20px; border-radius: 8px; transition: 0.2s; }

.submit-text { font-size: 12px; color: rgb(255, 255, 255, 0.3); padding:0; margin-right: 10px; }


.submit-container button:hover { background: rgb(255, 255, 255, 0.3); }

/* Ranking */

.ranking-container { top: 0; right: 0; width: 300px; height: 100%; min-height: 280px; box-sizing: border-box; background: var(--card-background); border-radius: 8px; padding: 20px; margin : 0px; border-bottom: 3px solid var(--border-red); }

@media screen and (max-width: 1200px) { .ranking-container{ min-height: 0; }
}

/* 캐릭터 필터 카드 (랭킹과 통일) */
.character-filter-card{ width: 100%; max-width: 820px; box-sizing: border-box; background: var(--card-background); border-radius: 8px; padding: 20px; margin: 0px; border-bottom: 3px solid var(--border-red); }

.character-filter-card .card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
}

.character-filter-card .card-header h2 { margin: 0; font-size: 16px; color: rgb(255 255 255 / 90%); }

.character-grid {
    --character-grid-size: 50px;
    --character-grid-gap: 6px;
    --character-grid-padding-start: 16px;
    --character-grid-padding-end: 4px;
    --character-grid-padding-inline: 4px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--character-grid-size));
    gap: var(--character-grid-gap);
    max-height: 200px;
    overflow: auto;
    padding-block: var(--character-grid-padding-start) var(--character-grid-padding-end);
    padding-inline: var(--character-grid-padding-inline);
}

.char-face {
    box-sizing: border-box;
    width: var(--character-grid-size);
    height: var(--character-grid-size);
    object-fit: cover;
    background: rgb(0 0 0 / 20%);
    cursor: pointer;
}

.ranking-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

.ranking-title-icon { display: none; }

.ranking-title-text{ font-size: 16px; color: rgba(255,255,255,0.9); margin: 0; }

.ranking-tabs { display: flex; gap: 8px; }

.ranking-tab { flex: 1; padding: 4px 8px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 4px; color: rgba(255, 255, 255, 0.8); cursor: pointer; font-size: 13px; }

.ranking-tab.active { background: rgba(255, 255, 255, 0.2); color: white; }

.ranking-list { display: flex; flex-direction: column; gap: 8px; }

.ranking-item { display: flex; align-items: center; padding: 8px 12px; background: rgba(0, 0, 0, 0.5); border-radius: 4px; }

.rank-icon { height: 32px; margin-right: 0px; object-fit: contain; }


.ranking-position { display: flex; align-items: center; width: 32px; font-weight: 600; color: rgba(255, 255, 255, 0.9); }


.ranking-info { flex: 1; margin-left: 32px; }

.ranking-author { font-size: 14px; color: rgba(255, 255, 255, 0.9); margin-bottom: 4px; }

.ranking-stats { font-size: 12px; color: rgba(255, 255, 255, 0.6); }

/* 1-3위 특별 스타일 */
/*
.ranking-item[data-rank="1"] { background: linear-gradient(45deg, #FFD700, #FFA500); }
.ranking-item[data-rank="2"] { background: linear-gradient(45deg, #C0C0C0, #A9A9A9); }
.ranking-item[data-rank="3"] { background: linear-gradient(45deg, #CD7F32, #8B4513); }
*/


/* 검색 및 탭 search & tabs */

.search-section { position: relative; display: flex; align-items: center; width: 100%; }

.view-tabs{ display: flex; flex-direction: row; gap: 10px; width : fit-content; }

.tab-button { width: fit-content; min-width: 70px; background-image: none; background-color: rgb(0, 0, 0, 0.3); border-radius: 40px; border: 1px solid rgb(255, 255, 255, 0.1); padding: 8px 16px; cursor: pointer;

    font-size: 13px; line-height: 13px; font-weight: 400; color: rgb(255, 255, 255, 0.8); }

.tab-button.active { background-image: none; background-color: rgb(255, 255, 255, 0.1); color: rgb(255, 255, 255, 1); }



/* 공유된 택틱들 tactic list */

.posts-container { margin-top: 1rem; /* padding: 0 20px; */
}

.posts-list { display: flex; flex-direction: column; gap: 1rem; }

.post-item { display: grid; grid-template-columns: 1fr 1fr 80px; padding: 16px 20px; background: var(--card-background); border: 1px solid rgb(255, 255, 255, 0.1); border-radius: 8px; }

.post-header{ display: flex; flex-direction: column; justify-content: center; transform: translateY(-2px); }


.post-item h3 { margin: 0 0 8px 0; color: rgb(255, 255, 255, 0.9); }


.post-item p { margin: 0.5rem 0; color: #ffffff; }

/* 제목 링크에 대한 스타일을 더 구체적으로 지정 */
.post-item a.post-title { text-decoration: none; cursor: pointer; }

.post-item a.post-title:hover { text-decoration: none; color: rgb(255, 255, 255, 0.9); }

.post-title { cursor: pointer; font-size: 18px; display: flex; align-items: center; gap: 4px; color: var(--text-color); text-decoration: none; transition: color 0.2s; min-width: 0; }

/* 제목 텍스트는 최대 2줄로 표시하고 넘치면 말줄임 */
.post-title-text{ display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; max-width: 100%; min-width: 0; flex: 1 1 auto; }

.type-badge{ display: inline-block; background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9); border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 2px 6px; font-size: 11px; margin-right: 6px; min-width: 19.8px; white-space: nowrap; flex-shrink: 0; }

.region-badge{ display: inline-block; background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9); border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 2px 6px; font-size: 11px; margin-right: 0px; min-width: 14px; white-space: nowrap; flex-shrink: 0; }

.post-title:hover { color: var(--accent-color); }

.post-title svg { fill: rgb(255, 255, 255, 0.8); }

.post-title svg:not(.section-row-arrow) { transition: transform 0.3s; }

.post-title:hover svg:not(.section-row-arrow) { transform: translateX(4px); }

.post-title svg path { transition: fill 0.2s; }

.post-title:hover svg path { fill: var(--accent-color); }

.post-comment { margin: 10px 0 0 0; padding: 8px 0px; /*background: rgba(255, 255, 255, 0.05); border-radius: 4px;*/
    font-size: 12px; color: rgba(255, 255, 255, 0.7); line-height: 1.4; max-width: 600px; user-select: text; -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; cursor: text; }

.post-meta{ display: flex; flex-direction: row; align-items: center; height: 24px; gap: 8px; }

.post-author{ color: rgb(255, 255, 255, 0.9); font-size: 14px; font-weight: 400; }

.separator { height: 24px; color: rgb(255, 255, 255, 0.3); font-size: 12px; line-height: 24px; font-weight: 400; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; }

.post-date{ color: rgb(255, 255, 255, 0.5); font-size: 14px; font-weight: 400; }

.post-link{ display: none; }


.post-content{ margin-left:auto; margin-right:20px; }

/* 택틱 공유 페이지 이미지 스타일 */
.party-images-container {gap: 10px; margin-bottom: 0px;}
.party-images {gap: 6px; }
.weapon-img {height: 80px;}
.persona-images {gap : 0px;}
.character-img {width : 80px; height : 80px;}
.ritual-img {bottom: 5px;}

.post-footer{ display: flex; flex-direction: column; align-items: center; justify-content: center; }

.likes-section{ display: flex; flex-direction: column; align-items: center; justify-content: center; }

.likes-count-wrapper{ display: flex; align-items: center; justify-content: center; }

.like-button { width : 60px; height : 60px; object-fit: contain; padding: 0; border: none; cursor: pointer; transition: all 0.2s; background: none; }

.like-button img{ width : 100%; height : 100%; }

.like-button.liked{ filter: brightness(0.5); }

.pagination { margin-top: 2rem; display: flex; justify-content: center; gap: 1rem; align-items: center; margin-bottom: 2rem; }

.pagination button { font-size: 12px; padding: 0.5rem 1rem; background: #720f0f; color: white; border: none; border-radius: 24px; cursor: pointer; }

.pagination button:disabled { color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.05); cursor: not-allowed; }

.tactic-pagination[hidden] { display: none; }

.tactic-pagination,
.tactic-page-numbers {
    gap: 6px;
}

.tactic-page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tactic-pagination button {
    min-width: 34px;
    min-height: 40px;
    padding: 4px 8px;
    background: #262626;
    border: 1px solid #4a4a4a;
    font-variant-numeric: tabular-nums;
}

.tactic-pagination button:hover:not(:disabled) { background: #393939; }
.tactic-pagination button[aria-current="page"] { background: #720f0f; border-color: #d56767; font-weight: 700; }
.tactic-pagination button:focus-visible { outline: 2px solid #ff9ea8; outline-offset: 2px; }
.tactic-page-gap { min-width: 12px; text-align: center; color: #bdbdbd; }

@media (max-width: 540px) {
    .tactic-pagination { display: grid; grid-template-columns: 1fr 1fr; }
    .tactic-page-numbers { grid-area: 1 / 1 / 2 / -1; gap: 4px; }
    .tactic-pagination button { min-height: 44px; }
}

#currentPage{ font-size: 13px; color: rgb(255, 255, 255, 0.8); }

small { color: #6c757d; display: block; margin-top: 0.5rem; }

.post-item.best, .tab-button[data-view="best"]{ position: relative; background: #20140f; border: 0.5px solid rgb(196, 255, 255, 0.5); background-clip: padding-box; }



@keyframes gradient { 0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}




@media screen and (max-width: 1120px) {
    .character-filter-card{ width: 100%; }
    .post-form{ width: 100%; margin-bottom: 0; }

    .ranking-container{ width: 100%; }

    .post-item { display: grid; grid-template-areas: 
    "header footer"
    "content content"; grid-template-columns: 1fr auto; gap: 16px; }

    .post-header { grid-area: header; }

    .post-footer { grid-area: footer; }

    .post-content { grid-area: content; margin: 0; }
}


@media screen and (max-width: 640px) {


    .navigation-path, .header-container, .posts-container{ padding: 0px; }

    .header-container{ width: fit-content; margin-bottom: 1rem; }
    
    .tacticUrl, .tacticTitle, .tacticAuthor, .tacticComment { grid-template-columns: 60px 1fr; }
    .tacticUrl p, .tacticTitle p, .tacticAuthor p, .tacticComment p { font-size: 13px; }

    .submit-text{ font-size: 10px; }

    .submit-container{ display: flex; flex-direction: column; padding: 0; }

    .view-tabs{ margin-left: 0; }

    .posts-container{ margin-top: 1rem; }

    .like-button { width: 40px; height: 40px; }

    .post-title{ font-size: 14px; }
    .post-author, .post-date{ font-size: 12px; }

    .party-images{ gap: 12px; margin-left : -12px; }

    .character-container{ width: 60px; height: 60px; }

    .character-img{ width: 100%; height: 100%; }

    .ritual-img{ width: 30px; height: 30px; bottom: 0; }
    
    .likes-count{ font-size: 12px; }
    
    .post-comment { box-sizing: border-box; font-size: 11px; padding: 6px 0px; margin-top: 6px; max-width: 230px; /* 텍스트 줄바꿈 */
    word-break: break-all; }

}


.user-info-bar { display: flex; align-items: center; gap: 12px; margin: 8px 0px 16px 0px; padding: 10px 14px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 8px; }
.user-info-bar .user-label { color: rgba(255, 255, 255, 0.85); }

.logout-btn:hover { background: rgba(255, 255, 255, 0.1); }
.logout-btn { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.35); padding: 6px 12px; border-radius: 6px; cursor: pointer; }

/* ==========================================================================
   Tactic Upload Page Styles
   ========================================================================== */

/* Login required message */
.login-required {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.login-message {
    text-align: center;
    padding: 40px;
    background: var(--card-background);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 400px;
}

.login-message h3 {
    margin: 0 0 12px 0;
    color: #fff;
    font-size: 1.25rem;
}

.login-message p {
    margin: 0 0 24px 0;
    color: rgba(255, 255, 255, 0.7);
}

.login-btn {
    background: #d11f1f;
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: #ff3b3b;
}

/* Upload container */
.upload-container {
    max-width: 700px;
}

.tactic-upload-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Form sections */
.form-section {
    background: var(--card-background);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #d11f1f, #ff6b6b);
    border-radius: 12px 12px 0 0;
}

.form-section h3 {
    margin: 0 0 20px 0;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
}

/* Form groups */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #d11f1f;
    box-shadow: 0 0 0 3px rgba(209, 31, 31, 0.2);
}

.form-group input[type="file"] {
    padding: 10px;
    cursor: pointer;
}

.form-group input[type="file"]::file-selector-button {
    background: #d11f1f;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    font-size: 13px;
}

.form-group input[type="file"]::file-selector-button:hover {
    background: #ff3b3b;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Data loaded indicator */
.data-loaded-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    color: #4CAF50;
    font-size: 14px;
}

/* JSON preview */
.json-preview {
    margin-top: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.json-preview h4 {
    margin: 0 0 12px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
}

.btn-submit {
    background: #d11f1f;
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-submit:hover {
    background: #ff3b3b;
}

.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Success modal */
.success-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.success-modal-content {
    background: #1f1f1f;
    border-radius: 12px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.success-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4CAF50, #81C784);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0 0 16px 0;
    color: #fff;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-body p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 16px 0;
}

.modal-body a {
    color: #64B5F6;
    word-break: break-all;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 18, 18, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    z-index: 1001;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #d11f1f;
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 640px) {
    .form-section {
        padding: 20px 16px;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-submit,
    .btn-cancel {
        width: 100%;
        text-align: center;
    }
}


/* Library cards and controls */
:is(.ranking-container, .character-filter-card).section-card-cut {
    background: transparent;
    border-bottom: 0;
    border-radius: 0;
}

:is(.ranking-container, .character-filter-card).section-card-cut :is(.ranking-header, .card-header) {
    padding-bottom: 10px;
    background: var(--section-divider-paint);
    background-position-y: bottom, bottom, bottom 1px;
}


.tactic-library-results .post-item.best {
    background: #20140f;
}

.tactic-library-results .posts-list {
    position: relative;
}

.tactic-library-results .posts-list::before {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0 0 auto;
    height: 2px;
    background: #d56767;
    opacity: 0;
    pointer-events: none;
}

.tactic-library-results .posts-list[aria-busy="true"]::before {
    opacity: 1;
}

.tactic-library-page .char-face-wrap,
.tactic-library-page .filter-item {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.tactic-library-page .char-face-wrap { position: relative; }
#characterFilterGrid .char-face-wrap img.char-face {
    display: block;
    border-radius: 50%;
}
.tactic-library-page .filter-item { font-size: 14px; }
.tactic-library-page .filter-item.active { font-weight: 700; }

.tactic-library-page :is(button, a):focus-visible {
    outline: 2px solid #ff9ea8;
    outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
    .tactic-library-page :is(.tab-button, .ranking-tab):hover {
        border-color: #a35c63;
    }

    .tactic-library-page .filter-item:hover { color: #fff; }
}

.tactic-library-page .filter-item:focus-visible { color: #fff; }
@media (prefers-reduced-motion: no-preference) {
    .tactic-library-results .posts-list::before {
        transition: opacity 130ms ease;
    }

    .tactic-library-results .posts-list[aria-busy="true"]::before {
        transition-delay: 160ms;
    }

    #characterFilterGrid .char-face-wrap img.char-face {
        transition: border-radius 180ms ease, scale 140ms ease;
    }

    #characterFilterGrid .char-face-wrap:focus-visible img.char-face {
        border-radius: 32%;
    }

    @media (hover: hover) and (pointer: fine) {
        #characterFilterGrid .char-face-wrap:hover img.char-face {
            border-radius: 32%;
        }
    }

    .tactic-library-page :is(.tab-button, .ranking-tab, .filter-item, .tactic-pagination button, .upload-btn, .like-button) {
        transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, filter 150ms ease, scale 120ms ease;
    }

    .tactic-library-page :is(.tab-button, .ranking-tab, .filter-item, .tactic-pagination button, .upload-btn):active:not(:disabled),
    .tactic-library-page .char-face-wrap:active .char-face {
        scale: .96;
    }

}

@media (prefers-reduced-motion: reduce) {
    #characterFilterGrid .char-face-wrap img.char-face,
    .tactic-library-results :is(.like-button, .post-title, .post-title svg, .post-title svg path, .tactic-preview .character-img) {
        transition: none;
    }
}

.tactic-library-results :is(.type-badge, .region-badge, .pagination button),
:is(.ranking-container, .character-filter-card).section-card-cut :is(.ranking-tab, .ranking-item) {
    border-radius: 0;
}


.tactic-mobile-filter-button { display: none; }

.tactic-filter-dialog {
    box-sizing: border-box;
    width: min(100% - 32px, 480px);
    max-height: calc(100dvh - 32px);
    overflow: hidden;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 22%);
    border-bottom: 3px solid var(--border-red);
    background: var(--card-background);
    color: #fff;
}

.tactic-filter-dialog[open] {
    display: flex;
    flex-direction: column;
}

.tactic-filter-dialog::backdrop { background: rgb(0 0 0 / 74%); }

.tactic-filter-dialog .character-filter-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 16px 16px 0;
}

.tactic-filter-dialog .character-filter-card::after { content: none; }

.tactic-filter-dialog .spoiler-toggle-label { min-height: 44px; }

.tactic-filter-dialog .character-grid {
    max-height: none;
    overscroll-behavior: contain;
    padding: 12px 4px 8px;
    justify-content: space-between;
}

.tactic-filter-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px 16px;
}

.tactic-filter-footer button,
.tactic-mobile-filter-button {
    min-height: 44px;
    border: 1px solid rgb(255 255 255 / 22%);
    border-radius: 0;
    background: rgb(255 255 255 / 6%);
    color: #fff;
    padding: 7px 12px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.tactic-filter-footer button { min-width: 76px; }
.tactic-filter-footer button:hover,
.tactic-mobile-filter-button:hover { background: rgb(255 255 255 / 12%); }
.tactic-mobile-filter-button.has-selection { border-color: #c28585; }

.tactic-mobile-filter-count {
    min-width: 20px;
    padding: 0 4px;
    text-align: center;
    background: #613439;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* Tactic Library */
.tactic-library-page {
    --library-line: rgb(255 255 255 / 12%);
    --library-muted: rgb(255 255 255 / 67%);
    --library-accent: #e19a9a;
}

.tactic-library-page .tactic-library-header {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0 0 16px;
}

.tactic-library-header .header-title {
    width: 100%;
}

.tactic-library-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 8px;
}

.tactic-library-title-row h1 {
    margin: 0;
    line-height: 1.25;
    font-size: clamp(22px, 7vw, 28px);
    overflow-wrap: anywhere;
}

.tactic-library-upload {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 0;
    border-color: #a2565b;
    background: #80161d;
}

.tactic-library-upload:hover { background: #99232a; }

.tactic-library-category-row > .tactic-library-upload { display: none; }

.tactic-library-header .page-description {
    margin: 4px 0 0;
    max-width: 70ch;
    color: var(--library-muted);
}

.tactic-library-banner .nitro-ad-slot-frame {
    overflow: hidden;
}

.tactic-library-banner .nitro-ad-slot-frame:has([data-nitro-placement-sized]) {
    padding-top: 16px;
}

.tactic-library-banner .nitro-ad-slot {
    max-width: 728px;
}

.tactic-library-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.tactic-library-feed,
.tactic-library-sidebar { min-width: 0; }

.tactic-library-sidebar {
    display: grid;
    gap: 16px;
}

.tactic-library-toolbar,
.tactic-library-search-row {
    display: grid;
    gap: 8px;
}

.tactic-library-search-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.tactic-library-search-row .search-section { min-width: 0; }

.tactic-library-toolbar #searchInput {
    min-height: 44px;
    border-color: var(--library-line);
}

.tactic-library-toolbar #searchInput:focus { border-color: #c28585; }

.tactic-library-toolbar #regionButtons {
    box-sizing: border-box;
    display: grid;
    width: 100%;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--library-line);
    background: #191919;
}

.tactic-library-toolbar #regionButtons .tab-button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    color: var(--library-muted);
    padding: 2px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.tactic-library-toolbar #regionButtons .tab-button + .tab-button {
    border-inline-start: 1px solid var(--library-line);
}

.tactic-library-toolbar #regionButtons .tab-button.active {
    color: #fff;
    background: #34282a;
    box-shadow: inset 0 -2px var(--library-accent);
    font-weight: 600;
}

.tactic-library-toolbar #typeButtons {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 0;
}

.tactic-library-toolbar .filter-item {
    min-width: 0;
    min-height: 44px;
    padding: 3px 0;
    font-size: 13px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.tactic-library-toolbar .filter-item.active {
    color: #fff;
    box-shadow: inset 0 -2px var(--library-accent);
}

.tactic-library-results {
    margin: 8px 0 0;
    padding: 0;
}

.tactic-library-results .posts-list { gap: 8px; }

.tactic-library-empty {
    margin: 0;
    padding: 20px 12px;
    border-top: 1px solid var(--library-line);
    color: var(--library-muted);
    font-size: 14px;
}

.tactic-library-empty:empty { padding: 0; border: 0; }

.tactic-library-sidebar :is(.ranking-container, .character-filter-card) {
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 12px;
    border: 1px solid var(--library-line);
    border-radius: 0;
}

.tactic-library-sidebar .ranking-header {
    flex-wrap: wrap;
    gap: 0 8px;
    margin: 0;
    border-bottom: 1px solid var(--library-line);
}

.tactic-library-sidebar .ranking-tabs { gap: 2px; }

.tactic-library-sidebar .ranking-tab {
    min-height: 44px;
    padding: 0 5px;
    border: 0;
    background: transparent;
    border-radius: 0;
    white-space: nowrap;
}

.tactic-library-sidebar .ranking-tab.active {
    box-shadow: inset 0 -2px var(--library-accent);
    color: #fff;
    font-weight: 600;
}

.tactic-library-sidebar .ranking-list { gap: 0; }

.tactic-library-sidebar .ranking-item {
    box-sizing: border-box;
    gap: 8px;
    min-height: 36px;
    padding: 5px 0;
    border-radius: 0;
    background: transparent;
}

.tactic-library-sidebar .ranking-item + .ranking-item {
    border-top: 1px solid var(--library-line);
}

.tactic-library-sidebar .ranking-position { flex: 0 0 24px; }
.tactic-library-sidebar .rank-icon { width: 24px; height: 24px; }

.tactic-library-sidebar .ranking-info {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    min-width: 0;
    margin: 0;
}

.tactic-library-sidebar .ranking-author {
    flex: 1 1 90px;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tactic-library-sidebar .ranking-stats { color: var(--library-muted); }

.tactic-library-sidebar .card-header,
.tactic-filter-dialog .card-header {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--library-line);
}

.tactic-filter-dialog .character-filter-card {
    border: 0;
    background: transparent;
}

.tactic-library-page #userDisplayName {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tactic-library-page .user-info-bar :is(.user-label, .logout-btn) {
    flex-shrink: 0;
}

@media (max-width: 360px) {
    .tactic-library-upload { padding-inline: 9px; }
}

@media (width > 1100px) {
    .tactic-library-page .tactic-library-header:has([data-nitro-placement-sized]) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 728px;
        align-items: center;
        gap: 16px;
    }

    .tactic-library-title-row > .tactic-library-upload { display: none; }

    .tactic-library-banner .nitro-ad-slot-frame:has([data-nitro-placement-sized]) {
        padding-top: 0;
    }

    .tactic-library-category-row {
        display: grid;
        grid-template-columns: minmax(0, 460px) auto;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        grid-column: 1 / -1;
    }

    .tactic-library-category-row > .tactic-library-upload { display: inline-flex; }
}

@media (width < 960px) {
    .tactic-mobile-filter-button {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
    }

    .tactic-library-sidebar > .character-filter-card { display: none; }
}

@media (min-width: 960px) {
    .tactic-library-layout { grid-template-columns: minmax(0, 1fr) clamp(235px, 24vw, 300px); }
    .tactic-library-search-row { grid-template-columns: minmax(0, 1fr); }
    .tactic-library-sidebar .character-filter-card { container-type: inline-size; }

    .tactic-library-sidebar .character-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        scrollbar-width: thin;
        /* Four columns across eight rows, including the grid padding and gaps. */
        max-height: calc(
            200cqi - 4 * var(--character-grid-padding-inline) + var(--character-grid-gap)
            + var(--character-grid-padding-start) + var(--character-grid-padding-end)
        );
    }

    .tactic-library-sidebar .char-face {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }
}

@media (min-width: 1280px) {
    .tactic-library-toolbar { grid-template-columns: minmax(0, 1fr) minmax(220px, .85fr); }
}
