html {
    --link-base: blue;
    --link-visited: #66f;
    --color1: darkgreen;
    --color2: red;
    --color3: #202020;
    --color4: brown;
    --color5: darkred;
    --color-gold: #fe6;
    --color-silver: #eef;
    --color-bronze: #eb5;
    --color-text: #000;
    --color-bg: #fff;
    --color-selected-bg: #fff;
    --color-selected-text: #000;
    font-size: 0.875rem;
    &.darkm {
        --link-base: #f64;
        --link-visited: orange;
        --color1: lime;
        --color2: skyblue;
        --color3: #cfcfcf;
        --color4: orange;
        --color5: pink;
        --color-gold: #60560b;
        --color-silver: #445;
        --color-bronze: #643;
        --color-text: #eee;
        --color-bg: #19191d;
        --color-selected-bg: #000;
        --color-selected-text: #fff;
    }
    color: var(--color-text);
}
#content-wrapper {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    padding-top: 30px;
    padding-bottom: 60px;
    font-family: sans-serif;
}
#content-wrapper > * {
    padding: 0 30px;
}
body {
    background-image: url('assets/TamaBackground.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: rgba(255, 255, 255, 0.4); 
    transition: background-color 0.3s ease;
}
.darkm body::before {
    background-color: rgba(0, 0, 0, 0.6); 
}
nav {
    padding-top: 5px;
    padding-bottom: 5px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: space-between;
    align-items: flex-start;
}
nav > div:first-child {
    margin-right: auto;
}

nav > div:last-child > div {
    display: inline-block;
    padding: 0 5px;
}
sv-row {
    display: flex;
    flex-wrap: wrap;
    padding: 1px 0;
    row-gap: 3px;
    column-gap: 5px;
}
@media (min-width: 768px) {
    sv-row {
        row-gap: 3px;
        column-gap: 8px;
    }
}
@media (min-width: 1268px) {
    sv-row {
        row-gap: 3px;
        column-gap: 15px;
    }
}
sv-item {
    display: block;
    cursor: pointer;
    min-width: 60px;
    text-align: center;
    color: var(--color-text);
    &:hover {
        color: #3a3;
    }
    &:active {
        color: #a33;
    }
    &[selected] {
        color: inherit;
    }
    input {
        width: 0;
        height: 0;
    }
}.flex-break {
    flex-basis: 100%;
    height: 0;
}
sv-row.hidden {
    display: none;
}
.hidden {
    display: none !important;
}
sv-item:hover {
background-color: #f0f0f0;
color: rgb(26, 6, 99);
border-radius: 6px;
}
.darkm sv-item:hover {
background-color: #1b0031;
color: #f0f0f0;
}

sv-item[selected] {
background-color: #000000;
color: white;
font-weight: bold;
border-radius: 6px;
}
.darkm sv-item[selected] {
background-color: #000000;
color: white;
}

sv-item input[type="radio"] {
display: none;
}

sv-item label {
cursor: pointer;
display: block;
}

#error, .error { color: red; }
h2 {
    flex-wrap: nowrap;
    padding: 0;
    margin: 100;
    text-align: center;
}
h3 {
    flex-wrap: nowrap;
    padding: 0;
    margin: 0;
    text-align: center;
}
h4 {
    flex-wrap: nowrap;
    font-size: 21px;
    padding: 0;
    margin: 0;
    text-align: left;
}
#api-content { display: none; }
section { border: None solid; padding: 0 0px 10px 0px; margin: 20px 0px; }
#content {
    display: flex;
    justify-content: space-between;
    gap: 5px;
}
#content section:nth-of-type(1) {
    flex: 3 1 30%;
    border: None solid;
    padding: 0 1px 10px 1px;
    margin: 20px 0px;
}
#content section:nth-of-type(2) {
    flex: 3 1 30%;
    border: None solid;
    padding: 0 1px 10px 1px;
    margin: 20px 0px;
}
#content section:nth-of-type(3) {
    flex: 2 1 20%;
    border: None solid;
    padding: 0 1px 10px 1px;
    margin: 20px 0px;
}
#content section:nth-of-type(4) {
    flex: 2 1 20%;
    border: None solid;
    padding: 0 1px 10px 1px;
    margin: 20px 0px;
}
#open-content-table {
    width: auto;
    margin-left: auto;
    margin-right: auto;
    border-collapse: collapse;
    width: 90%;
    max-width: 400px;
    min-width: 300px;
    background-color: var(--color-bg);
    color: var(--color-text);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#open-content-table th, #open-content-table td {
    border: 1px solid var(--color3);
    padding: 10px;
    white-space: normal;
}

