/* ============================================================
   Riwius Inventar – "Coupon Vault"
   Signature: rarity-farbige Ticket-Karten mit Perforations-Spine
   ============================================================ */

:root {
    --vault:      #14131c;
    --vault-2:    #1b1a26;
    --vault-3:    #232234;
    --ink:        #ecEAF4;
    --muted:      #9b97ad;
    --line:       rgba(255, 255, 255, .08);
    --line-2:     rgba(255, 255, 255, .14);
    --amber:      #f4b740;
    --twitch:     #9146ff;
    --twitch-700: #772ce8;

    --r-common:    #8b93a7;
    --r-uncommon:  #4ade80;
    --r-rare:      #4aa3ff;
    --r-epic:      #b06cff;
    --r-legendary: #f4b740;

    --radius: 14px;
    --maxw: 1120px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(145, 70, 255, .12), transparent 60%),
        radial-gradient(900px 500px at 0% 0%, rgba(244, 183, 64, .06), transparent 55%),
        var(--vault);
    color: var(--ink);
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }

em { font-style: normal; color: var(--amber); }

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 2.5rem);
    border-bottom: 1px solid var(--line);
    background: rgba(20, 19, 28, .7);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand { display: flex; align-items: center; gap: .65rem; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--amber), #e0962a);
    color: #1a1407;
    font-family: "Syne", sans-serif;
    font-weight: 800;
    letter-spacing: .02em;
    box-shadow: 0 4px 18px rgba(244, 183, 64, .25);
}

.brand-text {
    font-family: "Syne", sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: .01em;
}

.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.navlink { color: var(--muted); font-weight: 500; }
.navlink:hover { color: var(--ink); }

.inline-form { margin: 0; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .6rem .3rem .35rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--vault-2);
}

.user-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.user-name { font-weight: 600; font-size: .92rem; }

/* ---------- Buttons ---------- */
.btn {
    --bg: var(--vault-3);
    appearance: none;
    border: 1px solid var(--line-2);
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    padding: .6rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: transform .08s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--ink); border-color: var(--line-2); }

.btn-twitch {
    background: var(--twitch);
    border-color: var(--twitch);
    color: #fff;
}
.btn-twitch:hover { background: var(--twitch-700); border-color: var(--twitch-700); }

.btn-lg { padding: .85rem 1.5rem; font-size: 1.05rem; border-radius: 12px; }

/* ---------- Layout ---------- */
.page {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem);
    flex: 1 0 auto;
}

.footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .85rem;
    text-align: center;
    padding: 1.25rem;
}

/* ---------- Hero / Landing ---------- */
.hero { max-width: 720px; padding: clamp(1rem, 5vw, 3rem) 0; }

.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .78rem;
    color: var(--amber);
    margin: 0 0 1rem;
}

.hero-title {
    font-family: "Syne", sans-serif;
    font-weight: 800;
    font-size: clamp(2.4rem, 7vw, 4.2rem);
    line-height: 1.02;
    margin: 0 0 1.2rem;
    letter-spacing: -.01em;
}

.hero-lead { color: var(--muted); font-size: 1.1rem; max-width: 56ch; margin: 0 0 2rem; }

.hero-points {
    list-style: none;
    padding: 0;
    margin: 2.5rem 0 0;
    display: grid;
    gap: .75rem;
    max-width: 60ch;
}
.hero-points li {
    padding-left: 1.4rem;
    position: relative;
    color: var(--muted);
}
.hero-points li::before {
    content: "";
    position: absolute;
    left: 0; top: .55em;
    width: .55rem; height: .55rem;
    border-radius: 2px;
    background: var(--amber);
    transform: rotate(45deg);
}
.hero-points strong { color: var(--ink); }

/* ---------- Inventar Kopf ---------- */
.inv-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.inv-title {
    font-family: "Syne", sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    margin: 0;
}
.inv-sub { color: var(--muted); margin: .25rem 0 0; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .9rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--vault-2);
    font-size: .9rem;
    color: var(--muted);
}
.status-pill strong { color: var(--ink); text-transform: capitalize; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status-pill.is-online .status-dot {
    background: var(--r-uncommon);
    box-shadow: 0 0 0 4px rgba(74, 222, 128, .18);
}
.status-pill.is-offline .status-dot { background: #ef5e6e; }

/* ---------- Empty ---------- */
.empty {
    border: 1px dashed var(--line-2);
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--ink);
}
.empty-hint { color: var(--muted); margin-top: .25rem; }

/* ---------- Rarity-Block ---------- */
.rarity-block { margin-bottom: 2.5rem; }

.rarity-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.rarity-name {
    font-family: "Syne", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: .02em;
}
.rarity-line { flex: 1; height: 1px; background: var(--line); }
.rarity-count {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: .9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .1rem .6rem;
}

/* Rarity-Akzent je Block */
.rarity-block[data-rarity="common"]    { --rc: var(--r-common); }
.rarity-block[data-rarity="uncommon"]  { --rc: var(--r-uncommon); }
.rarity-block[data-rarity="rare"]      { --rc: var(--r-rare); }
.rarity-block[data-rarity="epic"]      { --rc: var(--r-epic); }
.rarity-block[data-rarity="legendary"] { --rc: var(--r-legendary); }
.rarity-block[data-rarity] .rarity-name { color: var(--rc); }

/* ---------- Ticket-Grid ---------- */
.ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 1rem;
}

