:root {
    color-scheme: dark;
    --tm-green: #39ff14;
    --tm-green-hover: #63ff46;
    --tm-green-soft: rgba(57, 255, 20, .09);
    --tm-bg: #121212;
    --tm-header: #090909;
    --tm-panel: #181818;
    --tm-panel-2: #141414;
    --tm-panel-3: #202020;
    --tm-border: #2d2d2d;
    --tm-border-soft: #232323;
    --tm-text: #f4f4f4;
    --tm-muted: #989898;
    --tm-danger: #ff6161;
    --tm-warning: #ffc857;
    --tm-radius: 10px;
    --tm-shadow: 0 20px 55px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; background: var(--tm-bg); }
body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 50% 18%, rgba(57, 255, 20, .045), transparent 30%),
        var(--tm-bg);
    color: var(--tm-text);
    font-family: Arial, Helvetica, sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

/* Header — ten sam język wizualny co TwójMecz */
.tm-header {
    position: relative;
    z-index: 1000;
    width: 100%;
    min-height: 72px;
    padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 18px;
    border-bottom: 1px solid #272727;
    background: var(--tm-header);
}
.tm-header-left, .tm-header-actions { min-width: 0; display: flex; align-items: center; }
.tm-brand {
    min-height: 71px;
    padding: 7px 4px;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    text-decoration: none;
}
.tm-brand-mark {
    width: 45px;
    height: 45px;
    display: grid;
    place-items: center;
    flex: 0 0 45px;
    border: 1px solid rgba(57, 255, 20, .5);
    border-radius: 10px;
    background: #111;
    color: var(--tm-green);
    box-shadow: 0 0 18px rgba(57, 255, 20, .12);
    font-size: 21px;
    transition: transform .2s ease, border-color .2s ease;
}
.tm-brand:hover .tm-brand-mark { transform: scale(1.05); border-color: var(--tm-green); }
.tm-brand-copy { display: grid; gap: 3px; line-height: 1; white-space: nowrap; }
.tm-brand-title { color: #fff; font-size: 21px; font-weight: 900; letter-spacing: -.4px; }
.tm-brand-title span { color: var(--tm-green); }
.tm-brand-by { color: #707070; font-size: 9px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
.tm-brand-by strong { color: #a8a8a8; }

.tm-header-nav { min-width: 0; display: flex; align-items: stretch; justify-content: center; overflow: hidden; }
.tm-header-nav-link {
    position: relative;
    min-width: 0;
    padding: 0 clamp(12px, 1.5vw, 24px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-right: 1px solid #202020;
    background: transparent;
    color: #e8e8e8;
    text-decoration: none;
    font-size: clamp(10px, .85vw, 13px);
    font-weight: 850;
    letter-spacing: .55px;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    transition: color .18s ease, background .18s ease;
}
.tm-header-nav-link:first-child { border-left: 1px solid #202020; }
.tm-header-nav-link::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--tm-green);
    transform: scaleX(0);
    transition: transform .18s ease;
}
.tm-header-nav-link:hover, .tm-header-nav-link:focus-visible, .tm-header-nav-link.is-active { background: #111; color: var(--tm-green); }
.tm-header-nav-link:hover::after, .tm-header-nav-link:focus-visible::after, .tm-header-nav-link.is-active::after { transform: scaleX(1); }
.tm-header-nav-link i { margin-left: 6px; flex: 0 0 auto; font-size: .88em; line-height: 1; }

.tm-header-actions { justify-content: flex-end; gap: 12px; }
.tm-today { color: #8f8f8f; font-size: 12px; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.tm-user-menu { position: relative; }
.tm-user-menu summary { list-style: none; }
.tm-user-menu summary::-webkit-details-marker { display: none; }
.tm-user-menu-button {
    min-height: 40px;
    max-width: 190px;
    padding: 7px 11px 7px 7px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    background: #151515;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.tm-user-menu[open] .tm-user-menu-button, .tm-user-menu-button:hover { border-color: var(--tm-green); background: #1b1b1b; }
.tm-user-menu-button > i { color: #707070; font-size: 10px; }
.tm-avatar {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    border-radius: 6px;
    background: var(--tm-green);
    color: #050505;
    font-size: 12px;
    font-weight: 900;
}
.tm-user-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-user-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 10000;
    width: min(270px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid #2b2b2b;
    border-radius: 12px;
    background: #0f1115;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .72);
}
.tm-user-dropdown-head { padding: 15px 17px; display: grid; gap: 4px; border-bottom: 1px solid #1d2025; background: #14171c; }
.tm-user-dropdown-head strong { font-size: 14px; }
.tm-user-dropdown-head small { color: #777; }
.tm-user-dropdown a, .tm-user-dropdown button {
    width: 100%;
    min-height: 47px;
    padding: 12px 17px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 0;
    border-bottom: 1px solid #1a1d24;
    background: transparent;
    color: #ddd;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.tm-user-dropdown a:hover, .tm-user-dropdown button:hover { background: #1a1d24; color: #fff; }
.tm-user-dropdown i { width: 17px; color: var(--tm-green); text-align: center; }
.tm-user-dropdown form button { color: #ff7272; border-bottom: 0; }
.tm-user-dropdown form button i { color: #ff7272; }

/* Główny dashboard */
.dashboard-shell { width: min(1040px, calc(100% - 32px)); margin: 0 auto; padding: 30px 0 48px; }
.setup-alert {
    max-width: 780px;
    margin: 0 auto 18px;
    padding: 13px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 97, 97, .35);
    border-left: 4px solid var(--tm-danger);
    border-radius: 8px;
    background: rgba(255, 97, 97, .06);
}
.setup-alert i { color: var(--tm-danger); }
.setup-alert div { display: grid; gap: 2px; }
.setup-alert span { color: var(--tm-muted); font-size: 13px; }
.setup-alert code { color: #fff; }

.player-strip {
    width: min(780px, 100%);
    margin: 0 auto 16px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: repeat(3, auto) minmax(210px, 1fr);
    align-items: center;
    gap: 4px;
    border: 1px solid #292929;
    border-radius: 9px;
    background: rgba(20, 20, 20, .94);
}
.player-strip-item {
    min-width: 120px;
    padding: 5px 14px;
    display: flex;
    align-items: center;
    gap: 9px;
    border-right: 1px solid #292929;
}
.player-strip-item i { width: 17px; color: var(--tm-green); text-align: center; }
.player-strip-item span { display: grid; gap: 2px; }
.player-strip small { color: #737373; font-size: 9px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; }
.player-strip strong { color: #f2f2f2; font-size: 14px; }
.player-xp { min-width: 0; padding: 3px 8px 3px 14px; }
.player-xp-copy { margin-bottom: 7px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.player-xp-copy > span { display: grid; gap: 2px; }
.player-xp-copy > small { color: #777; font-size: 10px; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.progress { height: 4px; overflow: hidden; border-radius: 999px; background: #303030; }
.progress span { width: 0; height: 100%; display: block; border-radius: inherit; background: var(--tm-green); transition: width .35s ease; }

.quest-stage { display: grid; place-items: center; }
.quest-panel {
    width: min(780px, 100%);
    min-height: 410px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid #303030;
    border-top: 3px solid var(--tm-green);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(57, 255, 20, .025), transparent 28%),
        #171717;
    box-shadow: var(--tm-shadow);
}
.quest-loading, .fatal-card, .empty-quest { width: 100%; padding: 56px 42px; display: grid; place-items: center; text-align: center; }
.quest-loading { gap: 14px; color: var(--tm-muted); }
.loader { width: 30px; height: 30px; border: 3px solid #303030; border-top-color: var(--tm-green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-quest { max-width: 680px; margin: auto; }
.quest-symbol, .quest-heading-icon, .mystery-box {
    width: 64px;
    height: 64px;
    margin-bottom: 18px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(57, 255, 20, .35);
    border-radius: 12px;
    background: #111;
    color: var(--tm-green);
    box-shadow: 0 0 24px rgba(57, 255, 20, .08);
    font-size: 29px;
    font-weight: 900;
}
.eyebrow { color: var(--tm-green); font-size: 10px; font-weight: 900; letter-spacing: 1.7px; text-transform: uppercase; }
.empty-quest h2, .quest-card h2, .fatal-card h2 { margin: 11px 0 12px; color: #fff; font-size: clamp(26px, 4vw, 38px); line-height: 1.12; letter-spacing: -.8px; }
.empty-quest p { max-width: 590px; margin: 0 0 25px; color: #aaa; font-size: 15px; line-height: 1.65; }
.empty-note { margin-top: 15px; color: #686868; font-size: 11px; }

.quest-card { width: 100%; min-height: 410px; padding: 28px 42px 34px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.quest-card-top { width: 100%; margin-bottom: 17px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px 12px; }
.category-badge, .difficulty, .xp-badge {
    min-height: 29px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .5px;
    text-transform: uppercase;
    line-height: 1.15;
    white-space: nowrap;
}
.category-badge { border: 1px solid #353535; background: #202020; color: #cfcfcf; }
.difficulty { border: 1px solid #353535; background: #121212; color: #aaa; }
.difficulty-łatwa { color: #91ef80; border-color: rgba(145, 239, 128, .28); }
.difficulty-średnia { color: #ffd166; border-color: rgba(255, 209, 102, .28); }
.difficulty-trudna { color: #ff8b7b; border-color: rgba(255, 139, 123, .28); }
.difficulty-epicka { color: #dba8ff; border-color: rgba(219, 168, 255, .28); }
.quest-heading-icon { width: 54px; height: 54px; margin-bottom: 13px; font-size: 25px; }
.quest-card h2 { max-width: 690px; font-size: clamp(27px, 4vw, 39px); }
.quest-description { max-width: 660px; margin: 0; color: #aaa; font-size: 15px; line-height: 1.65; }
.quest-core-meta { margin-top: 23px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.quest-core-meta > span, .quest-extra-meta > span {
    min-height: 32px;
    padding: 7px 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #303030;
    border-radius: 6px;
    background: #121212;
    color: #b4b4b4;
    font-size: 11px;
    font-weight: 700;
}
.quest-core-meta i, .quest-extra-meta i { color: var(--tm-green); }
.xp-badge { min-height: 32px; border: 1px solid var(--tm-green); background: var(--tm-green); color: #070707; }
.quest-details { width: min(620px, 100%); margin-top: 17px; }
.quest-details summary { color: #7e7e7e; font-size: 11px; font-weight: 700; cursor: pointer; }
.quest-details summary:hover { color: #cfcfcf; }
.quest-details-content { margin-top: 12px; padding-top: 13px; border-top: 1px solid #292929; }
.quest-extra-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.safety-note { margin: 12px auto 0; padding: 10px 12px; border-left: 3px solid var(--tm-warning); background: rgba(255, 200, 87, .05); color: #b9a985; font-size: 12px; line-height: 1.5; text-align: left; }
.quest-actions { margin-top: 24px; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.completed-message { margin-top: 24px; display: grid; gap: 4px; color: #aaa; }
.completed-message strong { color: var(--tm-green); font-size: 18px; }
.quest-card.completed { background: linear-gradient(180deg, rgba(57, 255, 20, .04), transparent 55%); }

.primary-button, .secondary-button, .text-button {
    border: 0;
    text-decoration: none;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.primary-button, .secondary-button {
    min-height: 43px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 850;
}
.primary-button { border: 1px solid var(--tm-green); background: var(--tm-green); color: #050505; }
.primary-button:hover { background: var(--tm-green-hover); transform: translateY(-1px); }
.secondary-button { border: 1px solid #3b3b3b; background: #202020; color: #e8e8e8; }
.secondary-button:hover { border-color: var(--tm-green); color: var(--tm-green); }
.primary-button:disabled, .secondary-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.primary-button.full { width: 100%; }
.draw-button { min-width: 230px; }
.text-button { padding: 0; background: transparent; color: var(--tm-green); font-size: 12px; font-weight: 800; }
.text-button:hover { color: var(--tm-green-hover); }
.compact-button { min-height: 38px; padding: 8px 13px; }

.utility-row { width: min(780px, 100%); margin: 14px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.utility-panel { overflow: hidden; border: 1px solid #292929; border-radius: 9px; background: #151515; }
.utility-panel > summary {
    min-height: 52px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    list-style: none;
    color: #d5d5d5;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.utility-panel > summary::-webkit-details-marker { display: none; }
.utility-panel > summary span { display: flex; align-items: center; gap: 9px; }
.utility-panel > summary span i { color: var(--tm-green); }
.utility-chevron { color: #676767; font-size: 10px; transition: transform .18s ease; }
.utility-panel[open] .utility-chevron { transform: rotate(180deg); }
.utility-panel[open] { grid-column: 1 / -1; }
.utility-content { padding: 17px; border-top: 1px solid #272727; }
.utility-head { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.utility-head p { margin: 0; color: #7f7f7f; font-size: 12px; }
.filters-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.filters-form label, .auth-form label { display: grid; gap: 7px; }
.filters-form label > span, .auth-form label > span { color: #bcbcbc; font-size: 11px; font-weight: 750; }
select, input, textarea {
    width: 100%;
    border: 1px solid #393939;
    border-radius: 7px;
    outline: none;
    background: #1e1e1e;
    color: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}
select, input { min-height: 43px; padding: 10px 11px; }
textarea { min-height: 110px; padding: 12px; resize: vertical; }
select:focus, input:focus, textarea:focus { border-color: var(--tm-green); box-shadow: 0 0 0 3px rgba(57, 255, 20, .08); }
select:disabled, input:disabled { opacity: .55; }
.checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.check { min-height: 36px; padding: 7px 10px; display: inline-flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 8px !important; border: 1px solid #303030; border-radius: 6px; background: #121212; cursor: pointer; }
.check input { width: 15px; min-height: 15px; accent-color: var(--tm-green); }
.check span { color: #aaa !important; }

.history-list { display: grid; gap: 7px; }
.history-item { min-height: 58px; padding: 9px 11px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid #292929; border-radius: 7px; background: #121212; }
.history-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; background: #202020; font-size: 16px; }
.history-main { min-width: 0; display: grid; gap: 3px; }
.history-main small { color: #707070; font-size: 10px; }
.history-main strong { overflow: hidden; color: #ddd; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.history-result { display: grid; gap: 3px; justify-items: end; font-size: 10px; font-weight: 800; }
.history-result strong { color: var(--tm-green); }
.status-ukończony { color: #80e26e; }
.status-pominięty, .status-anulowany { color: #ff7b7b; }
.status-wylosowany, .status-zaakceptowany { color: #e5c166; }
.history-empty { padding: 24px; color: #777; font-size: 12px; text-align: center; }

.footer { min-height: 54px; padding: 14px 20px; display: flex; align-items: center; justify-content: center; gap: 8px; border-top: 1px solid #232323; background: #0e0e0e; color: #666; font-size: 11px; }
.footer a { color: #9f9f9f; text-decoration: none; font-weight: 800; }
.footer a:hover { color: var(--tm-green); }
.footer-dot { color: #393939; }

/* Modal */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 20000; display: grid; place-items: center; padding: 18px; opacity: 0; transition: opacity .18s ease; }
.modal.visible { opacity: 1; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .76); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(460px, 100%); padding: 27px; border: 1px solid #343434; border-top: 3px solid var(--tm-green); border-radius: 11px; background: #181818; box-shadow: 0 25px 70px rgba(0, 0, 0, .7); transform: translateY(8px); transition: transform .18s ease; }
.modal.visible .modal-card { transform: translateY(0); }
.modal-card h2 { margin: 8px 0 6px; font-size: 25px; }
.modal-card > p { margin: 0 0 18px; color: var(--tm-muted); font-size: 13px; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #373737; border-radius: 7px; background: #202020; color: #aaa; cursor: pointer; }
.modal-close:hover { color: #fff; border-color: #555; }
.rating-row { margin: 15px 0 19px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #aaa; font-size: 12px; }
.stars { display: flex; gap: 2px; }
.stars button { padding: 0; border: 0; background: transparent; color: #3f3f3f; font-size: 24px; cursor: pointer; }
.stars button.active { color: #ffd166; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 30000; max-width: min(410px, calc(100vw - 40px)); padding: 13px 16px; border: 1px solid #353535; border-left: 4px solid var(--tm-green); border-radius: 8px; background: #1b1b1b; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .65); font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transform: translateY(15px); transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: var(--tm-danger); }
.fatal-card span { color: var(--tm-danger); font-size: 32px; }
.fatal-card p { max-width: 580px; color: #aaa; line-height: 1.55; }

/* Logowanie / rejestracja */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 34px 18px; background: radial-gradient(circle at 50% 12%, rgba(57, 255, 20, .055), transparent 28%), #121212; }
.auth-shell { width: min(520px, 100%); }
.auth-brand { margin: 0 auto 18px; display: flex; justify-content: center; }
.auth-card { padding: 28px; border: 1px solid #303030; border-top: 3px solid var(--tm-green); border-radius: 11px; background: #181818; box-shadow: var(--tm-shadow); }
.auth-card-wide { width: min(600px, calc(100vw - 36px)); margin-left: 50%; transform: translateX(-50%); }
.auth-card h1 { margin: 8px 0 7px; font-size: 28px; }
.auth-card > p { margin: 0 0 21px; color: #8e8e8e; font-size: 13px; line-height: 1.55; }
.auth-form { display: grid; gap: 14px; }
.auth-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-switch { margin: 18px 0 0 !important; color: #777 !important; text-align: center; }
.auth-switch a { color: var(--tm-green); font-weight: 800; text-decoration: none; }
.form-alert { margin-bottom: 15px; padding: 11px 12px; border: 1px solid #353535; border-left: 4px solid; border-radius: 7px; font-size: 12px; line-height: 1.45; }
.form-alert.success { border-left-color: var(--tm-green); background: rgba(57, 255, 20, .05); color: #b9eeb0; }
.form-alert.error { border-left-color: var(--tm-danger); background: rgba(255, 97, 97, .05); color: #ffaaaa; }

/* Konto */
.account-main { width: min(940px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 48px; }
.account-hero { padding: 22px 24px; display: flex; align-items: center; gap: 17px; border: 1px solid #2d2d2d; border-top: 3px solid var(--tm-green); border-radius: 10px; background: #181818; }
.profile-avatar { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 58px; border-radius: 9px; background: var(--tm-green); color: #050505; font-size: 23px; font-weight: 900; }
.account-hero h1 { margin: 5px 0 4px; font-size: 27px; }
.account-hero p { margin: 0; color: #858585; font-size: 12px; }
.account-alert { margin: 14px 0 0; }
.account-stats { margin-top: 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.account-stats article { padding: 14px; border: 1px solid #2b2b2b; border-radius: 8px; background: #151515; }
.account-stats small { display: block; margin-bottom: 5px; color: #707070; font-size: 9px; font-weight: 850; letter-spacing: .7px; }
.account-stats strong { font-size: 18px; }
.account-grid { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.account-card { padding: 22px; border: 1px solid #2d2d2d; border-radius: 9px; background: #181818; }
.account-card h2 { margin: 7px 0 18px; font-size: 21px; }

/* Wyrównanie emoji i ikon w kwadratach */
.tm-brand-mark,
.tm-avatar,
.quest-symbol,
.quest-heading-icon,
.mystery-box,
.history-icon,
.profile-avatar,
.modal-close {
    padding: 0;
    display: inline-grid;
    place-items: center;
    overflow: hidden;
    line-height: 1;
    text-align: center;
    vertical-align: middle;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", Arial, sans-serif;
    font-variant-emoji: emoji;
}

.tm-brand-mark > i,
.tm-avatar > i,
.quest-symbol > i,
.quest-heading-icon > i,
.mystery-box > i,
.history-icon > i,
.profile-avatar > i,
.modal-close > i {
    width: 1em;
    height: 1em;
    margin: 0;
    display: grid;
    place-items: center;
    line-height: 1;
    text-align: center;
}

/* Kolorowe emoji mają inne metryki niż zwykły tekst — ten drobny offset
   wizualnie centruje je w Chrome/Edge na Windowsie. */
.quest-heading-icon,
.history-icon,
.quest-symbol {
    text-indent: 0;
}

.quest-heading-icon:not(:has(i)),
.history-icon:not(:has(i)),
.quest-symbol:not(:has(i)) {
    padding-bottom: 1px;
}

.category-badge,
.quest-core-meta > span,
.quest-extra-meta > span,
.utility-panel > summary span {
    line-height: 1.2;
}

.category-badge {
    text-align: center;
}

/* Focus */
:focus-visible { outline: 2px solid var(--tm-green); outline-offset: 2px; }

@media (max-width: 980px) {
    .tm-header { grid-template-columns: auto 1fr auto; gap: 8px; padding-left: 12px; padding-right: 12px; }
    .tm-brand-by { display: none; }
    .tm-header-nav-link { padding: 0 10px; font-size: 10px; }
    .tm-today { display: none; }
    .player-strip { grid-template-columns: repeat(3, 1fr); }
    .player-strip-item { min-width: 0; border-right: 0; justify-content: center; }
    .player-xp { grid-column: 1 / -1; padding: 9px 7px 3px; border-top: 1px solid #292929; }
}

@media (max-width: 700px) {
    .tm-header { min-height: 64px; grid-template-columns: 1fr auto; align-items: center; padding-top: env(safe-area-inset-top); }
    .tm-brand { min-height: 63px; }
    .tm-brand-mark { width: 39px; height: 39px; flex-basis: 39px; font-size: 18px; }
    .tm-brand-title { font-size: 19px; }
    .tm-header-nav { position: fixed; right: 12px; bottom: 12px; left: 12px; z-index: 9000; min-height: 54px; border: 1px solid #303030; border-radius: 10px; background: rgba(9, 9, 9, .96); box-shadow: 0 14px 35px rgba(0, 0, 0, .6); }
    .tm-header-nav-link { flex: 1 1 0; min-width: 0; padding: 0 5px; border: 0 !important; font-size: 8.5px; letter-spacing: .28px; }
    .tm-header-nav-link i { margin-left: 4px; font-size: 8px; }
    .tm-user-menu-name { display: none; }
    .tm-user-menu-button { padding-right: 7px; }
    .tm-user-menu-button > i { display: none; }
    .dashboard-shell { width: min(100% - 20px, 780px); padding-top: 18px; padding-bottom: 90px; }
    .player-strip { grid-template-columns: repeat(3, 1fr); padding: 8px; }
    .player-strip-item { padding: 5px 4px; display: grid; justify-items: center; gap: 4px; text-align: center; }
    .player-strip-item i { font-size: 13px; }
    .player-strip strong { font-size: 12px; }
    .player-strip small { font-size: 8px; }
    .quest-panel { min-height: 390px; border-radius: 10px; }
    .quest-card, .empty-quest, .quest-loading, .fatal-card { padding: 30px 18px; }
    .quest-card-top { margin-bottom: 15px; }
    .quest-heading-icon { width: 48px; height: 48px; font-size: 23px; }
    .quest-card h2, .empty-quest h2 { font-size: 27px; }
    .quest-description { font-size: 14px; }
    .quest-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
    .quest-actions button { width: 100%; }
    .utility-row { grid-template-columns: 1fr; }
    .utility-panel[open] { grid-column: auto; }
    .filters-form { grid-template-columns: 1fr; }
    .checks { grid-column: auto; }
    .utility-head { align-items: flex-start; }
    .history-item { grid-template-columns: 34px minmax(0, 1fr); }
    .history-result { grid-column: 2; justify-items: start; display: flex; gap: 8px; }
    .footer { padding-bottom: 80px; }
    .auth-grid-two, .account-grid, .account-stats { grid-template-columns: 1fr; }
    .auth-card { padding: 23px 18px; }
    .account-main { width: min(100% - 20px, 940px); padding-top: 18px; }
    .account-hero { padding: 18px; }
}

@media (max-width: 400px) {
    .tm-brand-copy { gap: 1px; }
    .tm-brand-title { font-size: 17px; }
    .tm-brand-by { display: none; }
    .category-badge, .difficulty { padding: 5px 7px; font-size: 8px; }
    .quest-card h2, .empty-quest h2 { font-size: 24px; }
    .footer-dot, .footer span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Publiczny podgląd aplikacji + logowanie w oknie */
.modal-open { overflow: hidden; }

.guest-auth-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.header-auth-button {
    min-height: 39px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #393939;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.header-login {
    background: #151515;
    color: #e7e7e7;
}

.header-login:hover {
    border-color: #626262;
    background: #1d1d1d;
}

.header-register {
    border-color: var(--tm-green);
    background: var(--tm-green);
    color: #050505;
}

.header-register:hover {
    border-color: var(--tm-green-hover);
    background: var(--tm-green-hover);
}

.guest-preview-banner {
    min-height: 46px;
    margin-bottom: 10px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #2e382c;
    border-radius: 8px;
    background: rgba(57, 255, 20, .035);
}

.guest-preview-banner > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    color: var(--tm-green);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .7px;
    text-transform: uppercase;
}

.guest-preview-banner p {
    min-width: 0;
    margin: 0;
    flex: 1;
    color: #909090;
    font-size: 11px;
    line-height: 1.4;
}

.guest-preview-banner button,
.guest-history-preview button,
.auth-switch button {
    border: 0;
    background: transparent;
    color: var(--tm-green);
    font-size: inherit;
    font-weight: 850;
    cursor: pointer;
}

.guest-preview-banner button {
    flex: 0 0 auto;
    padding: 7px 9px;
    border: 1px solid rgba(57, 255, 20, .35);
    border-radius: 6px;
}

.player-strip.is-preview {
    position: relative;
}

.player-strip.is-preview::after {
    content: 'PODGLĄD';
    position: absolute;
    top: 7px;
    right: 9px;
    padding: 3px 5px;
    border: 1px solid #303030;
    border-radius: 4px;
    background: #141414;
    color: #676767;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: .8px;
}

.guest-quest-preview .quest-heading-icon {
    box-shadow: 0 0 0 1px rgba(57, 255, 20, .2), 0 0 28px rgba(57, 255, 20, .08);
}

.guest-lock-note {
    max-width: 520px;
    margin: 17px auto 0;
    color: #777;
    font-size: 11px;
    line-height: 1.45;
    text-align: center;
}

.guest-lock-note i {
    margin-right: 5px;
    color: #929292;
}

.guest-history-preview {
    min-height: 145px;
    padding: 24px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    color: #777;
    text-align: center;
}

.guest-history-preview > i {
    margin-bottom: 3px;
    color: var(--tm-green);
    font-size: 22px;
}

.guest-history-preview strong {
    color: #d8d8d8;
    font-size: 13px;
}

.guest-history-preview span {
    max-width: 390px;
    font-size: 11px;
    line-height: 1.5;
}

.guest-history-preview button {
    margin-top: 3px;
    padding: 5px 8px;
}

.auth-modal-card {
    width: min(560px, 100%);
    max-height: min(760px, calc(100vh - 32px));
    overflow-y: auto;
    scrollbar-width: thin;
}

.auth-tabs {
    margin: -9px 38px 22px 0;
    padding: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    border: 1px solid #303030;
    border-radius: 8px;
    background: #111;
}

.auth-tab {
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #777;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .65px;
    text-transform: uppercase;
    cursor: pointer;
}

.auth-tab.is-active {
    background: #222;
    color: var(--tm-green);
}

.auth-panel[hidden] {
    display: none;
}

.auth-panel h2 {
    margin: 8px 0 6px;
    font-size: 25px;
}

.auth-panel > p {
    margin: 0 0 18px;
    color: var(--tm-muted);
    font-size: 12px;
    line-height: 1.5;
}

.auth-panel .auth-switch {
    margin-bottom: 0 !important;
}

.auth-switch button {
    padding: 0;
}

.auth-error[hidden] {
    display: none;
}

@media (max-width: 980px) {
    .header-auth-button {
        padding-inline: 10px;
    }
}

@media (max-width: 700px) {
    .guest-auth-actions {
        gap: 5px;
    }

    .header-auth-button {
        width: 39px;
        min-height: 39px;
        padding: 0;
    }

    .header-auth-button span {
        display: none;
    }

    .guest-preview-banner {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .guest-preview-banner p {
        order: 3;
        flex-basis: 100%;
    }

    .guest-preview-banner button {
        margin-left: auto;
    }

    .auth-modal-card {
        padding: 23px 18px;
    }

    .auth-tabs {
        margin-right: 37px;
    }
}

@media (max-width: 400px) {
    .guest-preview-banner > span {
        font-size: 9px;
    }

    .guest-preview-banner button {
        font-size: 10px;
    }
}
