:root {
    --bg: #0e1411;
    --card: #17211b;
    --card-2: #1e2b23;
    --line: #2c3d33;
    --text: #e8f0ea;
    --muted: #8fa597;
    --accent: #6fcf8e;
    --gold: #f5c518;
    --bad: #e5675c;
    --radius: 10px;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font:
        13px/1.35 system-ui,
        -apple-system,
        'Segoe UI',
        Roboto,
        sans-serif;
}
#app {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.hidden {
    display: none !important;
}
button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: 0;
    background: none;
}
button:disabled {
    opacity: 0.55;
    cursor: default;
}
img {
    display: block;
}

.tabs {
    display: flex;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
    display: none;
}
.tab {
    flex: 1 0 auto;
    min-width: 38px;
    padding: 7px 3px 5px;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
}
.tab span {
    font-size: 10px;
    font-weight: 600;
}
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

main {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.view {
    display: none;
    padding: 10px;
}
.view.active {
    display: block;
}

.notice {
    background: var(--warn-bg);
    border-bottom: 1px solid var(--warn-line);
    color: var(--warn-text);
    padding: 8px 10px;
    font-size: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.notice button {
    background: var(--gold);
    color: #1b1600;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
}

.head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.name {
    font-size: 15px;
    font-weight: 700;
    word-break: break-word;
}
.sub {
    color: var(--muted);
    font-size: 11px;
}
.pill {
    background: var(--card-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 700;
    white-space: nowrap;
}
.pill.coins {
    color: var(--gold);
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px 4px;
    text-align: center;
}
.stat img {
    width: 26px;
    height: 26px;
    margin: 0 auto 2px;
    object-fit: contain;
}
.stat .icon {
    font-size: 20px;
    line-height: 26px;
    height: 26px;
}
.stat b {
    display: block;
    font-size: 15px;
}
.stat small {
    color: var(--muted);
    font-size: 10px;
}

h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 12px 0 5px;
}
.row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 7px 9px;
    margin-bottom: 5px;
}
.row .ico {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 20px;
}
.row .ico img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}
.row .grow {
    flex: 1;
    min-width: 0;
}
.row .t {
    font-weight: 600;
    word-break: break-word;
}
.row .d {
    color: var(--muted);
    font-size: 11px;
}
.row .qty {
    font-weight: 700;
    color: var(--accent);
}
.row.hasact {
    flex-wrap: wrap;
}
.row.hasact .grow {
    flex: 1 1 96px;
}
.row .act {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.row .act .amount {
    flex: none;
    width: 66px;
    padding: 4px 6px;
}
.row .act select.amount {
    width: 112px;
}
.row .act-note {
    max-width: 120px;
    text-align: right;
}
.row.active-buff {
    border-color: var(--accent);
}
.empty {
    color: var(--muted);
    text-align: center;
    padding: 18px 8px;
}

.chips {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    margin-bottom: 8px;
    padding-bottom: 2px;
}
.chip {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 11px;
    white-space: nowrap;
    color: var(--muted);
    font-weight: 600;
}
.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}

.buy {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.step {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--card-2);
    border: 1px solid var(--line);
    font-weight: 700;
}
.n {
    min-width: 20px;
    text-align: center;
    font-weight: 700;
}
.btn {
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
    border-radius: 7px;
    padding: 5px 10px;
    white-space: nowrap;
}
.btn.sell {
    background: var(--bad);
    color: #fff;
}
.btn.ghost {
    background: var(--card-2);
    color: var(--text);
    border: 1px solid var(--line);
}
.price {
    color: var(--gold);
    font-weight: 700;
    font-size: 12px;
    white-space: nowrap;
}

.fav {
    font-size: 17px;
    color: #4a5a50;
    padding: 0 4px;
}
.fav.on {
    color: var(--gold);
}
.go {
    border-left: 3px solid var(--gold);
}
.di {
    border-left: 3px solid #5bc0f0;
}

.rank {
    width: 26px;
    text-align: center;
    font-weight: 700;
}

.toast {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--card-2);
    border: 1px solid var(--accent);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    font-weight: 600;
    z-index: 5;
}
.toast.err {
    border-color: var(--bad);
}

.mission.done {
    border-color: var(--accent);
    opacity: 0.8;
}
.bar {
    height: 6px;
    background: var(--card-2);
    border-radius: 999px;
    margin: 5px 0 3px;
    overflow: hidden;
}
.fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
}

