* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #111827;
    color: #f3f4f6;
}


.site-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    padding: 30px;

    background: #1f2937;

    border-bottom:
        1px solid #374151;
}

.site-header h1 {
    margin: 0 0 5px;
}

.site-header p {
    margin: 0;

    color: #9ca3af;
}


main {
    max-width: 1400px;

    margin: auto;

    padding: 30px;
}

.view-tabs {
    display: flex;

    gap: 4px;

    margin-bottom: 24px;

    border-bottom: 1px solid #374151;
}

.view-tab {
    padding: 10px 14px;

    border: 0;

    border-bottom: 2px solid transparent;

    background: transparent;

    color: #9ca3af;

    cursor: pointer;

    font-size: 15px;
}

.view-tab:hover,
.view-tab.active {
    border-bottom-color: #60a5fa;

    color: #f3f4f6;
}

.calendar-section {
    margin-bottom: 25px;
}

.calendar-heading {
    display: flex;

    align-items: end;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 16px;
}

.calendar-heading h2 {
    margin: 0;
}

.calendar-controls {
    display: flex;

    align-items: center;

    gap: 12px;
}

.calendar-controls .secondary-button {
    min-width: 38px;
}

.calendar-grid {
    display: grid;

    grid-template-columns: repeat(7, minmax(100px, 1fr));

    overflow: hidden;

    border: 1px solid #374151;

    border-radius: 8px;
}

.calendar-weekday {
    padding: 10px;

    background: #172033;

    color: #9ca3af;

    font-size: 12px;

    font-weight: 600;

    text-align: center;

    text-transform: uppercase;
}

.calendar-day {
    min-height: 120px;

    padding: 8px;

    background: #1f2937;

    border-top: 1px solid #374151;
    border-right: 1px solid #374151;
}

.calendar-day:nth-child(7n) {
    border-right: 0;
}

.calendar-day.outside-month {
    background: #172033;
}

.calendar-day > strong {
    display: block;

    margin-bottom: 7px;

    color: #d1d5db;

    font-size: 13px;
}

.calendar-event {
    overflow: hidden;

    margin-bottom: 5px;

    padding: 5px 6px;

    background: #263449;

    border-left: 2px solid #60a5fa;

    color: #dbeafe;

    font-size: 12px;

    line-height: 1.25;

    text-overflow: ellipsis;

    white-space: nowrap;
}

.calendar-event strong {
    display: block;

    margin-bottom: 3px;

    color: #f3f4f6;
}

.calendar-people {
    overflow: hidden;

    color: var(--person-color, #dbeafe);

    text-overflow: ellipsis;

    white-space: nowrap;
}

.calendar-person {
    color: var(--person-color);

    font-weight: 600;
}


/* -------------------------
   Users
------------------------- */

.users {
    margin-bottom: 25px;
}

.users-heading {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    margin-bottom: 12px;

    color: #9ca3af;

    font-size: 14px;
}

.people-controls {
    display: flex;

    gap: 8px;
}

#people-search {
    width: 220px;

    padding: 8px 10px;

    border: 1px solid #374151;

    background: #1f2937;

    color: white;

    border-radius: 6px;

    font-size: 14px;
}

.secondary-button {
    padding: 8px 12px;

    border: 1px solid #374151;

    background: #1f2937;

    color: #d1d5db;

    border-radius: 6px;

    cursor: pointer;
}

.secondary-button:hover {
    background: #374151;
}

.secondary-button.needs-attention {
    border-color: rgba(250, 204, 21, 0.75);

    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.3),
        0 0 14px rgba(250, 204, 21, 0.18);

    color: #facc15;
}

#user-list {
    display: flex;

    gap: 10px;

    flex-wrap: wrap;
}

.user-row {
    display: flex;

    align-items: stretch;

    gap: 4px;
}

.user-button {
    display: flex;

    align-items: center;

    gap: 10px;

    padding: 10px 15px;

    border: 1px solid #374151;

    background: #1f2937;

    color: white;

    border-radius: 8px;

    cursor: pointer;
}

.favourite-button {
    width: 38px;

    border: 1px solid #374151;

    background: #1f2937;

    color: #9ca3af;

    border-radius: 8px;

    cursor: pointer;

    font-size: 20px;
}

.favourite-button:hover,
.favourite-button.selected {
    color: #facc15;
}

.user-button:hover {
    background: #374151;
}

.user-button.active {
    background: #4b5563;
}

.user-button.recently-active {
    box-shadow:
        0 0 0 1px rgba(74, 222, 128, 0.45),
        0 0 14px rgba(74, 222, 128, 0.2);
}

