.alchemy-layout { display: grid; gap: 1rem; }
.alchemy-inventory { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: .75rem; }
.alchemy-element { min-width: 0; text-align: center; }
.alchemy-element label { display: flex; flex-direction: column; align-items: center; margin-bottom: .5rem; }
.alchemy-element input { text-align: center; }
/* Reward list: what is available on the left, the chosen rewards (Tier 1 on top) on the right. */
.alchemy-tiers { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1rem; align-items: start; }
.alchemy-tier-title { margin-bottom: .5rem; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .65; }
.alchemy-tier-list { display: grid; gap: .35rem; }
.alchemy-tier-list--available { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.alchemy-tier { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; min-height: 2.6rem; padding: .3rem .6rem; border: 1px solid color-mix(in srgb, currentColor 12%, transparent); border-radius: .6rem; background: color-mix(in srgb, var(--color-base-200) 60%, transparent); }
.alchemy-tier-label { flex: 1 1 7rem; min-width: 0; font-size: .9rem; font-weight: 600; }
.alchemy-tier button[disabled] { visibility: hidden; }
.alchemy-slider { flex-basis: 100%; }
#alchemy-priorities.htmx-request { opacity: .65; transition: opacity .15s; }
.alchemy-slider[hidden] { display: none; }
.alchemy-slider input { width: 100%; }
.alchemy-rewards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; }
.alchemy-reward { position: relative; }
.alchemy-reward > .badge { position: absolute; top: .6rem; right: .6rem; }
.alchemy-steps { display: grid; gap: .5rem; }
.alchemy-step { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .65rem; border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent); }
.alchemy-combination, .alchemy-step-element, .alchemy-step-result { display: inline-flex; align-items: center; gap: .35rem; }
.alchemy-step-element img, .alchemy-step-result img { flex-shrink: 0; }
.alchemy-step-count { margin-left: auto; white-space: nowrap; }
.alchemy-owned label { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; }
.alchemy-waiting { max-width: 48rem; margin: 2rem auto; padding: 2.5rem 1.25rem; text-align: center; }
.alchemy-waiting-icons { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-bottom: 1.5rem; }
#alchemy-workbench .errorlist { color: var(--color-error); font-size: .85rem; }
@media (max-width: 640px) { .alchemy-tiers { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 400px) { .alchemy-waiting-icons img { width: 58px; height: 58px; } .alchemy-step { gap: .4rem; } }
/* Recipe matrix: the community sheet, reprinted. Sticky headers need the scrolling box. */
.alchemy-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin: .75rem 0; font-size: .75rem; }
.alchemy-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.alchemy-swatch { width: .9rem; height: .9rem; border: 1px solid color-mix(in srgb, currentColor 25%, transparent); border-radius: .25rem; }
.alchemy-matrix-scroll { max-height: 85vh; overflow: auto; border: 1px solid color-mix(in srgb, currentColor 14%, transparent); border-radius: .75rem; }
.alchemy-matrix { width: 100%; min-width: 64rem; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: .7rem; line-height: 1.15; }
.alchemy-matrix :is(th, td) { padding: .3rem .15rem; text-align: center; vertical-align: middle; overflow-wrap: anywhere; border-right: 1px solid color-mix(in srgb, currentColor 10%, transparent); border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent); }
.alchemy-matrix th { position: sticky; z-index: 1; font-weight: 700; background: var(--color-base-200); }
.alchemy-matrix thead th { top: 0; }
.alchemy-matrix tbody th, .alchemy-matrix .alchemy-matrix-corner { left: 0; }
.alchemy-matrix .alchemy-matrix-corner { z-index: 2; opacity: 1; font-size: 1rem; }
.alchemy-matrix img { display: block; margin: 0 auto .1rem; }
.alchemy-cell { position: relative; height: 3.5rem; }
.alchemy-cell > :is(span, small) { display: block; }
.alchemy-cell small { opacity: .65; }
.alchemy-cell-item { font-weight: 700; }
.alchemy-cell--element { background: color-mix(in srgb, var(--color-accent) 16%, transparent); }
.alchemy-cell--wildcards { background: color-mix(in srgb, var(--color-warning) 30%, transparent); }
.alchemy-cell--skills { background: color-mix(in srgb, var(--color-secondary) 30%, transparent); }
.alchemy-cell--gear { background: color-mix(in srgb, var(--color-error) 24%, transparent); }
.alchemy-cell--collectible { background: color-mix(in srgb, var(--color-success) 24%, transparent); }
.alchemy-cell--resources { background: color-mix(in srgb, var(--color-info) 16%, transparent); }
/* Same ingredient twice: two copies per craft. */
.alchemy-cell.is-diagonal { background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, currentColor 7%, transparent) 6px 12px); }
.alchemy-cell.is-planned, .alchemy-swatch.is-planned { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.alchemy-cell-count { position: absolute; top: 2px; right: 2px; padding: 0 .3rem; border-radius: .4rem; font-size: .65rem; font-weight: 800; color: var(--color-primary-content); background: var(--color-primary); }
/* Reading aid: light up the hovered row and column. Browsers without :has() skip the column. */
.alchemy-matrix tbody tr:hover > * { box-shadow: inset 0 0 0 99px color-mix(in srgb, currentColor 9%, transparent); }
.alchemy-matrix:has(td:nth-child(2):hover) :is(td, th):nth-child(2), .alchemy-matrix:has(td:nth-child(3):hover) :is(td, th):nth-child(3), .alchemy-matrix:has(td:nth-child(4):hover) :is(td, th):nth-child(4), .alchemy-matrix:has(td:nth-child(5):hover) :is(td, th):nth-child(5), .alchemy-matrix:has(td:nth-child(6):hover) :is(td, th):nth-child(6), .alchemy-matrix:has(td:nth-child(7):hover) :is(td, th):nth-child(7), .alchemy-matrix:has(td:nth-child(8):hover) :is(td, th):nth-child(8), .alchemy-matrix:has(td:nth-child(9):hover) :is(td, th):nth-child(9), .alchemy-matrix:has(td:nth-child(10):hover) :is(td, th):nth-child(10), .alchemy-matrix:has(td:nth-child(11):hover) :is(td, th):nth-child(11), .alchemy-matrix:has(td:nth-child(12):hover) :is(td, th):nth-child(12), .alchemy-matrix:has(td:nth-child(13):hover) :is(td, th):nth-child(13), .alchemy-matrix:has(td:nth-child(14):hover) :is(td, th):nth-child(14), .alchemy-matrix:has(td:nth-child(15):hover) :is(td, th):nth-child(15), .alchemy-matrix:has(td:nth-child(16):hover) :is(td, th):nth-child(16), .alchemy-matrix:has(td:nth-child(17):hover) :is(td, th):nth-child(17), .alchemy-matrix:has(td:nth-child(18):hover) :is(td, th):nth-child(18), .alchemy-matrix:has(td:nth-child(19):hover) :is(td, th):nth-child(19), .alchemy-matrix:has(td:nth-child(20):hover) :is(td, th):nth-child(20), .alchemy-matrix:has(td:nth-child(21):hover) :is(td, th):nth-child(21), .alchemy-matrix:has(td:nth-child(22):hover) :is(td, th):nth-child(22), .alchemy-matrix:has(td:nth-child(23):hover) :is(td, th):nth-child(23), .alchemy-matrix:has(td:nth-child(24):hover) :is(td, th):nth-child(24), .alchemy-matrix:has(td:nth-child(25):hover) :is(td, th):nth-child(25), .alchemy-matrix:has(td:nth-child(26):hover) :is(td, th):nth-child(26), .alchemy-matrix:has(td:nth-child(27):hover) :is(td, th):nth-child(27), .alchemy-matrix:has(td:nth-child(28):hover) :is(td, th):nth-child(28), .alchemy-matrix:has(td:nth-child(29):hover) :is(td, th):nth-child(29), .alchemy-matrix:has(td:nth-child(30):hover) :is(td, th):nth-child(30), .alchemy-matrix:has(td:nth-child(31):hover) :is(td, th):nth-child(31), .alchemy-matrix:has(td:nth-child(32):hover) :is(td, th):nth-child(32), .alchemy-matrix:has(td:nth-child(33):hover) :is(td, th):nth-child(33), .alchemy-matrix:has(td:nth-child(34):hover) :is(td, th):nth-child(34) { box-shadow: inset 0 0 0 99px color-mix(in srgb, currentColor 9%, transparent); }
.alchemy-matrix td:hover { box-shadow: inset 0 0 0 99px color-mix(in srgb, currentColor 18%, transparent) !important; }