.ticket {
    --rc: var(--r-common);
    position: relative;
    display: grid;
    grid-template-columns: 14px 84px 1fr;
    grid-template-areas: "spine thumb body" "spine thumb action";
    gap: 0 1rem;
    align-items: start;
    background: linear-gradient(180deg, var(--vault-2), var(--vault-3));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1rem 1rem 0;
    overflow: hidden;
    transition: border-color .15s ease, transform .12s ease;
}
.ticket:hover { border-color: color-mix(in srgb, var(--rc) 45%, transparent); transform: translateY(-2px); }

.ticket[data-rarity="common"]    { --rc: var(--r-common); }
.ticket[data-rarity="uncommon"]  { --rc: var(--r-uncommon); }
.ticket[data-rarity="rare"]      { --rc: var(--r-rare); }
.ticket[data-rarity="epic"]      { --rc: var(--r-epic); }
.ticket[data-rarity="legendary"] { --rc: var(--r-legendary); }

/* Perforierter Rarity-Spine als Signature */
.ticket-spine {
    grid-area: spine;
    align-self: stretch;
    background:
        radial-gradient(circle at 7px 0, transparent 4px, var(--rc) 4px) 0 0 / 14px 16px repeat-y;
    opacity: .9;
}

.ticket-thumb {
    grid-area: thumb;
    position: relative;
    width: 84px; height: 84px;
    border-radius: 10px;
    overflow: hidden;
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 6px, transparent 6px 12px),
        color-mix(in srgb, var(--rc) 16%, var(--vault));
    display: grid; place-items: center;
    border: 1px solid color-mix(in srgb, var(--rc) 30%, transparent);
}
.ticket-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback {
    font-family: "Syne", sans-serif;
    font-weight: 800;
    font-size: 1.8rem;
    color: color-mix(in srgb, var(--rc) 75%, white);
}
.ticket-amount {
    position: absolute;
    bottom: 4px; right: 4px;
    background: rgba(10, 9, 15, .82);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: .1rem .4rem;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

.ticket-body { grid-area: body; min-width: 0; }
.ticket-name {
    font-family: "Syne", sans-serif;
    font-weight: 700;
    font-size: 1.02rem;
    margin: 0 0 .25rem;
}
.ticket-desc {
    color: var(--muted);
    font-size: .88rem;
    margin: 0 0 .6rem;
}

.ticket-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.tag {
    font-size: .72rem;
    font-weight: 600;
    color: color-mix(in srgb, var(--rc) 70%, white);
    background: color-mix(in srgb, var(--rc) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--rc) 30%, transparent);
    border-radius: 6px;
    padding: .08rem .4rem;
}
.expires { font-size: .76rem; color: var(--muted); margin-left: auto; }

.ticket-action { grid-area: action; margin-top: .8rem; }
.btn-use {
    width: 100%;
    background: color-mix(in srgb, var(--rc) 22%, var(--vault-3));
    border-color: color-mix(in srgb, var(--rc) 45%, transparent);
    color: #fff;
}
.btn-use:hover { background: color-mix(in srgb, var(--rc) 34%, var(--vault-3)); }
.btn-use:disabled {
    cursor: not-allowed;
    opacity: .45;
    transform: none;
    color: var(--muted);
    background: var(--vault-3);
    border-color: var(--line);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%) translateY(200%);
    background: var(--vault-3);
    color: var(--ink);
    border: 1px solid var(--line-2);
    border-left: 4px solid var(--amber);
    padding: .8rem 1.1rem;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
    max-width: 90vw;
    opacity: 0;
    transition: transform .25s ease, opacity .25s ease;
    z-index: 50;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { border-left-color: #ef5e6e; }
.toast.success { border-left-color: var(--r-uncommon); }

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
    .ticket {
        grid-template-columns: 10px 64px 1fr;
        gap: 0 .75rem;
    }
    .ticket-thumb { width: 64px; height: 64px; }
    .topbar-actions .navlink { display: none; }
    .expires { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
