:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-hover: #0ea5e9;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --item-hover: rgba(56, 189, 248, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeIn 0.8s ease-out;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-secondary);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.input-section {
    max-width: 600px;
    margin: 0 auto 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.text-panel {
    width: 100%;
    padding: 1.2rem 1.25rem 1.1rem;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(56, 189, 248, 0.14), rgba(14, 165, 233, 0.04)),
        rgba(15, 23, 42, 0.38);
    border: 1px solid rgba(125, 211, 252, 0.16);
}

.api-key-trigger {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-color);
    font: inherit;
    line-height: inherit;
    cursor: pointer;
    text-decoration: none;
    vertical-align: baseline;
}

.api-key-trigger:hover {
    text-decoration: underline;
}

.api-key-details {
    width: 100%;
    background: rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.9rem 1rem 1rem;
}

.details-heading {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1.3;
    font-weight: 700;
}

.details-copy {
    margin: 0.8rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 54ch;
    opacity: 0.9;
}

.details-copy-compact {
    margin-top: 0.9rem;
    font-size: 0.84rem;
}

.details-note {
    margin-top: 0.95rem;
    padding: 0.7rem 0.8rem;
    max-width: 54ch;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.details-note strong {
    color: var(--text-primary);
}

.details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem 1.15rem;
    align-items: center;
    margin-top: 1rem;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    padding: 0.8rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
.api-key-trigger:focus-visible {
    outline: 3px solid rgba(56, 189, 248, 0.85);
    outline-offset: 2px;
}

input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.password-wrapper {
    position: relative;
    width: 100%;
}

.toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.toggle-btn:hover {
    color: var(--text-primary);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.primary-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(1px);
}

.accent-link {
    color: var(--accent-color);
    text-decoration: none;
    transition: text-decoration 0.2s;
}

.accent-link:hover {
    text-decoration: underline;
}

.status-message {
    text-align: center;
    color: var(--accent-color);
    min-height: 1.5rem;
    margin-bottom: 1rem;
}

.hidden {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.table-container {
    overflow-x: auto;
    animation: slideUp 0.5s ease-out;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    color: var(--text-secondary);
    font-weight: 600;
    user-select: none;
    white-space: nowrap;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.sort-btn:hover {
    color: var(--text-primary);
}

.sort-btn:focus-visible {
    border-radius: 6px;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: var(--item-hover);
}

.game-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    width: fit-content;
}

.badge.wishlist {
    background-color: #8b5cf6;
    color: white;
}

.game-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    background: #1e293b;
    flex-shrink: 0;
}

.loading-pulse {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    animation: pulse 1s infinite;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 1;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
}

.filter-toggle input {
    width: auto;
}

#searchFilter {
    padding: 0.6rem;
    width: 260px;
}

#maxHoursFilter {
    width: 80px;
}

.stats {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .glass-panel {
        padding: 1.25rem;
    }

    .filter-controls {
        width: 100%;
    }

    .text-panel {
        padding: 1rem 1rem 0.95rem;
    }

    .details-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    #searchFilter,
    #maxHoursFilter {
        width: 100%;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}