#open-content-table td {
    text-align: left !important;
}

#open-content-table ul {
    list-style: none;
    padding-left: 0;
}

#open-content-table li {
    padding-left: 0;
    text-align: left;
}

#open-content-table strong {
    display: block;
    margin-bottom: -20px;
}
sub-section { display: block; border: #444 1px solid; padding: 20px 20px 10px 20px; margin: 20px 0px; }
label, .label-like {
    &:first-child, label-field-container & {
        width: 140px;
        min-width: 140px;
        display: inline-block;
        margin: 0 5px;
        vertical-align: top;
    }
}
label-field-container { width: 350px; min-width: 350px; display: inline-block; margin: 0 5px; vertical-align: top; }
control-field { display: flex; margin-top: 15px; align-items: start; }
.container, .inactive-page .inactive-message {
    display: flex;
    margin-bottom: 30px;
    &>div {
        margin: 0 20px;
        h3 { text-align: center; flex-wrap: nowrap;}
    }
}
.inactive-page .container, .inactive-message { display: none; }
table, td, th { text-align: center; border-collapse: collapse; border: 1px solid var(--color-text); }
tr {
    height: 32px;
    color: var(--color-text);
    background: #e8e8e8;
    .darkm & {
        background: #303030;
    }
}
.color1 { color: var(--color1); }
.color2 { color: var(--color2); }
.color3 { color: var(--color3); }
.color4 { color: var(--color4); }
.color5 { color: var(--color5); }
#auth-form-container { text-align: left; padding-left: 30px; }
#auth-form { display: flex; flex-direction: row; align-items: center; margin-top: 50px; justify-content: flex-start; }
#auth-form label { margin-right: 10px; }
#auth-form input[type="password"] { padding: 5px; font-size: 0.8rem; width: 250px; margin-right: 10px; }
#auth-form button { padding: 5px 10px; font-size: 0.8rem; cursor: pointer; }
#auth-form p { margin-top: 10px; margin-left: 0; text-align: left; }
#user-info-section {
    border: #444 1px solid;
    padding: 0 20px 10px 20px;
    margin: 20px 0px;
    display: none;
}
#user-info-section h2 {
    margin-bottom: 10px;
}
#user-info-section p {
    margin-bottom: 5px;
}
#user-info-section label {
    display: inline-block;
    width: 100px;
    font-weight: bold;
}
#user-info-section span {
    margin-left: 10px;
}
#refresh-user-info {
    margin-top: 15px;
    padding: 8px 15px;
    cursor: pointer;
}

