/* Wickathou · Tarot */

[hidden] { display: none !important; }

:root {
    --bg: #202328;
    --bg-soft: #2b2f36;
    --bg-deep: #17191d;
    --line: #343a44;
    --text: #e9ecf1;
    --muted: #98a0ac;
    --accent: #6650fa;
    --accent-soft: #3d3a75;
    --good: #4fd08c;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

a { color: inherit; }

h1 { font-size: 28px; margin: 8px 0 8px; }
h2 { font-size: 18px; margin: 4px 0 12px; }
h1 + .muted, h1 + .meta-line { margin-top: 0; }

main {
    max-width: 1040px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

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

/* Header/footer */
header.site {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 1040px;
    margin: 0 auto;
    padding: 18px 20px 0;
}
header.site .brand {
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
    letter-spacing: 0.02em;
}
header.site nav { display: flex; gap: 18px; }
header.site nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
}
header.site nav a:hover { color: var(--text); }

footer {
    max-width: 1040px;
    margin: 0 auto;
    padding: 16px 20px 32px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 14px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 64px;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text);
}
.btn.ghost:hover { border-color: var(--muted); }

.cta-row {
    display: flex;
    gap: 12px;
    align-wrap: wrap;
    flex-wrap: wrap;
    align-items: center;
    margin: 20px 0;
}

/* Hero */
.hero { text-align: center; padding: 24px 0 8px; }
.hero pre.hero-art {
    display: inline-block;
    text-align: left;
    background: var(--bg-deep);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 22px;
    color: var(--text);
    font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
    line-height: 1.25;
}
.hero h1 { font-size: 32px; }
.hero p { max-width: 640px; margin: 10px auto; color: var(--muted); text-align: center; }
.hero .cta-row { justify-content: center; }

/* Library */
.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 16px 0;
}
.filters a {
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 64px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
}
.filters a:hover { color: var(--text); }
.filters a.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.filters .count { opacity: 0.7; font-size: 12px; margin-left: 4px; }

form.search {
    display: flex;
    gap: 8px;
    margin: 18px 0 24px;
    max-width: 560px;
}
form.search input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
}
form.search input:focus { outline: none; border-color: var(--accent); }

ul.deck {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}
.mini-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    padding: 14px 16px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
    transition: border-color 0.15s ease;
}
.mini-card:hover { border-color: var(--accent); }
.mini-card .rank {
    font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
    color: var(--accent);
    font-size: 13px;
    letter-spacing: 0.08em;
}
.mini-card .nm { font-weight: 600; font-size: 16px; }
.mini-card .tag {
    align-self: flex-start;
    font-size: 12px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 64px;
    padding: 2px 10px;
}
.mini-card .kw {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: auto;
}

/* Card detail */
.meta-line { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
    font-size: 12.5px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 64px;
    padding: 2px 10px;
    background: var(--bg-soft);
}
.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 20px 0;
}
@media (max-width: 780px) {
    .panels { grid-template-columns: 1fr; }
}
.panel {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 20px;
}
pre.card-art {
    margin: 0 0 12px;
    padding: 12px 14px;
    background: var(--bg-deep);
    border-radius: 10px;
    overflow-x: auto;
    font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
    font-size: 14px;
    line-height: 1.22;
    color: #d7dce5;
}
ul.chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    margin: 0 0 10px;
}
ul.chips li {
    font-size: 12.5px;
    background: var(--accent-soft);
    color: #cbc6ff;
    border-radius: 64px;
    padding: 3px 10px;
}

/* Reader */
.reader { max-width: 780px; }
.reader form { margin: 18px 0 8px; }
.row2 { display: flex; gap: 12px; flex-wrap: wrap; }
.row2 .field { min-width: 240px; }
.row2 .field.grow { flex: 1; }
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13.5px;
    color: var(--muted);
}
.field select,
.field input {
    padding: 10px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
}
.field select:focus, .field input:focus { outline: none; border-color: var(--accent); }

.slot .controls { position: relative; }

.dd {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--bg-deep);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    max-height: 292px;
    overflow-y: auto;
    padding: 4px;
}
.dd .opt {
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dd .opt.on { background: var(--accent-soft); }
.dd .opt .nm { font-size: 14.5px; font-weight: 600; }
.dd .opt .sub { font-size: 12px; color: var(--muted); }
.dd .ddempty {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--muted);
}
.dd mark {
    background: rgba(102, 80, 250, 0.42);
    color: #fff;
    border-radius: 3px;
    padding: 0 1px;
}

.count-line {
    font-size: 13px;
    margin: -10px 0 14px;
}

ol.slots {
    list-style: none;
    counter-reset: slot;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.slot {
    counter-increment: slot;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
}
.slot::before {
    content: counter(slot) ". " attr(data-pos);
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 8px;
}
.slot .controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.slot input.card-pick {
    flex: 1;
    min-width: 200px;
    padding: 9px 12px;
    background: var(--bg-deep);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-size: 14.5px;
}
.slot input.card-pick:focus { outline: none; border-color: var(--accent); }
.slot .orient {
    display: flex;
    border: 1px solid var(--line);
    border-radius: 64px;
    overflow: hidden;
}
.slot .orient button {
    padding: 7px 14px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 13.5px;
    cursor: pointer;
}
.slot .orient button.on {
    background: var(--accent);
    color: #fff;
}
.slot .rm {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
}
.slot .rm:hover { color: #ff8d8d; border-color: #ff8d8d; }

.slot .preview {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}
.slot .preview p.meaning { margin: 10px 0 0; font-size: 14.5px; color: var(--text); }
.slot .preview .link-row { margin-top: 8px; font-size: 13.5px; }
.slot .preview .link-row a { color: var(--accent); text-decoration: none; }

.prompt-panel { margin-top: 8px; }
.prompt-panel textarea {
    width: 100%;
    background: var(--bg-deep);
    color: #d7dce5;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
    font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
    font-size: 13.5px;
    line-height: 1.5;
    resize: vertical;
}
#copied.on { color: var(--good); }
#build-hint.warn { color: #ffb570; }
