/* Advanced Calculator — page layout.
   Reuses base.css tokens/classes plus the modal / .blook-grid / .rarity-tag
   rules already loaded from calculator.css. Only the two-column shell, the
   blook card, the segmented toggles and the results text live here. */

/* ── Two-column shell (mirrors token-grinder's .mainContent) ── */
.acContent {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    width: 100%;
    align-items: stretch;   /* both columns take the height of the taller one */
}

.acSelection {
    flex: 2;
    min-width: 0;
    gap: 0.5rem;
    padding: 1.25rem;
    align-items: center;
    /* so the compare row can size its blooks to the column, not the viewport */
    container-type: inline-size;
}

.acResults {
    flex: 3;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Stats — its own translucent block, centred under the two columns */
.acStats {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.85rem 1.75rem;
    background: rgb(255 255 255 / 0.2);
    backdrop-filter: blur(4px);
    border-radius: 1rem;
}

/* ── Blook compare row (left column) ──
   A 3-column grid so the two extra blooks always stay beside the main one;
   sizes are driven by container-query units (cqw = 1% of the purple column)
   so they scale down on a Chromebook instead of wrapping. */
.blook-compare {
    display: grid;
    grid-template-columns: 0.85fr 1.7fr 0.85fr;
    align-items: center;
    justify-items: center;
    gap: 1.5cqw;
    width: 100%;
}

.blook-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
}

/* Same look as Studio's "Create New" tile: a flat translucent-white rounded
   square with the "+" punched clean through as an SVG cutout. */
.blook-add {
    width: clamp(2.5rem, 16cqw, 3.9rem);
    height: clamp(2.5rem, 16cqw, 3.9rem);
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    transition: transform 0.15s ease-out;
}

.blook-add:hover { transform: scale(1.06); }
.blook-add:active { transform: scale(0.94); }

.blook-add svg {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}

.blook-add rect {
    fill: #fff;
    fill-opacity: 0.65;
    transition: fill-opacity 0.15s ease;
}

.blook-add:hover rect { fill-opacity: 0.9; }

.blook-mini {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    padding: clamp(0.3rem, 2.5cqw, 0.75rem) clamp(0.3rem, 2.5cqw, 0.8rem) clamp(0.4rem, 3cqw, 0.85rem);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-bottom: 5px solid var(--accent);
}

.blook-mini-pick {
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s;
}

.blook-mini-pick:hover { transform: scale(1.06); }

.blook-mini-pick img {
    width: 100%;
    max-width: 7rem;
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(4px 4px rgba(0, 0, 0, 0.2));
}

.blook-mini-name {
    max-width: 100%;
    font-family: var(--font-main);
    font-size: clamp(0.58rem, 4cqw, 1rem);
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    text-align: center;
    line-height: 1.15;
    overflow-wrap: normal;
    word-break: keep-all;
}

.blook-mini-remove {
    position: absolute;
    top: clamp(-0.6rem, -3cqw, -0.35rem);
    right: clamp(-0.6rem, -3cqw, -0.35rem);
    width: clamp(1.15rem, 6cqw, 1.6rem);
    height: clamp(1.15rem, 6cqw, 1.6rem);
    border-radius: 50%;
    border: none;
    background: var(--red);
    color: #fff;
    font-size: clamp(0.7rem, 4cqw, 1rem);
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.blook-mini-remove:hover { filter: brightness(1.1); }

.blook-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
    padding: 0.4rem;
    font-family: var(--font-heading);
}

.blook-compare.comparing .blook-card {
    border-bottom: 4px solid var(--blue1);
}

.blook-pick {
    width: 100%;
    max-width: 11rem;
    padding: 0.3rem;
    border: none;
    background: none;
    cursor: pointer;
    transition: transform 0.15s;
}

.blook-pick:hover { transform: scale(1.05); }
.blook-pick:active { transform: scale(0.97); }

.blook-pick img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    filter: drop-shadow(6px 6px rgba(0, 0, 0, 0.18));
}

.blook-card-name {
    max-width: 100%;
    font-size: clamp(0.8rem, 6.5cqw, 1.7rem);
    color: #fff;
    text-shadow: 3px 3px rgba(0, 0, 0, 0.2);
    text-align: center;
    line-height: 1.1;
    overflow-wrap: normal;
    word-break: keep-all;
    hyphens: none;
}

