.game-detail-page .rating-card--compact {
    padding: 14px;
}

.rating-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rating-card-heading h2 {
    margin: 0;
}

.rating-summary-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
    margin-top: 10px;
}

.rating-average {
    display: flex;
    flex: 0 0 auto;
    align-items: baseline;
    gap: 4px;
    margin: 0;
    color: var(--game-detail-ink, #f1f5f8);
}

.rating-average strong {
    font-size: 1.55rem;
    line-height: 1;
}

.rating-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.rating-reference {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 7px;
    color: #ffe0a1;
    border: 1px solid #80612d;
    border-radius: 5px;
    background: rgba(117, 77, 18, 0.35);
    font-size: 0.72rem;
    font-weight: 700;
}

.rating-distribution {
    display: grid;
    gap: 5px;
    max-width: 720px;
}

.rating-distribution-row {
    display: grid;
    grid-template-columns: 24px minmax(90px, 1fr) 64px 52px;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
}

.rating-distribution-track {
    display: block;
    height: 8px;
    overflow: hidden;
    border-radius: 3px;
    background: #243442;
}

.rating-distribution-track > span {
    display: block;
    height: 100%;
    background: var(--game-detail-blue, #4b8df8);
}

.rating-input-dialog {
    width: min(620px, calc(100vw - 32px));
    max-height: min(760px, calc(100dvh - 32px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--game-detail-line, #2a3a48);
    border-radius: 8px;
    color: var(--game-detail-ink, #f1f5f8);
    background: var(--game-detail-surface, #111b25);
    box-shadow: 0 24px 72px rgb(0 0 0 / 52%);
}

.rating-input-dialog::backdrop {
    background: rgb(3 8 13 / 76%);
    backdrop-filter: blur(3px);
}

.rating-input-dialog__shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: min(760px, calc(100dvh - 32px));
}

.rating-input-dialog__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--game-detail-line, #2a3a48);
}

.rating-input-dialog__header p {
    margin: 0 0 2px;
    color: var(--game-detail-blue, #4b8df8);
    font-size: 0.68rem;
    font-weight: 800;
}

.rating-input-dialog__header h2 {
    max-width: 34ch;
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.rating-input-dialog__close {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    color: var(--game-detail-ink, #f1f5f8);
    border: 1px solid var(--game-detail-line, #2a3a48);
    border-radius: 6px;
    background: var(--game-detail-surface-strong, #162331);
    cursor: pointer;
    font-size: 1.35rem;
}

.rating-input-dialog [data-rating-form] {
    display: grid;
    gap: 14px;
    min-height: 0;
    padding: 18px 16px;
    overflow-y: auto;
}

.rating-input-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
}

.rating-input-score output {
    display: inline-block;
    min-width: 1.35em;
    color: #fff;
    -webkit-text-fill-color: #fff;
    font-size: clamp(2.8rem, 8vw, 4.2rem);
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.rating-input-score span {
    color: #b8c6d1;
    font-weight: 700;
}

.rating-input-label {
    min-height: 1.5em;
    margin: -6px 0 0;
    color: #d8e8ff;
    font-weight: 700;
    text-align: center;
}

.rating-note {
    margin: 0;
    color: #c3d0da;
    font-size: 0.8rem;
}

.rating-score-control {
    display: grid;
    grid-template-columns: 44px minmax(180px, 1fr) 44px;
    align-items: center;
    gap: 12px;
}

.rating-step {
    width: 44px;
    height: 44px;
    color: var(--game-detail-ink, #f1f5f8);
    border: 1px solid var(--game-detail-line, #2a3a48);
    border-radius: 6px;
    background: var(--game-detail-surface-strong, #162331);
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 700;
}

.rating-step:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.rating-slider-wrap {
    min-width: 0;
}

.rating-slider-wrap input[type="range"] {
    width: 100%;
    min-height: 44px;
    margin: 0;
    accent-color: var(--game-detail-blue, #4b8df8);
}

.rating-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: -5px;
    color: var(--game-detail-muted, #9aa9b6);
    font-size: 0.72rem;
}

.rating-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.rating-actions button,
.rating-delete-form button {
    min-height: 44px;
}

.rating-actions button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.rating-delete-form {
    margin: 0;
    padding: 0 16px 16px;
}

.rating-delete-form button {
    padding: 6px 0;
    color: #ff9da6;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rating-input-dialog :focus-visible,
.rating-card :focus-visible {
    outline: 3px solid #f2ad3c;
    outline-offset: 2px;
}

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

@media (max-width: 600px) {
    .rating-input-dialog {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
    }

    .rating-distribution-row {
        grid-template-columns: 20px minmax(70px, 1fr) 54px;
    }

    .rating-distribution-row > span:last-child {
        display: none;
    }

    .rating-input-dialog__shell {
        max-height: calc(100dvh - 20px);
    }

    .rating-input-dialog__header,
    .rating-input-dialog [data-rating-form] {
        padding: 14px;
    }

    .rating-score-control {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 8px;
    }

    .rating-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .rating-actions button {
        width: 100%;
        white-space: normal;
    }

    .rating-delete-form {
        padding: 0 14px calc(14px + env(safe-area-inset-bottom));
    }
}