.user-button.active-today {
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.45),
        0 0 14px rgba(250, 204, 21, 0.18);
}

.user-button img {
    width: 35px;
    height: 35px;

    border-radius: 50%;
}

.leaderboard-section {
    margin-bottom: 25px;
}

.leaderboard-heading {
    display: flex;

    align-items: end;

    justify-content: space-between;

    margin-bottom: 16px;
}

.leaderboard-heading h2 {
    margin: 0;
}

.leaderboard-scroll {
    overflow-x: auto;

    border: 1px solid #374151;

    border-radius: 8px;
}

.leaderboard-table {
    width: 100%;

    min-width: 650px;

    border-collapse: collapse;

    background: #1f2937;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 13px 16px;

    border-bottom: 1px solid #374151;

    text-align: left;
    white-space: nowrap;
}

.leaderboard-table th {
    background: #172033;

    color: #9ca3af;

    font-size: 12px;

    letter-spacing: 0.04em;

    text-transform: uppercase;
}

.table-sort {
    padding: 0;

    border: 0;

    background: transparent;

    color: inherit;

    cursor: pointer;

    font: inherit;

    letter-spacing: inherit;

    text-transform: inherit;
}

.table-sort:hover {
    color: #f3f4f6;
}

.leaderboard-table tbody tr:last-child td {
    border-bottom: 0;
}

.leaderboard-table tbody tr:hover {
    background: #263449;
}

.leaderboard-person {
    display: flex;

    align-items: center;

    gap: 10px;
}

.leaderboard-person img {
    width: 32px;
    height: 32px;

    border-radius: 50%;
}


#admin-search {
    width: 220px;

    padding: 8px 10px;

    border: 1px solid #374151;

    background: #1f2937;

    color: white;

    border-radius: 6px;

    font-size: 14px;
}

.admin-toggle {
    padding: 6px 12px;

    border: 1px solid #374151;

    border-radius: 6px;

    background: #111827;

    color: #9ca3af;

    font-size: 12px;

    font-weight: 600;

    cursor: pointer;
}

.admin-toggle:hover:not(:disabled) {
    background: #263449;

    color: #e5e7eb;
}

.admin-toggle.active {
    border-color: #34d399;

    color: #34d399;
}

.admin-toggle:disabled {
    opacity: 0.55;

    cursor: default;
}


.admin-tabs {
    display: flex;

    gap: 6px;

    margin-bottom: 20px;
}

.admin-tab {
    padding: 8px 16px;

    border: 1px solid #374151;

    border-radius: 6px;

    background: #1f2937;

    color: #9ca3af;

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;
}

.admin-tab:hover {
    color: #e5e7eb;
}

.admin-tab.active {
    background: #263449;

    border-color: #60a5fa;

    color: #f3f4f6;
}

.audit-filters {
    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    margin-bottom: 16px;
}

.audit-filters select,
.audit-filters input {
    padding: 8px 10px;

    border: 1px solid #374151;

    border-radius: 6px;

    background: #1f2937;

    color: #f3f4f6;

    font-size: 14px;
}

.audit-filters input {
    flex: 1 1 220px;

    min-width: 180px;
}

.audit-list {
    display: flex;

    flex-direction: column;

    border: 1px solid #374151;

    border-radius: 8px;

    overflow: hidden;
}

.audit-entry {
    display: flex;

    gap: 14px;

    padding: 12px 16px;

    border-bottom: 1px solid #374151;

    background: #1f2937;
}

.audit-entry:last-child {
    border-bottom: 0;
}

.audit-entry:hover {
    background: #263449;
}

.audit-time {
    flex: 0 0 170px;

    color: #9ca3af;

    font-size: 13px;
}

.audit-body {
    display: flex;

    flex-wrap: wrap;

    align-items: baseline;

    gap: 8px;
}