.blook-card-pack {
    max-width: 100%;
    font-size: clamp(0.6rem, 4.4cqw, 0.95rem);
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* ── Segmented toggle (Token # / Pack #, Binomial / Cumulative, ON / OFF) ── */
.acToggle {
    position: relative;
    display: flex;
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    overflow: hidden;
    font-family: var(--font-main);
    font-size: calc(0.9rem + 0.4vw);
    user-select: none;
}

.acToggle-highlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: #fff;
    border-radius: 0.75rem;
    transition: left 0.25s ease;
}

.acToggle.pos-2 .acToggle-highlight { left: 50%; }

.acToggle-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    color: #fff;
    text-shadow: none;
    cursor: pointer;
    z-index: 1;
    transition: color 0.2s;
    text-align: center;
}

.acToggle-option.active { color: var(--purple); }
#chartModeToggle .acToggle-option.active { color: var(--blue1); }

.acToggle.locked {
    opacity: 0.5;
    pointer-events: none;
}

.acToggle-sm {
    width: auto;
    min-width: 9rem;
    margin-bottom: 0;
    font-size: 1rem;
}

/* ── Amount / resell rows ── */
.acRow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-family: var(--font-main);
    font-size: calc(0.9rem + 0.5vw);
    color: #fff;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

.acAmountBox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
    transition: background 0.15s;
}

.acAmountBox:focus-within { background: rgba(255, 255, 255, 0.25); }

.acAmountBox input {
    /* width is set inline by JS to fit the current value (min ~4ch) */
    width: 5ch;
    min-width: 3ch;
    max-width: 11ch;
    background: transparent;
    border: none;
    color: #fff;
    font-size: calc(1rem + 0.5vw);
    font-family: var(--font-main);
    text-align: center;
}

.acAmountBox input:focus { outline: none; }

.acAmountBox input::placeholder {
    color: rgba(255, 255, 255, 0.65);
    opacity: 1;
}

.acAmountBox input::-webkit-outer-spin-button,
.acAmountBox input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.acAmountBox img {
    width: 1.6rem;
    height: 1.6rem;
    filter: drop-shadow(2px 2px rgba(0, 0, 0, 0.2));
}

.acAmountBox.packs-mode img { display: none; }

