/* Stat cards and bars shared by the ladder page and the character page. */

/* ── playing now badge ── */
.ld-playing {
    display: inline-block;
    isolation: isolate;
    background: #1f6e33;
    color: #fff;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}
.ld-playing::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: #7dff9c;
    vertical-align: middle;
}

/* ── season stat cards ── */
.ld-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 10px;
    isolation: isolate;
}
.ld-cards[hidden] {
    display: none;
}
.ld-card {
    appearance: none;
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 10px 12px;
    font-family: 'Source Sans 3', sans-serif;
    color: #ddd;
}
.ld-cards-note {
    grid-column: 1 / -1;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.3rem;
    color: #C7B377;
}
.ld-card:hover,
.ld-card:focus-visible {
    border-color: #C7B377;
    background: #333;
    outline: none;
}
.ld-card-label {
    font-size: 1.2rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.ld-card-value {
    font-size: 2.4rem;
    font-weight: 700;
    color: #C7B377;
    line-height: 1.2;
}
/* Long values scale with the card's width (~4.4em for "1,012,725"); short ones keep the full size. */
.ld-card {
    container-type: inline-size;
}
.ld-card-value-long {
    font-size: min(2.4rem, 22cqi);
}
.ld-card-detail {
    font-size: 1.2rem;
    color: #999;
}
.ld-bar-track {
    background: #1d1d1d;
    border-radius: 3px;
    height: 14px;
    overflow: hidden;
}
.ld-bar {
    background: linear-gradient(90deg, #800000, #b8892f);
    height: 100%;
}
.ld-panel .ld-cards {
    margin: 0 0 12px;
}
/* character page cards */
.ld-char-cards {
    margin: 10px 0;
}
.ld-card-wide {
    grid-column: span 2;
}
.ld-level-bar {
    height: 6px;
    margin-top: 6px;
    border-radius: 3px;
    background: #1d1d1d;
    overflow: hidden;
}
.ld-level-bar div {
    height: 100%;
    background: linear-gradient(90deg, #800000, #b8892f);
}
.ld-zone-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) 1fr auto;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    margin: 4px 0;
}
.ld-zone-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ld-zone-value {
    color: #C7B377;
    font-weight: 600;
    white-space: nowrap;
}
.ld-char-heading {
    font-family: 'Source Sans 3', sans-serif;
    color: #C7B377;
    font-size: 1.5rem;
    margin: 14px 0 0;
    isolation: isolate;
}
.ld-card-static {
    cursor: default;
}
.ld-char-cards .ld-card-value {
    font-size: 2.1rem;
}

/* ── play calendar (character page): hours played per day, one-hue ramp (dataviz sequential blue) ── */
.ld-calendar {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 10px 12px;
    margin: 10px 0;
    font-family: 'Source Sans 3', sans-serif;
    color: #ddd;
    isolation: isolate;
}
.ld-cal-scroll {
    overflow-x: auto;
    padding: 6px 0;
    /* Centers the grid while it fits; a longer season still scrolls from the start. */
    text-align: center;
}
.ld-cal-body {
    text-align: left;
}
.ld-cal-side > .ld-card-label {
    text-align: center;
}
.ld-cal-body {
    display: inline-block;
}
.ld-cal-months {
    display: grid;
    gap: 3px;
    margin-left: 34px;
    font-size: 1.1rem;
    color: #999;
    height: 16px;
    white-space: nowrap;
}
.ld-cal-main {
    display: flex;
    gap: 6px;
}
.ld-cal-weekdays {
    display: grid;
    grid-template-rows: repeat(7, var(--ld-cal-cell, 13px));
    gap: 3px;
    width: 28px;
    font-size: 1rem;
    color: #999;
    line-height: var(--ld-cal-cell, 13px);
}
.ld-cal-grid {
    display: grid;
    grid-template-rows: repeat(7, var(--ld-cal-cell, 13px));
    gap: 3px;
}
.ld-cal-day {
    display: inline-block;
    width: var(--ld-cal-cell, 13px);
    height: var(--ld-cal-cell, 13px);
    border-radius: 3px;
    box-sizing: border-box;
}
.ld-cal-0 { background: #383838; }
.ld-cal-1 { background: #104281; }
.ld-cal-2 { background: #256abf; }
.ld-cal-3 { background: #5598e7; }
.ld-cal-4 { background: #9ec5f4; }
.ld-cal-unknown {
    border: 1px dashed #555;
}
.ld-cal-future {
    background: #303030;
    opacity: 0.45;
}
.ld-cal-outside {
    visibility: hidden;
}
.ld-cal-footer {
    display: flex;
    justify-content: center;
    column-gap: 24px;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ld-cal-legend .ld-cal-day {
    width: 11px;
    height: 11px;
}
.ld-cal-legend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 1.1rem;
    color: #999;
}
.ld-cal-legend span:first-child {
    margin-right: 3px;
}
.ld-cal-legend span:last-child {
    margin-left: 3px;
}

/* calendar + the zones this character earned the most XP in, side by side (stacked when narrow) */
.ld-cal-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    justify-content: center;
    align-items: flex-start;
}
.ld-cal-side {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}
.ld-cal-zones {
    flex: 1 1 320px;
    max-width: 480px;
}
.ld-cal-zones .ld-card-label {
    margin-bottom: 6px;
}
.ld-cal-zones .ld-zone-row {
    /* Fixed columns so every row's bar starts at the same place. */
    grid-template-columns: 160px minmax(60px, 1fr) 72px 44px;
}
.ld-zone-hours {
    color: #999;
    font-size: 1.1rem;
    text-align: right;
}
.ld-cal-zones .ld-zone-name {
    white-space: normal;
    line-height: 1.2;
}
.ld-cal-side .ld-cal-footer {
    flex-direction: column;
    row-gap: 4px;
}

/* ── item-box theme, after the /db item pages (db.css .db-game-item, .db-card, .db-button) ──
   Big boxes: navy gradient with a faint top glow, bronze border, gold corner brackets.
   Boxes inside boxes: the lighter /db card gradient. Buttons: /db gradients with a gold hover. */
.ld-card,
.ld-calendar,
.ld-section {
    position: relative;
    background:
        radial-gradient(ellipse at 50% 0, rgba(48, 45, 58, .6), transparent 60%),
        linear-gradient(180deg, #151522, #090a10 85%);
    border: 1px solid #4a3c28;
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4), inset 0 0 24px rgba(0, 0, 0, .55), 0 0 2px #8b7355;
}
.ld-card::before,
.ld-card::after,
.ld-calendar::before,
.ld-calendar::after,
.ld-section::before,
.ld-section::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid #8b7355;
    pointer-events: none;
    transition: border-color .15s ease;
}
.ld-card::before,
.ld-calendar::before,
.ld-section::before {
    top: -1px;
    left: -1px;
    border-right: 0;
    border-bottom: 0;
}
.ld-card::after,
.ld-calendar::after,
.ld-section::after {
    right: -1px;
    bottom: -1px;
    border-top: 0;
    border-left: 0;
}
.ld-card {
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.ld-card:hover,
.ld-card:focus-visible {
    background:
        radial-gradient(ellipse at 50% 0, rgba(199, 179, 119, .16), transparent 62%),
        linear-gradient(180deg, #171724, #0a0b11 85%);
    border-color: #8b7355;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .5), inset 0 0 24px rgba(0, 0, 0, .5), 0 0 6px rgba(199, 179, 119, .35);
}
.ld-card:not(.ld-card-static):hover {
    transform: translateY(-2px);
}
.ld-card:hover::before,
.ld-card:hover::after,
.ld-card:focus-visible::before,
.ld-card:focus-visible::after {
    border-color: #C7B377;
}
.ld-card-label {
    color: #a9a293;
}

/* Facts and cards nested in a section get the plain /db card, not a second set of brackets. */
.ld-fact,
.ld-section .ld-card {
    background: linear-gradient(145deg, #1c1f23, #15171a);
    border: 1px solid #34383e;
    border-top-color: #4c4433;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
}
.ld-section .ld-card::before,
.ld-section .ld-card::after {
    display: none;
}

/* Tabs: dark /db gradient; the selected one keeps the ladder red, as a gradient with a bronze edge. */
.ld-tab {
    background: linear-gradient(180deg, #26292e, #181a1d);
    border-color: #3a3f45;
    border-top-color: #4a3c28;
}
.ld-tab:hover {
    background: linear-gradient(180deg, #2e2a22, #1b1a18);
    border-color: #8b7355;
}
.ld-tab[aria-selected="true"] {
    background: linear-gradient(180deg, #9e1414, #6a0000);
    border-color: #a3762f;
    box-shadow: inset 0 1px 0 rgba(255, 220, 160, .25);
}

/* Dropdowns and the search box: the /db control style. */
.ld-dd-toggle,
.ld-search-field {
    background: linear-gradient(180deg, #24272b, #181a1d);
    border-color: #5a5345;
}
.ld-dd-toggle:hover,
.ld-dd.open .ld-dd-toggle {
    background: linear-gradient(180deg, #2e2a22, #1d1b18);
    border-color: #C7B377;
}

/* Red action buttons (Compare, leagues): gradient with a bronze edge. */
.ladder-btn,
.ld-league-btn {
    background: linear-gradient(180deg, #9e1414, #6a0000);
    border: 1px solid #a3762f;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 220, 160, .2);
}
.ladder-btn:hover,
.ld-league-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #b51c1c, #7d0505);
    border-color: #C7B377;
}
.ld-league-danger {
    background: linear-gradient(180deg, #5a1d1d, #3a0f0f);
}
/* Secondary league actions (Settings, routine saves): dark with the same bronze edge. */
.ld-league-btn.ld-league-btn-quiet {
    background: linear-gradient(180deg, #3b3833, #25231f);
    border-color: #6b5a3a;
}
.ld-league-btn.ld-league-btn-quiet:hover:not(:disabled) {
    background: linear-gradient(180deg, #4a463f, #2e2b26);
    border-color: #C7B377;
}

/* The character page doesn't load ladder.css: let its main column fit small screens too. */
.main .flex-80,
.main .flex-80 fieldset {
    min-width: 0;
}
@media (max-width: 899px) {
    /* Long names in the wide Diablo font: break them instead of widening the page. */
    #chart-title {
        overflow-wrap: anywhere;
    }
}

/* Character page: the zoom tip box and its buttons, isolated from darkmode's color inversion. */
fieldset .chart-controls {
    isolation: isolate;
    position: relative;
    background:
        radial-gradient(ellipse at 50% 0, rgba(48, 45, 58, .6), transparent 60%),
        linear-gradient(180deg, #151522, #090a10 85%);
    border: 1px solid #4a3c28;
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4), inset 0 0 24px rgba(0, 0, 0, .55), 0 0 2px #8b7355;
}
fieldset .chart-tip {
    color: #c9c2b0;
}
fieldset .zoom-btn,
fieldset .input-container .submit-button {
    isolation: isolate;
    padding: 9px 14px;
    border: 1px solid #C7B377;
    border-radius: 5px;
    background: linear-gradient(180deg, #3d3424, #2a2418);
    color: #f2e6c0;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 230, 170, .15);
}
fieldset .zoom-btn:hover,
fieldset .input-container .submit-button:hover {
    background: linear-gradient(180deg, #51452e, #362e1f);
}