.guild-name {
    display: block;
    font-size: clamp(5px, 3vw, 10px);
    opacity: 0.8;
    margin-top: 0.1px;
}
.player-name-header {
    white-space: nowrap; 
    font-size: clamp(10px, 3vw, 15px);
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.player-name-content {
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    font-size: clamp(8px, 2vw, 13px); 
    width: 100%; 
    position: relative;
}
.player-quest-content {
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    font-size: clamp(8px, 2vw, 13px); 
    width: 100%; 
}
.rank-header {
    white-space: nowrap; 
    font-size: clamp(10px, 3vw, 15px);
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.progress-header {
    white-space: nowrap; 
    font-size: clamp(10px, 3vw, 15px);
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.loading-spinner {
    border: 4px solid var(--color3);
    border-top: 4px solid var(--link-base);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
#bp-ranking-table,
#rank-ranking-table,
#quest-ranking-table,
#tower-ranking-table,
#battle-league-ranking-table,
#legend-league-ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#bp-ranking-table th,
#bp-ranking-table td,
#rank-ranking-table th,
#rank-ranking-table td,
#quest-ranking-table th,
#quest-ranking-table td,
#tower-ranking-table th,
#tower-ranking-table td,
#battle-league-ranking-table th,
#battle-league-ranking-table td,
#legend-league-ranking-table th,
#legend-league-ranking-table td {
    border: 1px solid var(--color-text);
    padding: 5px;
}

#bp-ranking-table th:first-child,
#bp-ranking-table td:first-child,
#rank-ranking-table th:first-child,
#rank-ranking-table td:first-child,
#quest-ranking-table th:first-child,
#quest-ranking-table td:first-child,
#tower-ranking-table th:first-child,
#tower-ranking-table td:first-child,
#battle-league-ranking-table th:first-child,
#battle-league-ranking-table td:first-child,
#legend-league-ranking-table th:first-child,
#legend-league-ranking-table td:first-child {
    width: 20%;
}
#bp-ranking-table th:nth-child(2),
#bp-ranking-table td:nth-child(2),
#rank-ranking-table th:nth-child(2),
#rank-ranking-table td:nth-child(2),
#quest-ranking-table th:nth-child(2),
#quest-ranking-table td:nth-child(2),
#tower-ranking-table th:nth-child(2),
#tower-ranking-table td:nth-child(2),
#battle-league-ranking-table th:nth-child(2),
#battle-league-ranking-table td:nth-child(2),
#legend-league-ranking-table th:nth-child(2),
#legend-league-ranking-table td:nth-child(2) {
    flex-grow: 1;
}
#bp-ranking-table th:nth-child(3),
#bp-ranking-table td:nth-child(3),
#rank-ranking-table th:nth-child(3),
#rank-ranking-table td:nth-child(3),
#quest-ranking-table th:nth-child(3),
#quest-ranking-table td:nth-child(3),
#tower-ranking-table th:nth-child(3),
#tower-ranking-table td:nth-child(3) {
    width: 20%;
}
.gold-rank {
    background-color: var(--color-gold) !important;
    color: #000;
}
.silver-rank {
    background-color: var(--color-silver) !important;
    color: #000;
}
.bronze-rank {
    background-color: var(--color-bronze) !important;
    color: #000;
}
.darkm .gold-rank {
    background-color: var(--color-gold) !important;
    color: #eee;
}
.darkm .silver-rank {
    background-color: var(--color-silver) !important;
    color: #eee;
}
.darkm .bronze-rank {
    background-color: var(--color-bronze) !important;
    color: #eee;
}
.stage-select-container { display: flex; align-items: center; }
.stage-select-container.hidden { display: none; }
.stage-select-container select { margin-right: 10px; padding: 2px; font-size: 0.875rem; align-items: center;}

.url:link{
    color: var(--link-base);
}
.url:visited, .url:hover, .url:active {
    color: var(--link-visited);
}

.category-text-button {
    cursor: pointer;
    min-width: 5px;
    text-align: center;
    color: var(--color-text);
    padding: 0 5px;
    margin-right: 5px;
}

.category-text-button:hover {
    opacity: 0.8;
    background-color: var(--color-selected-bg);
    color: var(--color-selected-text); 
    border-radius: 6px;
}

.category-text-button.selected {
    background-color: var(--color-selected-bg);
    color: var(--color-selected-text);
    font-weight: bold;
    border-radius: 6px;
}

#category input[type="radio"] {
    display: none;
}
#subcategory-select-content input[type="radio"] {
    display: none;
}
#subcategory-select-damage input[type="radio"] {
    display: none;
}
#subcategory-select-equipment input[type="radio"] {
    display: none;
}
#product-select-unlock input[type="radio"] {
    display: none;
}
#product-select-augment input[type="radio"] {
    display: none;
}
#product-select-piece input[type="radio"] {
    display: none;
}
#vip-content-table {
    table-layout: auto;
    width: max-content;
}


#content {
    overflow-x: auto;
}
.price-text-button {
    cursor: pointer;
    min-width: 5px;
    text-align: center;
    color: var(--color-text);
    padding: 0 5px;
    margin-right: 5px;
}

.price-text-button:hover {
    opacity: 0.8;
    background-color: var(--color-selected-bg);
    color: var(--color-selected-text); 
    border-radius: 6px;
}