/* "Powered by iBlooket" — pinned to the bottom of the purple column */
.acPoweredBy {
    margin-top: auto;
    margin-bottom: -0.85rem;   /* eat most of .acSelection's 1.25rem bottom padding */
    padding-top: 0.5rem;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: rgb(255 255 255 / 0.55);
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

.acPoweredBy span { font-family: var(--font-heading); color: rgb(255 255 255 / 0.7); }

/* ── Chart placeholder ── */
.acChart {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 0.75rem;
    overflow: hidden;
}

.acChart-svg {
    width: 100%;
    height: 100%;
    display: block;
    font-family: var(--font-main);
}

.acChart-axis   { stroke: #b7bcc4; stroke-width: 1.5; }
.acChart-grid   { stroke: #e6e8ec; stroke-width: 1; }
.acChart-guide  { stroke: #b7bcc4; stroke-width: 1; stroke-dasharray: 3 3; }
.acChart-bar    { fill: var(--blue1); }
.acChart-area   { fill: rgba(11, 194, 207, 0.16); }
.acChart-line   {
    fill: none;
    stroke: var(--blue1);
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.acChart-dot    { fill: var(--blue1); }
.acChart-tick   { fill: #6b7280; font-size: 11px; }
.acChart-title  { fill: #6b7280; font-size: 11px; font-weight: bold; }
.acChart-marker { stroke: var(--red); stroke-width: 2; stroke-dasharray: 4 3; }
.acChart-marker-label { fill: var(--red); font-size: 12px; font-weight: bold; }
.acChart-readout-bg {
    fill: #fff;
    fill-opacity: 0.92;
    stroke: rgba(0, 0, 0, 0.08);
    stroke-width: 1;
}
.acChart-readout-text { font-size: 11px; font-weight: bold; }
.acChart-hit { fill: transparent; }
.acChart-hit:hover { fill: rgba(11, 194, 207, 0.14); }
.acChart-plot-hit { fill: transparent; }
.acChart-hover { pointer-events: none; }
.acChart-crosshair { stroke: #6b7280; stroke-width: 1.5; stroke-dasharray: 4 3; }

.acChart-tip {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--gray);
    color: #fff;
    font-family: var(--font-main);
    font-size: 0.78rem;
    line-height: 1.3;
    padding: 0.45rem 0.65rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    white-space: nowrap;
}

.acChart-tip[hidden] { display: none; }

.acChart-tip b {
    font-family: var(--font-heading);
    font-weight: normal;
    font-size: 0.82rem;
    margin-bottom: 2px;
}

/* ── Stats ── */
.acHeading {
    display: inline-block;
    align-self: center;
    text-decoration: underline;
    text-underline-offset: 6px;
    margin-bottom: 0.25rem;
}

.acStats .acHeading {
    font-size: calc(0.4rem + 1.1vw);
}

#acStatsBody {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.acStatLine {
    width: 100%;
    text-align: center;
    font-family: var(--font-main);
    font-size: calc(0.9rem + 0.35vw);
    color: #fff;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

.acStatLine b { font-family: var(--font-heading); font-weight: normal; }

.acDot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
    flex: 0 0 auto;
}

/* ── Target chance → tokens needed (under the chart toggle) ── */
.acTarget {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    background: rgb(255 255 255 / 0.2);
    backdrop-filter: blur(4px);
    border-radius: 1rem;
}

#acTargetBody {
    width: fit-content;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.acTargetBox { gap: 0.15rem; }
.acTargetBox input { width: 3ch; max-width: 7ch; }

.acTargetPct {
    font-family: var(--font-main);
    font-size: calc(1rem + 0.5vw);
}

.acTargetPacks { opacity: 0.8; font-size: 0.9em; }

.acTargetLine {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 0.6rem;
    font-size: calc(1.1rem + 0.55vw);
}

/* base.css turns off selection on everything — let people copy the numbers */
.acTargetResult,
.acTargetResult * {
    user-select: text;
    -webkit-user-select: text;
}

.acTargetBlook {
    width: 2.2em;
    height: 2.2em;
    object-fit: contain;
    filter: drop-shadow(2px 2px rgba(0, 0, 0, 0.2));
}

/* token logo sized to the text's cap height-ish (1em) */
.acTargetToken {
    height: 1em;
    width: auto;
    margin-right: 0.25em;
    vertical-align: -0.12em;
    filter: drop-shadow(2px 2px rgba(0, 0, 0, 0.2));
}

/* ── Chart legend ── */
.acChart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1.25rem;
    margin-top: -0.25rem;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

.acChart-legend-item { display: flex; align-items: center; }
.acChart-legend-item .acDot { margin-right: 0.3rem; }

/* ── Blook picker modal — collapsible pack sections ── */
.blook-name .blook-pct {
    margin-left: 0.4rem;
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}

#blookGrid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.25rem 0.4rem 0.25rem 0.25rem;
}

#blookGrid::-webkit-scrollbar { width: 0.6rem; }
#blookGrid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
}
#blookGrid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 1rem;
}

.blook-pack-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.85rem 1rem;
    /* background set per-pack (its radial gradient) via inline style */
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 6px 6px rgba(0, 0, 0, 0.25);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.3);
    text-align: left;
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s;
}

.blook-pack-header:hover {
    filter: brightness(1.08);
    transform: scale(0.99);
}

.blook-pack-count {
    font-family: var(--font-main);
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    text-shadow: none;
}

.blook-pack-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}

.blook-pack.open .blook-pack-chevron { transform: rotate(180deg); }

.blook-pack-blooks {
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.6rem 0.25rem 0.25rem;
}

.blook-pack.open .blook-pack-blooks { display: grid; }

#blookGrid .blook-row {
    cursor: pointer;
    border: 3px solid transparent;
}

#blookGrid .blook-row.selected {
    border-color: #fff;
    background: rgba(0, 0, 0, 0.18);
}

@media only screen and (max-width: 768px) {
    .blook-pack-blooks { grid-template-columns: 1fr; }
}

/* ── Responsive ── */
@media only screen and (max-width: 1200px) {
    .acContent { flex-direction: column; }
    .acSelection,
    .acResults {
        flex: unset;
        width: 100%;
    }
}