.audit-type {
    padding: 2px 8px;

    border-radius: 999px;

    border: 1px solid var(--audit-color, #6b7280);

    background: var(--audit-bg, rgba(107, 114, 128, 0.12));

    color: var(--audit-color, #9ca3af);

    font-size: 11px;

    font-weight: 700;

    text-transform: uppercase;
}

.audit-type-status {
    --audit-color: #60a5fa;
    --audit-bg: rgba(96, 165, 250, 0.15);
}

.audit-type-hidden {
    --audit-color: #a78bfa;
    --audit-bg: rgba(167, 139, 250, 0.15);
}

.audit-type-review {
    --audit-color: #fbbf24;
    --audit-bg: rgba(251, 191, 36, 0.15);
}

.audit-type-playtime {
    --audit-color: #34d399;
    --audit-bg: rgba(52, 211, 153, 0.15);
}

.audit-type-achievement {
    --audit-color: #22d3ee;
    --audit-bg: rgba(34, 211, 238, 0.15);
}

.audit-type-login {
    --audit-color: #9ca3af;
    --audit-bg: rgba(156, 163, 175, 0.15);
}

.audit-type-admin {
    --audit-color: #f87171;
    --audit-bg: rgba(248, 113, 113, 0.15);
}

.audit-summary {
    color: #f3f4f6;

    font-size: 14px;
}

.audit-game {
    color: #9ca3af;
}

.audit-subject {
    color: #9ca3af;

    font-size: 13px;
}

.audit-details {
    flex: 1 1 100%;

    margin-top: 4px;
}

.audit-details summary {
    color: #60a5fa;

    font-size: 12px;

    cursor: pointer;
}

.audit-details pre {
    margin: 6px 0 0;

    padding: 10px;

    border-radius: 6px;

    background: #111827;

    color: #d1d5db;

    font-size: 12px;

    white-space: pre-wrap;

    overflow-wrap: anywhere;
}

.audit-actions {
    display: flex;

    justify-content: center;

    margin-top: 16px;
}


/* -------------------------
   Statistics
------------------------- */

.stats {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 15px;

    margin-bottom: 25px;
}

.stat {
    padding: 20px;

    background: #1f2937;

    border:
        1px solid #374151;

    border-radius: 10px;
}

.stat-label {
    display: block;

    margin-bottom: 8px;

    color: #9ca3af;

    font-size: 14px;
}

.stat strong {
    font-size: 28px;
}


/* -------------------------
   Controls
------------------------- */

.controls {
    display: flex;

    gap: 10px;

    margin-bottom: 25px;
}

.controls input,
.controls select,
#history-game {
    padding: 12px;

    background: #1f2937;

    color: white;

    border:
        1px solid #374151;

    border-radius: 6px;

    font-size: 15px;
}

.controls input {
    flex: 1;
}


/* -------------------------
   History
------------------------- */

.history-panel {
    margin-bottom: 30px;

    padding: 22px;

    background: #172033;

    border: 1px solid #3b4a63;

    border-radius: 10px;
}

.history-heading {
    display: flex;

    align-items: end;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 16px;
}

.section-kicker {
    display: block;

    margin-bottom: 4px;

    color: #60a5fa;

    font-size: 12px;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}

.history-heading h2,
.chart-heading h3 {
    margin: 0;
}

#history-game {
    min-width: 220px;

    cursor: pointer;
}

.history-status {
    min-height: 20px;

    margin-bottom: 10px;

    color: #9ca3af;

    font-size: 14px;
}

.charts {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 16px;
}

.chart-card {
    min-width: 0;

    padding: 15px;

    background: #1f2937;

    border: 1px solid #374151;

    border-radius: 8px;
}

.chart-heading {
    display: flex;

    align-items: baseline;

    justify-content: space-between;

    margin-bottom: 8px;
}

.chart-heading span {
    color: #9ca3af;

    font-size: 13px;
}

.chart-card canvas {
    display: block;

    width: 100%;

    height: 240px;
}

.game.selected {
    border-color: #60a5fa;

    box-shadow: 0 0 0 1px #60a5fa;
}


/* -------------------------
   Games
------------------------- */

.games {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(300px, 1fr));

    gap: 20px;
}


.game {
    overflow: hidden;

    content-visibility: auto;

    contain-intrinsic-size: auto 320px;

    background: #1f2937;

    border:
        1px solid #374151;

    border-radius: 10px;

    transition:
        transform 0.15s,
        border-color 0.15s;
}

.game.saving {
    opacity: 0.6;

    pointer-events: none;
}

.game:hover {
    transform: translateY(-3px);

    border-color: #6b7280;
}

.game.suspicious-achievements {
    border-color: #ef4444;

    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.7);
}


.game-image {
    width: 100%;

    aspect-ratio: 460 / 215;

    object-fit: cover;

    background: #111827;
}


.game-content {
    padding: 15px;
}


.game-title {
    margin: 0 0 12px;

    font-size: 18px;
}


.game-info {
    display: flex;

    justify-content: space-between;

    color: #9ca3af;

    font-size: 14px;
}


/* -------------------------
   Game status
------------------------- */

.game-status {
    display: flex;

    align-items: center;

    gap: 8px;

    margin-top: 14px;
}

