/* TCG Idle Collector: plain text and ASCII, in the spirit of Candy Box */

:root {
    --background: #ffffff;
    --text: #111111;
    --muted: #6b6b6b;
    --border: #111111;
    --button-background: #ffffff;
    --button-hover: #eeeeee;
    --good: #1d6b2f;
    --warning: #8a5a00;
    --danger: #b3261e;
    --uncommon: #1d6b2f;
    --rare: #1f4fa8;
    --ultra-rare: #7a2fa8;
    --legendary: #a86a00;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --background: #111111;
        --text: #e8e8e8;
        --muted: #9a9a9a;
        --border: #e8e8e8;
        --button-background: #111111;
        --button-hover: #2a2a2a;
        --good: #6fcf86;
        --warning: #e0b04f;
        --danger: #ff8a80;
        --uncommon: #6fcf86;
        --rare: #8ab4f8;
        --ultra-rare: #c58af9;
        --legendary: #f2c14e;
    }
}

:root[data-theme="dark"] {
    --background: #111111;
    --text: #e8e8e8;
    --muted: #9a9a9a;
    --border: #e8e8e8;
    --button-background: #111111;
    --button-hover: #2a2a2a;
    --good: #6fcf86;
    --warning: #e0b04f;
    --danger: #ff8a80;
    --uncommon: #6fcf86;
    --rare: #8ab4f8;
    --ultra-rare: #c58af9;
    --legendary: #f2c14e;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: "Courier New", Courier, monospace;
    font-size: 15px;
    line-height: 1.5;
}

main {
    max-width: 1040px;
    margin: 0 auto;
    padding: 16px;
}

h1 {
    font-size: 1.4em;
    margin: 0 0 12px;
}

h2 {
    font-size: 1.15em;
    margin: 16px 0 8px;
}

h3 {
    font-size: 1em;
    margin: 16px 0 6px;
}

p {
    margin: 6px 0;
}

button {
    font: inherit;
    color: var(--text);
    background: var(--button-background);
    border: 1px solid var(--border);
    padding: 2px 8px;
    margin: 2px 0;
    cursor: pointer;
}

button:hover:not(:disabled) {
    background: var(--button-hover);
}

button:disabled {
    color: var(--muted);
    border-color: var(--muted);
    cursor: default;
}

button.current {
    font-weight: bold;
    border-width: 2px;
}

#locations {
    margin: 12px 0;
}

#scene,
#reveal {
    margin: 12px 0;
}

/* The game on the left, the log on the right */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 32px;
    align-items: start;
}

/* The log stays in view while the game column scrolls */
#log-column {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    border-left: 1px dashed var(--muted);
    padding-left: 16px;
}

#log-toggle {
    display: none;
}

/* On phones the log is a strip at the top showing the newest line */
@media (max-width: 760px) {
    .layout {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    #log-column {
        order: -1;
        top: 0;
        z-index: 1;
        display: flex;
        align-items: flex-start;
        gap: 8px;
        max-height: 60vh;
        overflow-y: auto;
        margin: 0 -16px;
        padding: 8px 16px;
        border-left: none;
        border-bottom: 1px dashed var(--muted);
        background: var(--background);
    }

    #log {
        flex: 1;
    }

    #log-column:not(.expanded) .message:not(:first-child) {
        display: none;
    }

    #log-toggle {
        display: inline-block;
        flex-shrink: 0;
    }

    /* Three pockets across still fit on a phone, and so do the wide
       places, like Gus's store and the cubicle */
    .pockets {
        gap: 4px;
        font-size: 12px;
    }

    .wide {
        font-size: 11px;
    }
}

/*
 * Parts of ASCII art that can be pressed, like the machine's slots. They look
 * like keys: outlined, with a shadow underneath that goes away when pressed.
 * Shadows don't take up space, so the art stays lined up.
 */
