:root {
    --bg: #0f1117;
    --card: #14151b;
    --text: #fff;
    --muted: #9aa0a6;
    --accent: #4effff;
    --accent-600: #3ddede;
    --danger: #e74c3c;
    --event-color: #ffb300;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Poppins', system-ui, sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.rimuru-app {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 40px;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
select {
    font: inherit;
}

.topbar {
    padding: 40px 16px 0px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.brand .title {
    margin: 0;
    font-weight: 800;
    font-size: 1.75rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.brand .sub {
    font-size: .85rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.controls-wrap {
    padding: 0 16px;
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.filters-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex: 1 1 auto;
}

.control-pill {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    transition: 0.2s;
    flex: 1;
    min-width: 200px;
}

.control-pill:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.control-pill:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(78, 255, 255, 0.15);
}

.control-icon {
    position: absolute;
    left: 14px;
    color: var(--muted);
    pointer-events: none;
}

.control-chevron {
    position: absolute;
    right: 14px;
    color: var(--muted);
    pointer-events: none;
}

.control-pill input,
.control-pill select {
    width: 100%;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text);
    padding: 10px 40px;
    font-size: 0.95rem;
    appearance: none;
}

.control-pill select {
    cursor: pointer;
}

.search-pill {
    flex: 2 1 300px;
}

.filter-pill {
    flex: 1 1 200px;
}

.control-pill select option {
    background-color: var(--card);
    color: var(--text);
    padding: 12px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 24px 16px;
}

@media(min-width:520px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media(min-width:820px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media(min-width:1024px) {
    .grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.gacha-card {
    position: relative;
    border-radius: 14px;
    background: linear-gradient(180deg, #0d0f16, #0c0e14);
    border: 1px solid #272b37;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.gacha-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
    border-color: var(--accent);
}

.gacha-thumb {
    position: relative;
    width: calc(100% - 16px);
    margin: 8px;
    aspect-ratio: 7 / 9;
    border-radius: 10px;
    overflow: hidden;
}

.gacha-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.gacha-card:hover .gacha-thumb img {
    transform: scale(1.04);
}

.gacha-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 56px;
    padding: 40px 14px 12px;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.75) 45%, #0d0f16 100%);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 10;
    pointer-events: none;
}

.gacha-name {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.gacha-series {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    margin-bottom: 4px;
}

.card-bottom-bar {
    position: relative;
    width: 100%;
    height: 56px;
    padding: 0 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.issue-pill {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text);
    /* Added text color */
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    /* Prevents text from dropping to a new line */
}

/* Add this MISSING rule right below it */
.issue-pill svg {
    width: 12px;
    height: 12px;
    color: var(--muted);
    flex-shrink: 0;
    /* Prevents the icon from getting squished */
}

.bottom-bid-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.bottom-bid-info .label {
    font-size: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bottom-bid-info .amount {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
}

.card-tier-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 5;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.tier-S {
    color: #f1c40f;
    border-color: #f1c40f;
    box-shadow: 0 0 8px rgba(241, 196, 15, 0.3);
}

.tier-X {
    color: #ff4d4d;
    background: rgba(20, 0, 0, 0.8);
    border: 1px solid #ff1a1a;
    box-shadow: 0 0 15px rgba(255, 26, 26, 0.7), inset 0 0 6px rgba(255, 26, 26, 0.3);
    text-shadow: 0 0 8px rgba(255, 77, 77, 0.9);
}

.auction-timer-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    font-weight: 600;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 999px;
    backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 4px;
    font-variant-numeric: tabular-nums;
}

.auction-timer-badge.urgent {
    color: var(--danger);
    border-color: rgba(231, 76, 60, 0.4);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(231, 76, 60, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

.btn {
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, .12);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover:not(:disabled) {
    background: #1c1e26;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn.primary {
    background: rgba(78, 255, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.btn.primary:hover {
    background: var(--accent);
    color: #000;
}

.btn.is-loading {
    color: transparent !important;
    pointer-events: none;
    position: relative;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(78, 255, 255, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.quick-bid-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    color: var(--muted);
    font-size: 0.85rem;
    height: 40px !important;
}

.quick-bid-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(78, 255, 255, 0.05);
}

#detail-view {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Poppins', sans-serif;
    color: var(--text);
}

#detail-view.active {
    transform: translateY(0);
}

body.detail-active {
    overflow: hidden;
}

.detail-nav {
    position: sticky;
    top: 0;
    padding: 16px 24px;
    background: linear-gradient(180deg, var(--bg) 60%, transparent);
    z-index: 10;
}

.btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--muted);
}

.detail-back-btn {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
}

.detail-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 60px;
}

.detail-image-wrap {
    padding: 20px 24px;
    display: flex;
    justify-content: center;
}

.detail-image-wrap img {
    width: 100%;
    max-width: 400px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-info {
    padding: 0 24px;
    flex: 1;
}

.detail-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 12px 0 4px;
    line-height: 1.2;
}

.detail-series {
    font-size: 1.1rem;
    color: var(--muted);
    margin: 0 0 16px;
}

.detail-badges {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}

.auction-panel {
    background: var(--card);
    border: 1px solid rgba(78, 255, 255, 0.15);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
}

.auction-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-group .label {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
}

.stat-group .val {
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-group .val.highlight {
    color: var(--accent);
}

@keyframes bidUpdate {
    0% {
        color: #fff;
        transform: scale(1.05);
    }

    100% {
        color: var(--accent);
        transform: scale(1);
    }
}

.stat-group .val.updated {
    animation: bidUpdate 0.5s ease-out;
}

.stat-group .val.urgent {
    color: var(--danger);
    animation: pulse 1.5s infinite;
}

.bid-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bid-input-wrap input {
    height: 48px;
    background: #0d0f16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0 16px;
    color: var(--text);
    font-weight: 600;
    font-size: 1.05rem;
    outline: none;
}

.bid-input-wrap input:focus {
    border-color: var(--accent);
}

.bid-input-wrap .btn {
    height: 48px;
}

.bid-success-msg {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #2ecc71;
    font-weight: 600;
    padding: 12px;
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 12px;
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.owners-header {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.bid-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 8px;
}

.bid-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0d0f16;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.3s;
}

.bid-row.winning {
    border-color: rgba(78, 255, 255, 0.3);
    background: rgba(78, 255, 255, 0.03);
}

.bid-row.new-bid {
    animation: slideDown 0.4s;
}

.bidder-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bidder-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(78, 255, 255, 0.2);
    overflow: hidden;
}

.bidder-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bidder-details .name {
    font-weight: 600;
    font-size: 0.9rem;
}

.bidder-details .time {
    font-size: 0.75rem;
    color: var(--muted);
}

.bid-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.bid-row.winning .bid-amount {
    color: var(--accent);
}

@media (min-width: 800px) {
    .detail-content {
        flex-direction: row;
        align-items: stretch;
        padding-top: 20px;
    }

    .detail-image-wrap {
        width: 45%;
        padding: 0 40px;
        position: sticky;
        top: 80px;
        height: max-content;
    }

    .detail-info {
        width: 55%;
        padding: 0 40px;
    }
}