/*--------------------------------------------------------------
Global
--------------------------------------------------------------*/

:root {
    --primary: #515050;
    --primary-dark: #353434;
    --primary-light: #b5b4b4;
    --gold: #d7a446;
    --cream: #f8f4f2;
    --white: #ffffff;
    --ink: #43393a;
    --muted: #776768;
    --border: #e7d9da;
    --shadow: 0 10px 24px rgba(0,0,0,.08);
    --radius: 16px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--cream);
    color: var(--ink);
}

/*--------------------------------------------------------------
Hero
--------------------------------------------------------------*/

.hero {
    background: linear-gradient(
        180deg,
        #b5b4b4 0%,
        #353434 100%
    );

    color: white;
    text-align: center;
    padding: 3rem 1.5rem;
}

.hero-logo {
    width: 180px;
    max-width: 70%;
    margin-bottom: .5rem;
}

.hero h1 {
    margin-top: 0;
    font-size: 2.4rem;
    font-weight: 800;
}

.hero-subtitle {
    margin-top: .4rem;
    color: rgba(255,255,255,.85);
    font-size: 1.05rem;
}

/*--------------------------------------------------------------
Player Profile Section
--------------------------------------------------------------*/

.player-profile-section {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 0.8rem;
    box-shadow: 0 0.3rem 1rem rgba(0, 0, 0, 0.08);
}

.player-profile-entry {
    display: grid;
    gap: 0.4rem;
}

.player-profile-entry label {
    font-weight: 750;
}

.player-profile-entry input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid #c9c9c9;
    border-radius: 0.5rem;
    font: inherit;
}

.player-profile-success {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-top: 0.85rem;
}

.player-profile-error {
    margin-top: 0.75rem;
    font-weight: 700;
    color: #9c2727;
}

/*--------------------------------------------------------------
Search
--------------------------------------------------------------*/

.search-section {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

#searchInput {
    width: 100%;
    padding: .95rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 1rem;
    outline: none;
    transition: .2s;
}

#searchInput:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(217,164,65,.18);
}

/*--------------------------------------------------------------
Game Grid
--------------------------------------------------------------*/

.game-grid {
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 0 1rem;

    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(260px,1fr));
    gap: 1.5rem;
}

/*--------------------------------------------------------------
Placeholder Card
--------------------------------------------------------------*/

.placeholder-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);

    padding: 3rem 1rem;
    text-align: center;

    border: 2px dashed var(--border);
}

.placeholder-card h2 {
    margin-top: 0;
    color: var(--primary);
}

.placeholder-card p {
    color: var(--muted);
}

/*--------------------------------------------------------------
Game Card
--------------------------------------------------------------*/

.game-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.game-image-wrap {
    background: #f1e7e8;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-image.placeholder {
    object-fit: contain;
    padding: 2rem;
    opacity: 0.65;
}

.game-card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
}

.game-title {
    margin: 0;
    color: var(--ink);
    font-size: 1.15rem;
    line-height: 1.2;
}