/* ---------- club ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
}
.club-head .name {
    font-weight: 700;
    font-size: 15px;
}
.club-head .d {
    margin-top: 2px;
}
.bankline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 8px 0 4px;
    color: var(--muted);
}
.bankline b {
    color: var(--gold);
    font-size: 17px;
}
.bankbox {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}
.amount {
    flex: 1;
    min-width: 0;
    background: var(--card-2);
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    padding: 5px 8px;
    font: inherit;
}
.btn.small {
    padding: 4px 8px;
    font-size: 12px;
}
.tag {
    font-size: 10px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 3px 6px;
    text-align: center;
    max-width: 90px;
}
.tag.ok {
    color: var(--accent);
    border-color: var(--accent);
}

/* ---------- crate reveal ---------- */
.reveal {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 10px 10px;
    background: var(--overlay);
    overflow-y: auto;
}
.rv-head {
    font-weight: 700;
    color: var(--muted);
}
.rv-crate {
    font-size: 64px;
    line-height: 1;
    margin: 18px 0 8px;
}
.rv-crate.small {
    font-size: 30px;
    margin: 0;
}
.rv-crate.shake {
    animation: rv-shake 0.9s ease-in-out;
}
@keyframes rv-shake {
    0% {
        transform: rotate(0) scale(1);
    }
    15% {
        transform: rotate(-10deg) scale(1.05);
    }
    30% {
        transform: rotate(9deg) scale(1.08);
    }
    45% {
        transform: rotate(-12deg) scale(1.12);
    }
    60% {
        transform: rotate(11deg) scale(1.15);
    }
    80% {
        transform: rotate(-6deg) scale(1.2);
    }
    100% {
        transform: rotate(0) scale(1.3);
        filter: brightness(1.8);
    }
}
.rv-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.rv-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--line);
    border-radius: var(--radius);
    padding: 8px 10px;
    animation: rv-pop 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.rv-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-weight: 700;
    margin-bottom: 3px;
}
.rv-rar {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.85;
}
.rv-line {
    padding: 1px 0;
}
.rv-foot {
    margin-top: auto;
    padding-top: 6px;
}
@keyframes rv-pop {
    0% {
        transform: scale(0.6) translateY(14px);
        opacity: 0;
    }
    70% {
        transform: scale(1.04);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
@keyframes rv-glow {
    0%,
    100% {
        box-shadow: 0 0 0 0 transparent;
    }
    50% {
        box-shadow: 0 0 14px 1px var(--glow);
    }
}
.rv-card.r-trash {
    border-left-color: #55605a;
    color: var(--muted);
}
.rv-card.r-common {
    border-left-color: #8fa597;
}
.rv-card.r-uncommon {
    border-left-color: #6fcf8e;
    --glow: #6fcf8e;
}
.rv-card.r-rare {
    border-left-color: #5aa9ff;
    --glow: #5aa9ff;
    animation:
        rv-pop 0.35s both,
        rv-glow 1.6s 0.4s 2;
}
.rv-card.r-legendary {
    border-left-color: #f5c518;
    --glow: #f5c518;
    animation:
        rv-pop 0.35s both,
        rv-glow 1.4s 0.4s 3;
}
.rv-card.r-mythic {
    border-left-color: #c77dff;
    --glow: #c77dff;
    animation:
        rv-pop 0.35s both,
        rv-glow 1.2s 0.4s 4;
}
@media (prefers-reduced-motion: reduce) {
    .rv-card,
    .rv-crate.shake {
        animation: none !important;
    }
}

/* ---------- weekly modifier banner ---------- */
.week {
    background: var(--info-bg);
    border-bottom: 1px solid var(--info-line);
    color: var(--info-text);
    padding: 5px 10px;
    font-size: 11px;
    line-height: 1.3;
    flex-shrink: 0;
}
.week b {
    color: var(--info-strong);
}

.was {
    color: var(--muted);
    font-weight: 400;
    font-size: 11px;
}

.goal,
.daily {
    margin-bottom: 8px;
}
.goal .name,
.daily .name {
    font-weight: 700;
}
.goal .d,
.daily .d {
    margin-top: 3px;
}
.goal .bar {
    margin: 6px 0 2px;
}
.goal .btn,
.daily .btn {
    margin-top: 6px;
}

/* ---------- live hunt / boss strip ---------- */
.live {
    background: var(--ok-bg);
    border-bottom: 1px solid var(--ok-line);
    padding: 6px 10px;
    flex-shrink: 0;
}
.live-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}
.live-row .d {
    color: var(--muted);
    font-size: 11px;
}
.bar.boss .fill {
    background: var(--bad);
}
.stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
}

.lodge-search {
    min-width: 0;
}
select.sort {
    flex: 0 0 auto;
    width: auto;
    max-width: 45%;
}
.row.dim {
    opacity: 0.55;
}

.lang,
.theme {
    flex: 0 0 auto;
    align-self: center;
    margin: 0 6px;
    max-width: 92px;
    font-size: 11px;
    background: var(--card);
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 3px;
}

/* battle pass */
.pass-row {
    gap: 6px;
    align-items: stretch;
}
.pass-row .rank {
    align-self: center;
    min-width: 26px;
}
.pass-cell {
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    overflow-wrap: anywhere;
}
.pass-cell small {
    display: block;
    color: var(--muted);
    font-size: 10px;
}
.pass-cell.mine {
    border-color: var(--accent);
}
.pass-cell.dim {
    opacity: 0.55;
}
.pass-row .btn,
.pass-row .tag {
    align-self: center;
}