.art-button {
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 2px;
    font: inherit;
    font-weight: bold;
    line-height: inherit;
    background: var(--button-background);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--border), 0 1px 0 1px var(--border);
    cursor: pointer;
}

.art-button:hover:not(:disabled),
.art-button:focus-visible {
    background: var(--text);
    color: var(--background);
}

.art-button:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 0 0 1px var(--border);
}

.art-button.special {
    color: var(--legendary);
}

.art-button.special:hover:not(:disabled),
.art-button.special:focus-visible {
    background: var(--legendary);
    color: var(--background);
}

/*
 * Parts of a place's art that can be looked at closer, like the shelves at
 * Gus's. The room is drawn faintly and the parts in full, so they stand
 * out. A part drawn over several lines is several buttons; they light up
 * together.
 */
.store {
    color: var(--muted);
}

.art-area {
    padding: 0;
    margin: 0;
    border: none;
    font: inherit;
    font-weight: bold;
    line-height: inherit;
    background: none;
    color: var(--text);
    cursor: pointer;
}

.art-area.current,
.art-area:focus-visible,
.store:has(.area-shelves:hover) .area-shelves,
.store:has(.area-board:hover) .area-board,
.store:has(.area-gus:hover) .area-gus,
.store:has(.area-case:hover) .area-case,
.store:has(.area-table:hover) .area-table {
    background: var(--text);
    color: var(--background);
}

/* A button that steps back, like "Something else" */
.quiet {
    color: var(--muted);
}

/* A newer set's packs, in summer */
.art-button.new-set {
    color: var(--good);
}

.art-button.new-set:hover:not(:disabled),
.art-button.new-set:focus-visible {
    background: var(--good);
    color: var(--background);
}

/* A slot the player can't afford yet: still a key, just not a pressable one */
.art-button:disabled {
    font-weight: normal;
    background: none;
    color: var(--muted);
    box-shadow: 0 0 0 1px var(--muted);
    cursor: not-allowed;
}

.art {
    margin: 8px 0;
    font-family: inherit;
    line-height: 1.2;
    overflow-x: auto;
}

.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.card {
    margin: 0;
}

/* A binder page: nine pockets, three by three */
.pockets {
    display: grid;
    grid-template-columns: repeat(3, max-content);
    gap: 4px 8px;
    margin: 8px 0;
}

.pocket {
    margin: 0;
}

.pages {
    margin-top: 4px;
}

.checklist {
    margin: 0;
    padding-left: 20px;
}

/* A set's checklist: numbered, in as many columns as fit. Long names are
   cut short; the full name is in the item's title. */
.checklist-grid {
    list-style: none;
    padding-left: 0;
    columns: 11em;
    column-gap: 16px;
}

.checklist-grid li {
    break-inside: avoid;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.new-card {
    margin: 2px 0;
}

.muted {
    color: var(--muted);
}

.good {
    color: var(--good);
}

.warning {
    color: var(--warning);
}

.danger {
    color: var(--danger);
}

.uncommon {
    color: var(--uncommon);
}

.rare {
    color: var(--rare);
}

.ultra-rare {
    color: var(--ultra-rare);
}

.legendary {
    color: var(--legendary);
}

/* A clear gap between messages, so wrapped ones don't run together */
.message {
    margin: 0 0 12px;
}

/* The season, as a tag beside the title */
.season-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 0 8px;
    border: 1px solid var(--muted);
    color: var(--muted);
    font-size: 0.55em;
    font-weight: normal;
    letter-spacing: 0.2em;
    vertical-align: middle;
}

.season-tag:empty {
    display: none;
}

.new {
    color: var(--good);
    font-size: 0.85em;
}

.encounter {
    margin: 8px 0;
}

.card.shiny {
    text-shadow: 0 0 6px currentColor;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.dev {
    border: 1px dashed var(--muted);
    padding: 4px 8px;
}

.ending {
    margin-top: 24px;
}