.hide-button {
    flex: 0 0 auto;

    padding: 8px 12px;

    border: 1px solid #374151;

    border-radius: 6px;

    background: #111827;

    color: #9ca3af;

    font-size: 13px;

    font-weight: 600;

    cursor: pointer;
}

.hide-button:hover {
    background: #263449;

    color: #e5e7eb;
}

.hide-button.active {
    border-color: #a78bfa;

    color: #a78bfa;
}

.status-doing {
    --status-color: #60a5fa;
    --status-bg: rgba(96, 165, 250, 0.15);
}

.status-not_started {
    --status-color: #9ca3af;
    --status-bg: rgba(156, 163, 175, 0.15);
}

.status-completed {
    --status-color: #34d399;
    --status-bg: rgba(52, 211, 153, 0.15);
}

.status-abandoned {
    --status-color: #f87171;
    --status-bg: rgba(248, 113, 113, 0.15);
}

.status-paused {
    --status-color: #fbbf24;
    --status-bg: rgba(251, 191, 36, 0.15);
}

.status-unmarked {
    --status-color: #6b7280;
    --status-bg: rgba(107, 114, 128, 0.12);
}

.status-hidden {
    --status-color: #a78bfa;
    --status-bg: rgba(167, 139, 250, 0.15);
}

.status-shared {
    --status-color: #22d3ee;
    --status-bg: rgba(34, 211, 238, 0.15);
}

.status-expanded {
    --status-color: #fbbf24;
    --status-bg: rgba(251, 191, 36, 0.15);
}


/* -------------------------
   Game reviews
------------------------- */

.game-review {
    margin-top: 14px;

    padding-top: 12px;

    border-top: 1px solid #374151;
}

.review-head {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;
}

.review-title {
    color: #9ca3af;

    font-size: 12px;

    font-weight: 700;

    letter-spacing: 0.05em;

    text-transform: uppercase;
}

.review-edit-button {
    padding: 5px 10px;

    border: 1px solid #374151;

    border-radius: 6px;

    background: #111827;

    color: #d1d5db;

    font-size: 12px;

    font-weight: 600;

    cursor: pointer;
}

.review-edit-button:hover {
    background: #263449;

    color: #f3f4f6;
}

.review-stars {
    display: inline-flex;

    gap: 1px;

    margin-top: 6px;

    font-size: 16px;
}

.review-star {
    color: #374151;
}

.review-star.filled {
    color: #facc15;
}

.review-note {
    margin: 8px 0 0;

    color: #e5e7eb;

    font-size: 14px;
}

.review-text {
    margin: 6px 0 0;

    color: #d1d5db;

    font-size: 14px;

    line-height: 1.5;

    white-space: pre-wrap;

    overflow-wrap: anywhere;

    display: -webkit-box;

    -webkit-line-clamp: 6;

    -webkit-box-orient: vertical;

    overflow: hidden;
}

.review-visibility {
    display: inline-block;

    margin-top: 8px;

    padding: 2px 8px;

    border: 1px solid #6b7280;

    border-radius: 999px;

    color: #9ca3af;

    font-size: 11px;

    text-transform: uppercase;
}

.review-dialog {
    width: min(560px, calc(100vw - 32px));

    padding: 0;

    border: 1px solid #374151;

    border-radius: 12px;

    background: #1f2937;

    color: #f3f4f6;
}

.review-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.review-dialog form {
    display: flex;

    flex-direction: column;

    gap: 16px;

    padding: 22px;
}

.review-dialog-title {
    margin: 0;

    font-size: 20px;
}

.review-field {
    display: flex;

    flex-direction: column;

    gap: 6px;
}

.review-field > span {
    color: #9ca3af;

    font-size: 13px;

    font-weight: 600;
}

.review-field input,
.review-field textarea {
    width: 100%;

    padding: 10px 12px;

    border: 1px solid #374151;

    border-radius: 6px;

    background: #111827;

    color: #f3f4f6;

    font-family: inherit;

    font-size: 14px;

    resize: vertical;
}

.review-field input:focus,
.review-field textarea:focus {
    outline: none;

    border-color: #60a5fa;
}

.rating-input {
    display: flex;

    gap: 4px;
}

.rating-star {
    padding: 2px 4px;

    border: none;

    background: none;

    color: #374151;

    font-size: 28px;

    line-height: 1;

    cursor: pointer;
}

.rating-star.filled {
    color: #facc15;
}

.rating-star:hover {
    color: #fbbf24;
}

.review-visible {
    display: flex;

    align-items: center;

    gap: 10px;

    color: #d1d5db;

    font-size: 13px;

    cursor: pointer;
}