.game-publisher {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.game-actions {
    margin-top: auto;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.game-button,
.bgg-link {
    border: none;
    border-radius: 999px;
    padding: 0.7rem 0.95rem;
    font-weight: 800;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
}

.game-button {
    background: var(--gold);
    color: #2f2410;
}

.game-button:hover {
    filter: brightness(0.95);
}

.bgg-link {
    background: #f4eeee;
    color: var(--primary-dark);
}

.bgg-link:hover {
    background: #eadcde;
}

/*--------------------------------------------------------------
Footer
--------------------------------------------------------------*/

footer {
    background: var(--primary);
    color: rgba(255,255,255,.8);
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

footer p {
    margin: 0;
}
/*--------------------------------------------------------------
Modal
--------------------------------------------------------------*/

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
}

.modal-content {
    position: relative;
    background: var(--white);
    width: min(92vw, 620px);
    max-height: 90vh;
    overflow-y: auto;
    margin: 4vh auto;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.modal-close {
    position: absolute;
    top: .75rem;
    right: .9rem;
    border: none;
    background: transparent;
    font-size: 2rem;
    cursor: pointer;
    color: var(--muted);
}

.modal-close:hover {
    color: var(--primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

.modal-kicker {
    margin: 0 0 .35rem;
    color: var(--primary);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .75rem;
}

.modal-content h2 {
    margin: 0;
    color: var(--ink);
}

.modal-subtitle {
    margin: .35rem 0 1.25rem;
    color: var(--muted);
}

/*--------------------------------------------------------------
Record Play Form
--------------------------------------------------------------*/

.record-play-form {
    display: grid;
    gap: 1rem;
}

.player-rows {
    display: grid;
    gap: 1rem;
}

.player-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: #faf7f7;
}

.player-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .85rem;
}

.player-row-title {
    font-weight: 900;
    color: var(--ink);
}

.remove-player-button {
    border: none;
    background: transparent;
    color: var(--primary-dark);
    font-weight: 800;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
}

.form-field {
    display: grid;
    gap: .35rem;
}

.form-field label {
    font-size: .85rem;
    font-weight: 800;
    color: var(--ink);
}

.form-field input,
.form-field select {
    width: 100%;
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(217,164,65,.18);
}

.full-width {
    grid-column: 1 / -1;
}

.secondary-button {
    border: 1px solid var(--border);
    background: #f4eeee;
    color: var(--primary-dark);
    border-radius: 999px;
    padding: .8rem 1rem;
    font-weight: 900;
    cursor: pointer;
}

.secondary-button:hover {
    background: #eadcde;
}

/*--------------------------------------------------------------
Player Autocomplete
--------------------------------------------------------------*/

.player-search-field {
    position: relative;
}

.player-search-results {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 20;

    max-height: 240px;
    overflow-y: auto;

    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.player-search-option {
    display: block;
    width: 100%;

    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--white);

    padding: 0.8rem 0.9rem;
    text-align: left;
    font: inherit;
    color: var(--ink);
    cursor: pointer;
}

.player-search-option:last-child {
    border-bottom: none;
}

.player-search-option:hover,
.player-search-option:focus {
    background: #f4eeee;
    outline: none;
}

.player-search-empty {
    padding: 0.8rem 0.9rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.game-play-count {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.75rem 0 1rem;
    font-size: 0.92rem;
    font-weight: 750;
    color: var(--muted);
}

@media (max-width: 600px) {
    .modal-content {
        padding: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

.player-play-count-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;

    padding: 0.35rem 0.55rem;

    border: 0;
    border-radius: 0.45rem;

    background: transparent;
    color: var(--ink);

    font: inherit;
    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.player-play-count-button:hover {
    background: rgba(196, 83, 94, 0.1);
    color: var(--primary);
}

.player-play-count-button:focus-visible {
    outline: 3px solid rgba(196, 83, 94, 0.3);
    outline-offset: 2px;
}

.player-play-count-button:active {
    transform: translateY(1px);
}

.player-plays-modal-panel {
    width: min(92vw, 620px);
    max-height: 85vh;
    overflow-y: auto;
}

.player-plays-modal-content {
    position: relative;
    width: min(92vw, 620px);
    max-height: 85vh;
    overflow-y auto;
}

.player-plays-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;

    margin: 1.25rem 0;
}

.player-plays-summary > div {
    display: grid;
    gap: 0.25rem;

    padding: 1rem;

    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 0.75rem;

    background: rgba(196, 83, 94, 0.06);
}

.player-plays-summary span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.player-plays-summary strong {
    color: var(--primary);
    font-size: 1.5rem;
}

.player-plays-list {
    display: grid;
    gap: 0.65rem;
}

.player-play-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    padding: 0.9rem 1rem;

    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 0.7rem;

    background: #fff;
}

.player-play-history-game {
    display: grid;
    gap: 0.2rem;
}

.player-play-history-game strong {
    color: var(--ink);
}

.player-play-history-game span {
    color: var(--muted);
    font-size: 0.85rem;
}

.player-play-history-count {
    display: grid;
    flex: 0 0 auto;

    min-width: 62px;

    text-align: center;
}

.player-play-history-count strong {
    color: var(--primary);
    font-size: 1.25rem;
}

.player-play-history-count span {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.player-plays-loading,
.player-plays-message {
    padding: 2rem 1rem;
    color: var(--muted);
    text-align: center;
}

.player-plays-error {
    color: #a3323c;
}

@media (max-width: 520px) {
    .player-plays-summary {
        grid-template-columns: 1fr;
    }

    .player-play-history-row {
        align-items: flex-start;
    }
}
/*--------------------------------------------------------------
Responsive
--------------------------------------------------------------*/

@media (max-width: 700px) {

    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

}