.row .lang,
.row .theme {
    max-width: 150px;
    font-size: 13px;
    margin: 0;
}

/* ---------- Puzzle: the Trapper's Ledger ---------- */
.pz {
    position: relative;
}
.steps {
    display: flex;
    gap: 6px;
    margin: 6px 0 10px;
}
.stp {
    flex: 1;
    height: 26px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: var(--card);
}
.stp.open {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
    animation: pz-pulse 2s ease-in-out infinite;
}
.stp.solved {
    background: var(--accent);
    color: #1b1206;
    border-color: var(--accent);
}
.parchment {
    background: linear-gradient(135deg, #e8d9b5, #d8c394 60%, #cdb27c);
    color: #3b2a14;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 8px 0;
    box-shadow:
        inset 0 0 18px rgba(80, 50, 10, 0.35),
        0 2px 6px rgba(0, 0, 0, 0.35);
    animation: pz-unroll 0.45s ease-out both;
    transform-origin: top;
}
.parchment .d,
.parchment small {
    color: #5c4424;
}
.parchment.locked {
    filter: grayscale(0.6);
}
.ptitle {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 11px;
    color: #7a5a2c;
    margin-bottom: 6px;
}
.cipher,
.decoded,
.riddle,
.built {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 0.12em;
    word-break: break-word;
    margin: 6px 0;
}
.cipher {
    font-size: 15px;
    color: #4a3414;
}
.decoded {
    min-height: 1.4em;
    font-size: 15px;
    color: #1d3a1d;
    border-top: 1px dashed #8d6d3a;
    padding-top: 6px;
}
.decoded.ink {
    animation: pz-ink 0.5s ease-out;
}
.riddle {
    font-size: 13px;
    letter-spacing: 0.04em;
    font-family: Georgia, serif;
    font-style: italic;
}
.built {
    letter-spacing: 0.35em;
    font-size: 17px;
}
.pz-input {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-family: 'Courier New', monospace;
}
.parchment .amount {
    background: rgba(255, 250, 235, 0.7);
    color: #2b1d0a;
    border-color: #a58450;
}
.dial-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
}
.dial {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 3px solid #7a5a2c;
    background: radial-gradient(circle at 30% 30%, #f5e6b8, #b9954f);
    display: grid;
    place-items: start center;
    transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
    flex-shrink: 0;
}
.dial span {
    color: #7a1f1f;
    font-size: 12px;
    margin-top: 2px;
}
.dial-n {
    font-weight: 700;
    width: 26px;
    text-align: center;
}
.dial-range {
    flex: 1;
    accent-color: #7a5a2c;
}
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.leg {
    display: grid;
    justify-items: center;
    gap: 2px;
    width: 52px;
}
.leg b {
    font-size: 24px;
    height: 34px;
    display: grid;
    place-items: center;
    font-family: Georgia, serif;
}
.print {
    fill: #4a3414;
    stroke: #4a3414;
}
.prints {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pr {
    display: grid;
    gap: 4px;
    justify-items: center;
}
.pr .amount {
    width: 70px;
    padding: 3px 4px;
    font-size: 12px;
}
.plates {
    display: grid;
    gap: 5px;
    max-width: 260px;
    margin: 6px auto;
}
.plate {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px solid #5c4424;
    background: #3a2a14;
    cursor: pointer;
    transition:
        background 0.25s,
        box-shadow 0.25s,
        transform 0.1s;
}
.plate.on {
    background: radial-gradient(circle, #ffd36b, #e0902a);
    box-shadow: 0 0 10px #ffb73a;
}
.plate:active {
    transform: scale(0.92);
}
.plate.hinted {
    outline: 3px dashed #2f7a2f;
}
.ruler {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 2px;
    margin: 6px 0;
}
.rl {
    display: grid;
    justify-items: center;
    border: 1px solid #a58450;
    border-radius: 4px;
    padding: 1px 0;
    background: rgba(255, 250, 235, 0.5);
    transition:
        background 0.2s,
        transform 0.2s;
}
.rl b {
    font-size: 12px;
}
.rl small {
    font-size: 9px;
}
.rl.here {
    background: #ffd36b;
    transform: scale(1.25);
    box-shadow: 0 0 6px #e0902a;
    z-index: 1;
}
.chips .fig {
    background: rgba(255, 250, 235, 0.7);
    color: #2b1d0a;
    border-color: #a58450;
    font-family: 'Courier New', monospace;
    font-weight: 700;
}
.wheels {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
}
.wheel {
    display: grid;
    gap: 4px;
    justify-items: center;
}
.wd {
    width: 42px;
    height: 54px;
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 800;
    font-family: Georgia, serif;
    background: linear-gradient(#1f1a12, #3a2d18, #1f1a12);
    color: #f1d58a;
    border-radius: 6px;
    border: 2px solid #8a6a2c;
}
.wd.roll {
    animation: pz-roll 0.25s ease-out;
}
.hint {
    background: color-mix(in srgb, var(--accent) 18%, var(--card));
    border-left: 3px solid var(--accent);
    padding: 6px 8px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 13px;
}
.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}
.notebook {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    margin: 10px 0;
}
.notebook .ptitle {
    color: var(--muted);
}
.note {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    text-transform: capitalize;
}
.note b {
    color: var(--accent);
    font-size: 16px;
}
.stamp {
    position: absolute;
    inset: 30% 0 auto 0;
    margin: auto;
    width: fit-content;
    padding: 6px 18px;
    font-weight: 900;
    font-size: 30px;
    letter-spacing: 0.15em;
    color: #b32121;
    border: 5px solid #b32121;
    border-radius: 10px;
    transform: rotate(-12deg);
    opacity: 0;
    pointer-events: none;
    animation: pz-stamp 1.6s ease-out forwards;
    background: rgba(255, 250, 235, 0.15);
    z-index: 5;
}
.seal-wrap {
    text-align: center;
    padding: 18px 8px;
}
.seal {
    font-size: 56px;
    animation: pz-seal 1.2s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
.pz.shake0 {
    animation: pz-shake 0.35s;
}
.pz.shake1 {
    animation: pz-shake 0.35s;
}
@keyframes pz-unroll {
    from {
        transform: scaleY(0.2);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}
@keyframes pz-ink {
    from {
        opacity: 0.2;
        filter: blur(3px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}
@keyframes pz-roll {
    from {
        transform: translateY(-12px);
        opacity: 0.3;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
@keyframes pz-stamp {
    0% {
        opacity: 0;
        transform: rotate(-12deg) scale(2.4);
    }
    25% {
        opacity: 1;
        transform: rotate(-12deg) scale(1);
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
@keyframes pz-seal {
    from {
        transform: scale(0) rotate(-60deg);
    }
    to {
        transform: scale(1) rotate(0);
    }
}
@keyframes pz-shake {
    0%,
    100% {
        transform: translateX(0);
    }
    20%,
    60% {
        transform: translateX(-7px);
    }
    40%,
    80% {
        transform: translateX(7px);
    }
}
@keyframes pz-pulse {
    50% {
        box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 12%, transparent);
    }
}
@media (prefers-reduced-motion: reduce) {
    .parchment,
    .decoded.ink,
    .wd.roll,
    .stamp,
    .seal,
    .pz.shake0,
    .pz.shake1,
    .stp.open {
        animation: none;
    }
    .stamp {
        opacity: 1;
    }
    .dial,
    .plate,
    .rl {
        transition: none;
    }
}

.found {
    font-style: normal;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-left: 8px;
    flex: 1;
    text-align: right;
    margin-right: 10px;
}
.watch {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 280px;
    margin: 8px auto;
}
.wtile {
    aspect-ratio: 1;
    font-size: 36px;
    border-radius: 14px;
    border: 3px solid #5c4424;
    background: #3a2a14;
    cursor: pointer;
    transition:
        background 0.15s,
        box-shadow 0.15s,
        transform 0.12s;
}
.wtile.glow {
    background: radial-gradient(circle, #ffe08a, #e0902a);
    box-shadow: 0 0 18px #ffb73a;
    transform: scale(1.08);
}
.watch.busy .wtile {
    cursor: default;
}
.wdots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 6px 0;
}
.wd2 {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #7a5a2c;
}
.wd2.on {
    background: #7a5a2c;
}
.plates {
    max-width: 300px;
}

.polybius {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    max-width: 240px;
    margin: 8px auto;
}
.pc {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    background: rgba(255, 250, 235, 0.6);
    border: 1px solid #a58450;
    border-radius: 4px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}
.pc.head {
    background: transparent;
    border-color: transparent;
    color: #7a5a2c;
    font-size: 11px;
}
.clues {
    margin: 0;
    padding-left: 20px;
    line-height: 1.5;
}
.clues li {
    margin: 4px 0;
}
.notes {
    display: grid;
    grid-template-columns: 54px repeat(5, 1fr);
    gap: 3px;
    align-items: center;
}
.nc {
    aspect-ratio: 1;
    border: 1px solid #a58450;
    border-radius: 4px;
    background: rgba(255, 250, 235, 0.55);
    color: #2b1d0a;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}
.nc.head {
    aspect-ratio: auto;
    border: 0;
    background: transparent;
    font-size: 10px;
    text-align: center;
    color: #5c4424;
    cursor: default;
}
.nc.no {
    background: #d9a39a;
    color: #7a1f1f;
}
.nc.yes {
    background: #a5cf9a;
    color: #1d4d1d;
}
.slots {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}
.slot {
    display: grid;
    gap: 2px;
}
.slot .amount {
    padding: 3px 2px;
    font-size: 11px;
}
.scene {
    position: relative;
    height: 128px;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(#a9c88a, #7da35e);
    border: 2px solid #5c7a3f;
}
.scene .edge {
    position: absolute;
    bottom: 2px;
    font-size: 10px;
    color: #3a5326;
    padding: 0 6px;
}
.scene .edge.l {
    left: 0;
}
.scene .edge.r {
    right: 0;
}
.beast {
    position: absolute;
    font-size: 30px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    transition:
        left 3.2s linear,
        right 3.2s linear;
}
.beast.band-red {
    box-shadow: 0 0 0 3px #d63a3a;
}
.beast.band-blue {
    box-shadow: 0 0 0 3px #3a6ad6;
}
.questions {
    margin-top: 8px;
}
.qq {
    margin: 8px 0;
}
.qq .t {
    font-weight: 600;
    margin-bottom: 4px;
}
.slide {
    display: grid;
    gap: 6px;
    max-width: 240px;
    margin: 8px auto;
}
.stile {
    aspect-ratio: 1;
    font-size: 26px;
    font-weight: 800;
    font-family: Georgia, serif;
    border-radius: 10px;
    border: 3px solid #5c4424;
    color: #f6e7bd;
    cursor: pointer;
    transition: transform 0.12s;
}
.stile:active {
    transform: scale(0.93);
}
.stile.t0 {
    background: #6b4a2b;
}
.stile.t1 {
    background: #4b5f3a;
}
.stile.t2 {
    background: #5b3f6b;
}
.stile.t3 {
    background: #3f5b6b;
}
.stile.gap {
    background: transparent;
    border-style: dashed;
    border-color: #a58450;
    cursor: default;
}
@media (prefers-reduced-motion: reduce) {
    .beast {
        transition: none;
    }
}

/* the zoo */
.zoo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.zoo-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 6px;
    text-align: center;
}
.zoo-card .zi {
    font-size: 28px;
}
.zoo-card .zn {
    font-size: 12px;
    font-weight: 600;
}
.zoo-card .zc {
    color: var(--gold);
    font-weight: 700;
}
.zoo-card .zk {
    font-size: 10px;
    opacity: 0.75;
    text-transform: uppercase;
}
.zoo-card.k-mythical {
    border-color: #b07cff;
}
.zoo-card.k-cryptid {
    border-color: #ff9d4d;
}
.zoo-card.k-great {
    border-color: var(--gold);
}

.zoo-card .zi img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}
.zoo-card .zi {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 72px;
}

/* zoo breeding */
.zoo-card .zs {
    font-size: 11px;
    opacity: 0.8;
}
.breed {
    margin-top: 6px;
}
.breed-pick {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 8px;
    align-items: center;
    margin: 8px 0;
}
.breed-pick label {
    font-size: 18px;
    text-align: center;
}
.egg-card {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid #8a8a8a;
    border-radius: var(--radius);
    padding: 8px 10px;
    margin-bottom: 6px;
}
.egg-card.t2 {
    border-left-color: var(--gold);
}
.egg-card.t3 {
    border-left-color: #ff9d4d;
}
.egg-card.t4 {
    border-left-color: #b07cff;
}
.egg-ico {
    font-size: 30px;
}
.egg-info {
    flex: 1;
    min-width: 0;
}
.egg-info .name {
    font-size: 13px;
    font-weight: 600;
}
.egg-t {
    font-variant-numeric: tabular-nums;
    color: var(--gold);
    font-weight: 700;
    font-size: 13px;
}
.egg-act .btn {
    white-space: nowrap;
}

/* the hatching animation */
.hatch-ov {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(8, 6, 4, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
}
.hatch-stage {
    position: relative;
    width: min(92vw, 340px);
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.egg-wrap {
    position: absolute;
    width: 130px;
    height: 160px;
    transform-origin: 50% 90%;
}
.egg-half {
    position: absolute;
    inset: 0;
    border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
    background: radial-gradient(circle at 35% 30%, #fffdf3 0, #f4e9c8 55%, #d9c690 100%);
    box-shadow: inset -8px -10px 18px rgba(120, 90, 30, 0.35);
}
.egg-half::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image:
        radial-gradient(circle, rgba(120, 80, 30, 0.35) 0 3px, transparent 4px),
        radial-gradient(circle, rgba(120, 80, 30, 0.3) 0 2px, transparent 3px);
    background-size:
        34px 40px,
        23px 29px;
    background-position:
        6px 8px,
        14px 20px;
}
.egg-wrap.t2 .egg-half {
    background: radial-gradient(circle at 35% 30%, #fff8dc 0, #f7dd8f 55%, #c9a13a 100%);
}
.egg-wrap.t3 .egg-half {
    background: radial-gradient(circle at 35% 30%, #fff1e2 0, #ffc58a 55%, #d07a2a 100%);
}
.egg-wrap.t4 .egg-half {
    background: radial-gradient(circle at 35% 30%, #f7eeff 0, #cfa8ff 55%, #7b3fd0 100%);
}
.egg-half.top {
    clip-path: polygon(0 0, 100% 0, 100% 52%, 86% 45%, 71% 57%, 56% 44%, 41% 57%, 26% 45%, 12% 56%, 0 48%);
}
.egg-half.bot {
    clip-path: polygon(0 48%, 12% 56%, 26% 45%, 41% 57%, 56% 44%, 71% 57%, 86% 45%, 100% 52%, 100% 100%, 0 100%);
}
.egg-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 10px;
    margin: -5px;
    border-radius: 50%;
    background: #fff6c8;
    opacity: 0;
    box-shadow: 0 0 40px 20px rgba(255, 230, 140, 0.9);
}
.sparks {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
}
.sparks i {
    position: absolute;
    width: 8px;
    height: 8px;
    margin: -4px;
    border-radius: 50%;
    background: var(--gold);
    opacity: 0;
}
.hatch-pet {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    padding: 0 10px;
    opacity: 0;
    pointer-events: none;
}
.hp-art {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin-bottom: 4px;
}
.hp-art .zi {
    min-height: 0;
}
.hp-art .zi img {
    width: 120px;
    height: 120px;
}
.hp-art .zi + .zi {
    margin-left: -26px;
}
.hp-art .zi {
    font-size: 70px;
}
.hp-tier {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold);
}
.hp-name {
    font-size: 22px;
    font-weight: 800;
}
.hp-msg {
    margin: 8px 0 10px;
    font-weight: 600;
}
.hatch-ov.shake .egg-wrap {
    animation: egg-shake 0.5s ease-in-out infinite;
}
.hatch-ov.crack .egg-wrap {
    animation: egg-shake 0.18s ease-in-out infinite;
}
.hatch-ov.crack .egg-glow {
    opacity: 0.55;
    animation: egg-glow 0.8s ease-in forwards;
}
.hatch-ov.burst .egg-half.top {
    animation: shell-top 0.7s ease-in forwards;
}
.hatch-ov.burst .egg-half.bot {
    animation: shell-bot 0.7s ease-in forwards;
}
.hatch-ov.burst .egg-glow {
    animation: egg-flash 0.5s ease-out forwards;
}
.hatch-ov.burst .sparks i {
    animation: spark 0.9s ease-out forwards;
    animation-delay: var(--t);
}
.hatch-ov.reveal .egg-wrap,
.hatch-ov.reveal .sparks {
    display: none;
}
.hatch-ov.reveal .hatch-pet {
    opacity: 1;
    pointer-events: auto;
    animation: pet-jump 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes egg-shake {
    0%,
    100% {
        transform: rotate(0);
    }
    25% {
        transform: rotate(-9deg) translateX(-3px);
    }
    75% {
        transform: rotate(9deg) translateX(3px);
    }
}
@keyframes egg-glow {
    to {
        opacity: 1;
        transform: scale(3);
    }
}
@keyframes egg-flash {
    0% {
        opacity: 1;
        transform: scale(3);
    }
    100% {
        opacity: 0;
        transform: scale(14);
    }
}
@keyframes shell-top {
    to {
        transform: translate(-70px, -150px) rotate(-55deg);
        opacity: 0;
    }
}
@keyframes shell-bot {
    to {
        transform: translate(40px, 130px) rotate(25deg);
        opacity: 0;
    }
}
@keyframes spark {
    0% {
        opacity: 1;
        transform: rotate(var(--a)) translateX(0);
    }
    100% {
        opacity: 0;
        transform: rotate(var(--a)) translateX(var(--d));
    }
}
@keyframes pet-jump {
    0% {
        transform: translateY(-30%) scale(0.2);
        opacity: 0;
    }
    45% {
        transform: translateY(-78%) scale(1.12);
        opacity: 1;
    }
    70% {
        transform: translateY(-46%) scale(0.96);
    }
    85% {
        transform: translateY(-53%) scale(1.03);
    }
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}
@media (prefers-reduced-motion: reduce) {
    .hatch-ov .egg-wrap,
    .hatch-ov .egg-half,
    .hatch-ov .sparks i,
    .hatch-ov .hatch-pet {
        animation: none !important;
    }
}

/* the pet jumps out with a squash and stretch, a ground shadow and a little 3D tilt */
.hatch-pet {
    perspective: 700px;
}
.hp-tilt {
    transform-style: preserve-3d;
    transition: transform 0.12s ease-out;
}
.hp-own {
    width: 190px;
    height: 190px;
    object-fit: contain;
    filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.45));
}
.hp-shadow {
    width: 120px;
    height: 16px;
    margin: -6px auto 8px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.55), transparent 70%);
}
@keyframes pet-squash {
    0% {
        transform: scale(1.25, 0.6);
    }
    35% {
        transform: scale(0.85, 1.25);
    }
    60% {
        transform: scale(1.1, 0.88);
    }
    80% {
        transform: scale(0.97, 1.04);
    }
    100% {
        transform: scale(1, 1);
    }
}
@keyframes pet-bob {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}
@keyframes shadow-pulse {
    0% {
        transform: scale(1.3);
        opacity: 0.2;
    }
    45% {
        transform: scale(0.5);
        opacity: 0.25;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* the pet bursts out of the egg in an arc, lands with a squash and dust, hops, then idles; the broken shell stays on the ground */
.hatch-ov.reveal .egg-wrap {
    display: block;
    z-index: 0;
    transform: translateY(150px) scale(0.55);
    opacity: 0.95;
}
.hatch-ov.reveal .egg-half.top {
    animation: none;
    transform: translate(-125px, 28px) rotate(-62deg);
    opacity: 1;
}
.hatch-ov.reveal .egg-half.bot {
    animation: none;
    transform: translate(70px, 18px) rotate(7deg);
    opacity: 1;
}
.hatch-ov.reveal .egg-glow {
    display: none;
}
.hatch-pet {
    z-index: 2;
}
.hp-arc,
.hp-idle {
    transform-origin: 50% 100%;
}
.hatch-ov.reveal .hatch-pet {
    animation: none;
}
.hatch-ov.reveal .hp-arc {
    animation: pet-arc 1.5s both;
}
.hatch-ov.reveal .hp-idle {
    animation: pet-idle 6s ease-in-out 1.6s infinite;
}
.hatch-ov.reveal .hp-idle.hop {
    animation: pet-hop 0.7s ease-out;
}
.hatch-ov.reveal .hp-text {
    animation: text-in 0.6s ease-out 1.1s both;
}
.hatch-ov.reveal .hp-shadow {
    animation: shadow-arc 1.5s both;
    position: relative;
}
.hp-shadow i {
    position: absolute;
    left: 50%;
    top: 4px;
    width: 9px;
    height: 9px;
    margin: -4px;
    border-radius: 50%;
    background: rgba(230, 215, 190, 0.8);
    opacity: 0;
}
.hatch-ov.reveal .hp-shadow i {
    animation: dust 0.7s ease-out 0.78s both;
}
@keyframes pet-arc {
    0% {
        transform: translate(0, 170px) scale(0.3);
        opacity: 0;
    }
    8% {
        opacity: 1;
    }
    34% {
        transform: translate(-8px, -80px) scale(1.04, 1.16) rotate(-9deg);
    }
    52% {
        transform: translate(0, 0) scale(1.22, 0.74);
    }
    64% {
        transform: translate(0, -34px) scale(0.93, 1.1) rotate(4deg);
    }
    78% {
        transform: translate(0, 0) scale(1.1, 0.9);
    }
    88% {
        transform: translate(0, -9px) scale(0.99, 1.02);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}
@keyframes pet-idle {
    0%,
    100% {
        transform: scale(1, 1);
    }
    8% {
        transform: scale(1.015, 0.97);
    }
    16% {
        transform: scale(1, 1);
    }
    30% {
        transform: scale(1, 1);
    }
    34% {
        transform: translateY(-22px) scale(0.97, 1.06);
    }
    40% {
        transform: translateY(0) scale(1.08, 0.92);
    }
    46% {
        transform: scale(1, 1);
    }
    62% {
        transform: scaleX(-1);
    }
    80% {
        transform: scaleX(-1);
    }
    86% {
        transform: scale(1, 1);
    }
}
@keyframes pet-hop {
    0% {
        transform: scale(1.1, 0.88);
    }
    35% {
        transform: translateY(-46px) scale(0.92, 1.12) rotate(-5deg);
    }
    70% {
        transform: translateY(0) scale(1.14, 0.86);
    }
    100% {
        transform: scale(1);
    }
}
@keyframes shadow-arc {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    34% {
        opacity: 0.25;
        transform: scale(0.45);
    }
    52% {
        opacity: 1;
        transform: scale(1.25);
    }
    64% {
        transform: scale(0.7);
    }
    78% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}
@keyframes dust {
    0% {
        opacity: 0.9;
        transform: rotate(var(--a)) translateX(10px);
    }
    100% {
        opacity: 0;
        transform: rotate(var(--a)) translateX(64px) scale(1.6);
    }
}
@keyframes text-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    .hatch-ov .hp-arc,
    .hatch-ov .hp-idle,
    .hatch-ov .hp-text,
    .hatch-ov .hp-shadow,
    .hatch-ov .hp-shadow i {
        animation: none !important;
    }
}

/* "Test your skills": the master trials */
.tr-card {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin: 8px 0;
    cursor: pointer;
}
.tr-card.done {
    opacity: 0.7;
    border-color: #4caf50;
}
.tr-ico {
    font-size: 28px;
}
.tr-info {
    flex: 1;
}
.tr-q {
    margin-bottom: 10px;
}
.tr-scroll {
    max-height: 340px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-top: 6px;
}
.tr-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.tr-table th {
    position: sticky;
    top: 0;
    background: #3b2c17;
    color: #f3e9d0;
    text-align: left;
    padding: 5px 6px;
    cursor: pointer;
    white-space: nowrap;
}
.tr-table td {
    padding: 3px 6px;
    border-top: 1px solid var(--line);
    white-space: nowrap;
}
.tr-entry {
    font-size: 12px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--line);
}
.tr-code {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    padding: 8px;
    font-size: 11px;
    overflow-x: auto;
    white-space: pre;
    margin: 6px 0 4px;
}
.tr-layer {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 8px;
    margin: 8px 0;
    opacity: 0.75;
}
.tr-layer.open {
    opacity: 1;
    border-style: solid;
}
.tr-cipher {
    font-family: monospace;
    font-size: 13px;
    letter-spacing: 1px;
    word-break: break-all;
    margin: 6px 0;
}
.tr-grid {
    display: grid;
    width: min(100%, 330px);
    margin: 6px auto 10px;
    border: 2px solid #5a4120;
}
.tr-cell {
    position: relative;
    aspect-ratio: 1;
    border: 1px solid rgba(90, 65, 32, 0.35);
}
.tr-cell.bt {
    border-top: 3px solid #5a4120;
}
.tr-cell.bb {
    border-bottom: 3px solid #5a4120;
}
.tr-cell.bl {
    border-left: 3px solid #5a4120;
}
.tr-cell.br {
    border-right: 3px solid #5a4120;
}
.tr-clue {
    position: absolute;
    left: 3px;
    top: 1px;
    font-size: 10px;
    font-weight: 700;
    color: #6b3f0a;
    pointer-events: none;
}
.tr-cell input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: 0;
    color: inherit;
    text-align: center;
    font-size: 22px;
    padding: 8px 0 0;
}

.tr-maze {
    font-size: 9px;
    line-height: 1;
    letter-spacing: 0;
    overflow-x: auto;
}
.tr-clues {
    margin: 6px 0 0 18px;
    padding: 0;
    font-size: 13px;
}
.tr-clues li {
    margin-bottom: 5px;
}
.tr-line {
    margin-bottom: 8px;
}
.tr-notes td input {
    width: 62px;
    background: transparent;
    border: 0;
    border-bottom: 1px dashed rgba(90, 65, 32, 0.5);
    color: inherit;
    font-size: 11px;
}

/* the physical trials */
.tr-rings,
.tr-dial,
.tr-knot {
    width: min(100%, 360px);
    display: block;
    margin: 0 auto 8px;
    touch-action: none;
}
.tr-ring {
    transform-origin: 0 0;
    transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.tr-dial-g {
    transform-origin: 0 0;
    transition: transform 0.12s ease-out;
}
.tr-links td,
.tr-links th {
    text-align: center;
    padding: 2px 4px;
}
.tr-links .btn {
    padding: 0 8px;
    margin: 0 2px;
}
.btn.glow {
    box-shadow: 0 0 14px 3px rgba(255, 210, 90, 0.85);
}
.tr-beam {
    display: grid;
    width: min(100%, 330px);
    margin: 8px auto;
    border: 2px solid #5a4120;
}
.tr-bc {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    border: 1px solid rgba(90, 65, 32, 0.3);
    color: #3b2c17;
    cursor: pointer;
    transition: background 0.25s;
    user-select: none;
}
.tr-bc.wall {
    background: #6b5a43;
    color: #3b2c17;
    cursor: default;
}
.tr-bc.trap {
    color: #c0392b;
    cursor: default;
}
.tr-bc.target {
    color: #b8860b;
    cursor: default;
}
.tr-bc.lit {
    background: rgba(70, 190, 255, 0.55);
}
.tr-pipes {
    display: grid;
    width: min(100%, 340px);
    margin: 8px auto;
    gap: 1px;
}
.tr-pt {
    aspect-ratio: 1;
    background: rgba(59, 44, 23, 0.25);
    color: #8a7a5a;
    cursor: pointer;
    transition: color 0.3s;
}
.tr-pt.wet {
    color: #2a9df4;
}
.tr-pt.source {
    outline: 2px solid #d4aa3c;
}
.tr-pt-in {
    width: 100%;
    height: 100%;
    transition: transform 0.25s ease-out;
}
.tr-pt svg {
    width: 100%;
    height: 100%;
    display: block;
}
.tr-heat {
    text-align: center;
    font-weight: 700;
    margin: 4px 0 8px;
}
.tr-dial[data-heat='3'] circle:first-child,
.tr-dial[data-heat='4'] circle:first-child {
    stroke: #ff9d4d;
}
.tr-dial[data-heat='5'] circle:first-child {
    stroke: #ffd24a;
    stroke-width: 7;
}
.tr-kn {
    cursor: grab;
}

/* shop deals: the percentage tag next to the name, and the old price struck through */
.tag.deal {
    margin-left: 6px;
    background: #7a2e12;
    color: #ffd9a8;
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.price.deal {
    color: #ffb347;
    font-weight: 700;
}
.price .was {
    color: #8a8a8a;
    font-weight: 400;
    text-decoration: line-through;
}