.review-visible input {
    width: 16px;

    height: 16px;
}

.review-error {
    margin: 0;

    color: #f87171;

    font-size: 13px;
}

.review-actions {
    display: flex;

    justify-content: flex-end;

    gap: 10px;
}

.primary-button {
    padding: 8px 16px;

    border: 1px solid #2563eb;

    border-radius: 6px;

    background: #2563eb;

    color: white;

    font-weight: 600;

    cursor: pointer;
}

.primary-button:hover {
    background: #1d4ed8;
}

.primary-button:disabled,
.secondary-button:disabled {
    opacity: 0.6;

    cursor: default;
}

.bulk-controls {
    display: flex;

    align-items: center;

    flex-wrap: wrap;

    gap: 10px;

    margin-bottom: 25px;

    padding: 14px 16px;

    background: #172033;

    border: 1px solid #3b4a63;

    border-radius: 10px;
}

.bulk-controls select {
    padding: 12px;

    background: #1f2937;

    color: white;

    border: 1px solid #374151;

    border-radius: 6px;

    font-size: 15px;
}

.bulk-count {
    color: #d1d5db;

    font-weight: 600;

    white-space: nowrap;
}

.bulk-message {
    color: #9ca3af;

    font-size: 14px;
}

.bulk-message.error {
    color: #f87171;
}

.bulk-controls.busy {
    opacity: 0.7;

    pointer-events: none;
}

.status-badge {
    display: inline-block;

    padding: 4px 10px;

    border: 1px solid var(--status-color);

    border-radius: 999px;

    background: var(--status-bg);

    color: var(--status-color);

    font-size: 12px;

    font-weight: 600;
}

.status-select {
    flex: 1 1 0;

    min-width: 0;

    padding: 8px 10px;

    border: 1px solid var(--status-color);

    border-radius: 6px;

    background: #111827;

    color: var(--status-color);

    font-size: 13px;

    font-weight: 600;

    cursor: pointer;
}


.progress {
    margin-top: 15px;
}


.progress-label {
    display: flex;

    justify-content: space-between;

    margin-bottom: 5px;

    font-size: 13px;
}


.progress-bar {
    height: 7px;

    overflow: hidden;

    background: #111827;

    border-radius: 10px;
}


.progress-fill {
    height: 100%;

    background: #60a5fa;
}


.no-results {
    grid-column: 1 / -1;

    padding: 50px;

    text-align: center;

    color: #9ca3af;
}


/* -------------------------
   Account
------------------------- */

.account {
    display: flex;

    align-items: center;

    gap: 10px;
}

.account img {
    width: 38px;
    height: 38px;

    border-radius: 50%;

    background: #111827;
}

.account span {
    color: #e5e7eb;

    font-size: 14px;

    font-weight: 600;
}

.account form {
    margin: 0;
}


/* -------------------------
   Login
------------------------- */

.login-body {
    display: flex;

    align-items: center;

    justify-content: center;

    min-height: 100vh;
}

.login-card {
    width: 100%;

    max-width: 380px;

    padding: 40px;

    background: #1f2937;

    border: 1px solid #374151;

    border-radius: 12px;

    text-align: center;
}

.login-card h1 {
    margin: 0 0 8px;

    font-size: 24px;
}

.login-subtitle {
    margin: 0 0 26px;

    color: #9ca3af;

    font-size: 14px;
}

.steam-button {
    display: block;

    padding: 12px 18px;

    background: #1b2838;

    border: 1px solid #2a475e;

    border-radius: 6px;

    color: #ffffff;

    font-size: 15px;

    font-weight: 600;

    text-decoration: none;
}

.steam-button:hover {
    background: #2a475e;
}

.login-error {
    margin: 18px 0 0;

    color: #f87171;

    font-size: 14px;
}


/* -------------------------
   Mobile
------------------------- */

@media (max-width: 800px) {

    main {
        padding: 15px;
    }

    .stats {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .controls {
        flex-direction: column;
    }

    .calendar-heading {
        align-items: stretch;

        flex-direction: column;
    }

    .calendar-grid {
        overflow-x: auto;

        grid-template-columns: repeat(7, minmax(120px, 1fr));
    }

    .users-heading {
        align-items: stretch;

        flex-direction: column;
    }

    .people-controls {
        flex-direction: column;
    }

    #people-search {
        width: 100%;
    }

    .secondary-button {
        width: 100%;
    }

    .history-heading,
    .charts {
        align-items: stretch;

        grid-template-columns: 1fr;

        flex-direction: column;
    }

    #history-game {
        width: 100%;
    }
}