.price-text-button.selected {
    background-color: var(--color-selected-bg);
    color: var(--color-selected-text);
    font-weight: bold;
    border-radius: 6px;
}

#price input[type="radio"] {
    display: none;
}

.vip-price-section {
    min-height: 1.2em; 
    margin-bottom: 5px; 
}

.vip-reward-section {
    margin-top: 5px;
}

hr.vip-separator {
    margin: 3px 0;
    border: 0;
    border-top: 1px solid var(--color3); 
}

#result-table {
    width: auto;
    margin-left: auto;
    margin-right: auto;
    border-collapse: collapse;
    width: 90%;
    max-width: 900px;
    min-width: 300px;
    background-color: var(--color-bg);
    color: var(--color-text);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#result-table th, #result-table td {
    border: 1px solid var(--color3);
    padding: 5px 10px;
    white-space: nowrap;
}

#result-table td:nth-child(2) > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}
#enemy-detail-container {
    background-color: var(--color-bg);
    border: 2px solid #555;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    box-shadow: 0 4px 8px rgba(207, 207, 207);
}

#enemy-detail-container.hidden {
    display: none;
}

#enemy-list-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
    justify-content: center;
}

.enemy-card {
    background-color: var(--color-selected-bg);
    color: var(--color-selected-text);
    border-radius: 8px;
    padding: 10px 8px 5px 8px;
    width: 100px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(207, 207, 207);
    display: flex; 
    flex-direction: column;
    align-items: center;
}
.buff-list-container {
    display: flex;
    justify-content: left;
    align-items: center;
    width: 100%; 
    height: 20px;
    margin-top: 5px;
    padding: 2px 0;
    overflow: hidden;
}

.buff-card {
    width: 20px; 
    height: 20px;
    margin: 0 1px;
    background-color: #333;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.buff-icon {
    width: 18px;
    height: 18px;
    object-fit: cover;
    border-radius: 3px;
}
.enemy-icon-container {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0 auto 5px auto;
}

.enemy-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}
.base-icon {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.overlay-icon {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}
.enemy-name {
    font-weight: bold;
    margin-bottom: 3px;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.enemy-power {
    font-size: 0.75rem;
    color: var(--color3);
    white-space: nowrap;
}
.enemy-level {
    font-size: 0.75rem;
    color: var(--color3);
    white-space: nowrap;
}
.enemy-speed {
    font-size: 0.75rem;
    color: var(--color3);
    white-space: nowrap;
}

.stage-row-selected {
    background-color: var(--color-selected-bg) !important;
    color: var(--color-selected-text) !important;
    cursor: pointer;
}
#baff {
    text-align: center;
    margin-top: 0px;
    padding: 10px;
    background-color: var(--color-bg);
    border-top: 1px solid var(--color-bg);
    border-radius: 0 0 8px 8px; 
    color: var(--color-text);
}
#base-battle-power {
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    background-color: var(--color-bg);
    border-top: 1px solid var(--color-bg);
    border-radius: 0 0 8px 8px; 
    color: var(--color-text);
}

#base-battle-power a {
    margin: 0;
    font-size: 0.9rem;
    color:var(--color-text);
}

#base-battle-power p {
    margin: 0;
    font-size: 1.2rem;
    color:var(--color-text);
}

#base-battle-power strong {
    font-size: 0.8rem;
    color: var(--color-text);
    display: block;
    margin-top: 5px;
}

#control-field {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 8px 0;
    border: 1px solid var(--color-bg);
    border-radius: 4px;
}

#control-field label {
    font-weight: bold;
    margin-right: 15px;
    white-space: nowrap;
    min-width: 150px;
    text-align: right;
}

#processing-limit-slider {
    cursor: pointer;
}

#fancy-loading-container {
    width: 100%;
    max-width: 500px;
    height: 8px;
    margin: 20px auto;
    background-color: var(--color-text);
    border-radius: 4px;
    overflow: hidden;
    display: none;
}

#fancy-loading-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color1), var(--color1)); 
    width: 0%;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 5px rgba(33, 150, 243, 0.5);
}