/* styles.css */
:root {
    color-scheme: dark;

    --background: #100d16;
    --surface: #1b1723;
    --surface-raised: #241d30;
    --border: #393044;
    --orange: #ff762b;
    --orange-hover: #ff8a49;
    --purple: #9b6dff;
    --text: #f8f3fc;
    --muted: #aaa1b8;
    --gold: #ffd166;

    --radius: 16px;
    --radius-small: 10px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(
            ellipse at 0% 0%,
            #38203f 0%,
            transparent 40%
        ),
        radial-gradient(
            ellipse at 100% 50%,
            #291b3b 0%,
            transparent 38%
        ),
        var(--background);
}

main {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 28px 18px 40px;
}

/* Headings */

h1,
h2,
h3,
h4,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 8vw, 2.8rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.055em;
}

h1 + p {
    margin: 10px 0 26px;
    color: var(--muted);
}

h2 {
    margin: 0 0 18px;
    font-size: 1.4rem;
    line-height: 1.25;
}

h3 {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

h4 {
    margin: 0 0 6px;
    font-size: 1rem;
}

p {
    color: var(--muted);
}

strong {
    color: var(--text);
}

/* Main sections */

#join-section,
#player-section,
#admin-section,
#catalog-section > section,
#transaction-history-section,
#activity-award-section {
    min-width: 0;
}

#join-section,
#player-section {
    padding: 22px;
    background: rgb(27 23 35 / 94%);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 16px 44px rgb(0 0 0 / 20%);
}

#join-section > h2 {
    margin-bottom: 20px;
}

#join-options {
    display: grid;
    gap: 12px;
}

#player-section > h2 {
    margin-bottom: 10px;
}

#player-section > p {
    margin: 8px 0;
}

#player-section > p strong {
    color: var(--orange);
}

/* Forms and labels */

form {
    min-width: 0;
}

label,
legend {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 650;
}

form > label,
#activity-fields > label,
#adjustment-fields > label {
    display: block;
    margin: 16px 0 7px;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 11px 12px;
    color: var(--text);
    background: #15111d;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    font: inherit;
    font-size: 16px;
}

input::placeholder,
textarea::placeholder {
    color: #82798e;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--purple);
    outline-offset: 2px;
    border-color: var(--purple);
}

input[type="checkbox"] {
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
    margin: 0;
    accent-color: var(--orange);
}

fieldset {
    min-width: 0;
    margin: 20px 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

legend {
    padding: 0 6px;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 16px;
    color: var(--text);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    font: inherit;
    font-weight: 750;
    text-align: center;
    cursor: pointer;
    transition:
        background 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

button:hover {
    background: #30213f;
    border-color: var(--purple);
}

button:active {
    transform: scale(0.98);
}

button:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 3px;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* Primary actions */

#join-form button[type="submit"],
#rejoin-form button[type="submit"],
#award-activity-button {
    color: #1b1010;
    background: var(--orange);
    border-color: var(--orange);
}

#join-form button[type="submit"]:hover,
#rejoin-form button[type="submit"]:hover,
#award-activity-button:hover {
    background: var(--orange-hover);
    border-color: var(--orange-hover);
}

#join-form button,
#rejoin-form button {
    width: 100%;
    margin-top: 12px;
}

#cancel-join-button,
#cancel-rejoin-button {
    color: var(--muted);
    background: transparent;
}

#logout-button {
    margin-top: 14px;
}

/* Status and feedback */

#status-message {
    margin: 18px 2px 0;
    color: var(--orange);
    font-size: 0.9rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

#award-preview,
#transactions-status {
    padding: 12px;
    background: #17121f;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    font-size: 0.9rem;
}

/* Admin dashboard */

#admin-section {
    display: grid;
    gap: 16px;
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

#admin-section > h2 {
    margin: 0;
    color: var(--purple);
}

#admin-section > p {
    font-size: 0.9rem;
}

#refresh-players-button,
#toggle-transactions-button {
    width: 100%;
    margin: 8px 0 12px;
}

/* Player management and transaction tables */

#admin-players-list,
#transactions-list {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--purple) var(--surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

th {
    color: var(--muted);
    background: #17121f;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

tbody tr:last-child td {
    border-bottom: 0;
}

td button {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 0.8rem;
}

/* Ticket management */

#award-activity-form > label {
    display: block;
    margin: 16px 0 7px;
}

#activity-fields,
#adjustment-fields {
    margin-top: 12px;
}

#award-players-list {
    display: grid;
    gap: 12px;
}

#award-players-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--surface-raised);
    border-radius: 9px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

#award-activity-button {
    width: 100%;
}

/* Activities and reward shop */

#catalog-section {
    display: grid;
    gap: 20px;
    margin-top: 28px;
}

#catalog-section > section {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

#catalog-section h3 {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

#activities-list,
#rewards-list {
    display: grid;
    gap: 12px;
}

#activities-list article,
#rewards-list article {
    min-width: 0;
    padding: 14px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
}

#activities-list article p,
#rewards-list article p {
    margin: 6px 0 0;
    font-size: 0.9rem;
}

#activities-list article p:last-child,
#rewards-list article p:last-child {
    color: var(--orange);
    font-weight: 750;
}

#rewards-list article p:last-child {
    color: var(--muted);
    font-weight: 400;
    font-size: 0.85rem;
}

/* Transaction history */

#transactions-container {
    min-width: 0;
}

#transactions-container[hidden] {
    display: none !important;
}

/* Larger phones and tablets */

@media (min-width: 600px) {
    main {
        padding: 38px 26px 48px;
    }

    #join-section,
    #player-section {
        padding: 28px;
    }

    #join-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #catalog-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
}

/* Reduced motion accessibility */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* App header */

.app-header {
    margin-bottom: 24px;
}

.app-eyebrow,
.section-eyebrow {
    margin: 0 0 7px;
    color: var(--orange);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.16em;
}

.app-header h1 span {
    color: var(--orange);
}

.app-subtitle {
    margin: 8px 0 0;
}

/* Consistent app views */

.app-view {
    min-width: 0;
    animation: view-appear 180ms ease-out;
}

.app-view > h2 {
    margin-bottom: 10px;
}

.view-description {
    margin: 0 0 18px;
}

.welcome-row,
.view-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    margin-bottom: 18px;
}

.welcome-row h2,
.view-heading h2 {
    margin: 0;
}

.role-pill {
    flex-shrink: 0;
    padding: 6px 10px;
    color: #d9c5ff;
    background: #30213f;
    border: 1px solid #5d3d77;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 750;
    text-transform: capitalize;
}

/* Ticket balance */

.balance-card {
    margin: 20px 0;
    padding: 22px;
    background:
        radial-gradient(ellipse at 100% 0%, #54356b, transparent 65%),
        #30213f;
    border: 1px solid #5d3d77;
    border-radius: 18px;
}

.balance-label {
    margin: 0 0 8px;
    color: #d9c5ff;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.09em;
}

.balance-amount {
    display: flex;
    align-items: center;
    gap: 12px;
}

.balance-amount > span {
    font-size: 1.8rem;
}

.balance-amount strong {
    color: var(--orange);
    font-size: clamp(2.5rem, 12vw, 3.5rem);
    font-weight: 900;
    letter-spacing: -0.06em;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.balance-caption {
    margin: 10px 0 0;
    font-size: 0.85rem;
}

.balance-mini {
    flex-shrink: 0;
    padding: 8px 10px;
    color: var(--orange);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 800;
}

/* Home screen shortcuts */

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.shortcut-card {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    min-height: 130px;
    padding: 16px;
    text-align: left;
    background: var(--surface-raised);
    border-radius: 14px;
}

.shortcut-card:hover {
    border-color: var(--purple);
}

.shortcut-icon {
    margin-bottom: 4px;
    font-size: 1.5rem;
}

.shortcut-title {
    font-size: 1rem;
    font-weight: 850;
}

.shortcut-description {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.home-preview {
    margin-top: 24px;
}

.home-preview h3 {
    margin: 0;
}

.text-button {
    min-height: 36px;
    padding: 6px 0 6px 10px;
    color: var(--orange);
    background: transparent;
    border: 0;
    font-size: 0.85rem;
}

.text-button:hover {
    color: var(--orange-hover);
    background: transparent;
    border-color: transparent;
}

.preview-list,
.catalog-list {
    display: grid;
    gap: 10px;
}

.catalog-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.catalog-card-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    object-fit: contain;
    padding: 5px;
    background: #30213f;
    border-radius: 10px;
}

.catalog-card-content {
    flex: 1;
    min-width: 0;
}

.catalog-card-content h3 {
    margin: 0 0 5px;
    font-size: 0.98rem;
    overflow-wrap: anywhere;
}

.catalog-card-content p {
    margin: 5px 0 0;
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.catalog-card-content .catalog-card-value {
    color: var(--orange);
    font-weight: 800;
}

.catalog-card-stock {
    color: var(--muted);
}

#rewards-list .catalog-card-value {
    color: var(--gold);
}

.preview-card {
    padding: 12px;
}

.preview-card .catalog-card-icon {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
}

/* Account */

.account-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.account-label {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.8rem;
}

.account-label:first-child {
    margin-top: 0;
}

.account-card strong {
    overflow-wrap: anywhere;
}

#account-view #logout-button {
    width: 100%;
    margin-top: 16px;
}

/* Admin workspace */

#admin-section {
    margin-top: 0;
}

.admin-shortcuts {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.admin-shortcuts button {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 3px 10px;
    justify-content: start;
    text-align: left;
}

.admin-shortcuts button > span {
    grid-row: 1 / span 2;
    font-size: 1.35rem;
}

.admin-shortcuts button strong {
    align-self: end;
}

.admin-shortcuts button small {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

/* Fixed bottom navigation */

.bottom-navigation {
    position: fixed;
    z-index: 20;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 8px 6px max(8px, env(safe-area-inset-bottom));
    background: rgb(27 23 35 / 97%);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 28px rgb(0 0 0 / 25%);
    backdrop-filter: blur(16px);
}

.bottom-navigation[hidden] {
    display: none !important;
}

.nav-button {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 54px;
    padding: 6px 2px;
    color: var(--muted);
    background: transparent;
    border-color: transparent;
    font-size: 0.68rem;
}

.nav-button > span:first-child {
    font-size: 1.2rem;
    line-height: 1.2;
}

.nav-button:hover {
    color: var(--text);
    background: #30213f;
}

.nav-button.is-active {
    color: var(--orange);
    background: #30213f;
    border-color: #5d3d77;
}

/* Make room for the fixed navigation */

body:has(#app-navigation:not([hidden])) main {
    padding-bottom: 110px;
}

/* View transitions */

@keyframes view-appear {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

@media (min-width: 600px) {
    .admin-shortcuts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-view {
        animation: none;
    }
}

.bottom-navigation {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bottom-navigation.has-admin {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

#admin-section {
    display: block;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.nav-button svg {
    width: 21px;
    height: 21px;
    stroke-width: 1.8;
}

.shortcut-icon {
    width: 25px;
    height: 25px;
    color: var(--orange);
    stroke-width: 1.8;
}

.admin-shortcuts svg {
    width: 23px;
    height: 23px;
    color: var(--orange);
}

/* Toast notifications */
#status-message {
    position: fixed;
    z-index: 100;
    right: 16px;
    bottom: 92px;
    left: 16px;

    width: auto;
    max-width: 500px;
    margin: 0 auto;
    padding: 14px 18px;

    color: var(--text);
    background: #30213f;
    border: 1px solid var(--purple);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgb(0 0 0 / 35%);

    font-size: .9rem;
    font-weight: 650;
    line-height: 1.5;

    animation: toast-appear 180ms ease-out;
}

#status-message[hidden] {
    display: none !important;
}

@keyframes toast-appear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

@media (prefers-reduced-motion: reduce) {
    #status-message {
        animation: none;
    }
}


/* ========================================
   FINAL LUCIDE ICON + LAYOUT POLISH
======================================== */

/* Main ticket balance */
.balance-amount {
    gap: 14px;
}

.balance-amount .balance-icon {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    color: var(--orange);
    stroke-width: 1.8;
}

.balance-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    white-space: nowrap;
}

.balance-mini svg {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    stroke-width: 2;
}

/* Home shortcuts */
.shortcut-card {
    position: relative;
    justify-content: flex-start;
    gap: 8px;
    min-height: 136px;
    overflow: hidden;
}

.shortcut-card > svg {
    flex: 0 0 auto;
    width: 27px;
    height: 27px;
    margin-bottom: 5px;
    color: var(--orange);
    stroke-width: 1.8;
}

.shortcut-title {
    line-height: 1.25;
}

.shortcut-description {
    line-height: 1.4;
}

/* Section headings and View All buttons */
.view-heading {
    align-items: center;
}

.view-heading > div {
    min-width: 0;
}

.view-heading .section-eyebrow {
    margin-bottom: 4px;
}

.text-button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 5px;
    min-height: 40px;
    white-space: nowrap;
}

.text-button svg {
    width: 16px;
    height: 16px;
}

/* Admin shortcuts: icon, title and description */
.admin-shortcuts {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.admin-shortcuts button {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    justify-content: initial;
    gap: 4px 12px;
    width: 100%;
    min-height: 84px;
    padding: 16px;
    text-align: left;
}

.admin-shortcuts .admin-shortcut-icon {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: center;
    width: 24px;
    height: 24px;
    color: var(--orange);
    stroke-width: 1.8;
}

.admin-shortcuts button strong {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    line-height: 1.3;
}

.admin-shortcuts button small {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    line-height: 1.4;
}

/* Bottom navigation icons */
.bottom-navigation {
    gap: 3px;
}

.nav-button {
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 2px;
}

.nav-button > svg {
    display: block;
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    stroke-width: 1.8;
}

.nav-button > span {
    display: block;
    max-width: 100%;
    overflow-wrap: normal;
    line-height: 1.2;
    text-align: center;
}

.nav-button.is-active > svg {
    stroke-width: 2.2;
}

/* Catalog cards */
.catalog-card {
    align-items: flex-start;
    gap: 13px;
}

.catalog-card-icon {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
}

.catalog-card-content h3 {
    line-height: 1.35;
}

.catalog-card-content p {
    line-height: 1.45;
}

/* Account information */
.account-card {
    gap: 5px;
}

.account-card .account-label {
    margin-top: 12px;
}

.account-card .account-label:first-child {
    margin-top: 0;
}

.account-card strong {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.account-card strong:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

#account-role {
    text-transform: capitalize;
}

/* Toast stays above the navigation */
#status-message {
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: calc(100% - 32px);
}

/* Wider screens */
@media (min-width: 600px) {
    .admin-shortcuts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Very narrow phones */
@media (max-width: 360px) {
    main {
        padding-right: 12px;
        padding-left: 12px;
    }

    #join-section,
    #player-section {
        padding: 16px;
    }

    .balance-card {
        padding: 18px;
    }

    .balance-amount {
        gap: 10px;
    }

    .balance-amount .balance-icon {
        width: 26px;
        height: 26px;
    }

    .shortcut-grid {
        gap: 8px;
    }

    .shortcut-card {
        padding: 12px;
    }

    .nav-button {
        font-size: 0.63rem;
    }
}

/* Toast entrance and exit animations */
#status-message {
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 300ms ease,
        transform 300ms ease;
}

#status-message.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

#status-message.toast-hiding {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    #status-message {
        transition: none;
    }
}

/* Transaction refresh control */
#toggle-transactions-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 8px 0 16px;
}

#toggle-transactions-button svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

#toggle-transactions-button:disabled {
    opacity: 0.65;
    cursor: wait;
}


/* Voting administration */

.admin-voting-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    color: var(--orange);
}

.voting-admin-card {
    min-width: 0;
    margin-top: 18px;
    padding: 18px;
    background:
        radial-gradient(ellipse at 100% 0%, #382747, transparent 65%),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.voting-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voting-status-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    background: var(--muted);
    border-radius: 50%;
}

.voting-admin-card.is-active .voting-status-dot {
    background: #62d99a;
    box-shadow: 0 0 12px rgb(98 217 154 / 45%);
}

.voting-admin-card.is-ended .voting-status-dot {
    background: var(--purple);
}

.voting-admin-card > p {
    font-size: 0.9rem;
}

#voting-start-form {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

#voting-start-form label {
    margin: 0;
}

#voting-start-button,
#voting-new-session-button {
    width: 100%;
    gap: 8px;
    color: #1b1010;
    background: var(--orange);
    border-color: var(--orange);
}

#voting-start-button:hover,
#voting-new-session-button:hover {
    background: var(--orange-hover);
    border-color: var(--orange-hover);
}

#voting-start-button svg,
#voting-end-button svg,
#voting-new-session-button svg {
    width: 18px;
    height: 18px;
}

#voting-add-option-button {
    margin-top: 1rem;
}

.voting-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    font-size: 0.9rem;
}

.voting-progress > span {
    color: var(--muted);
}

.voting-progress-track {
    height: 9px;
    margin-top: 10px;
    overflow: hidden;
    background: #15111d;
    border: 1px solid var(--border);
    border-radius: 999px;
}

#voting-progress-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--orange));
    border-radius: inherit;
    transition: width 200ms ease;
}

.voting-privacy-note {
    margin: 16px 0;
    padding: 12px;
    background: rgb(155 109 255 / 8%);
    border: 1px solid rgb(155 109 255 / 25%);
    border-radius: var(--radius-small);
}

#voting-end-button {
    width: 100%;
    gap: 8px;
}

.button-danger {
    background: #51232e;
    border-color: #813344;
}

.button-danger:hover {
    background: #682a39;
    border-color: #b94d63;
}

#voting-results-card h3 {
    margin: 0;
}

#voting-results-list {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.voting-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.voting-result-row.is-winner {
    border-color: var(--gold);
    background: rgb(255 209 102 / 7%);
}

.voting-result-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 750;
}

.voting-result-count {
    flex: 0 0 auto;
    color: var(--orange);
    font-size: 0.9rem;
    font-weight: 850;
}

@media (prefers-reduced-motion: reduce) {
    #voting-progress-fill {
        transition: none;
    }
}

/* Custom voting poll options */
.voting-option-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 12px;
}

.voting-option-row > div {
    flex: 1;
    min-width: 0;
}

.voting-option-row label {
    display: block;
}

.voting-option-row input {
    width: 100%;
    box-sizing: border-box;
}

.voting-option-row .voting-remove-option {
    flex-shrink: 0;
    margin-bottom: 0;
}

/* ========================================
   PLAYER VOTING BANNER
======================================== */

.active-voting-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0 0 20px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--orange);
    border-radius: var(--radius-small);
    box-sizing: border-box;
}

.active-voting-banner-open {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 12px;
    min-width: 0;
    min-height: 58px;
    padding: 8px 10px;
    color: var(--text);
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 8px;
}

.active-voting-banner-open:hover {
    background: var(--surface-raised);
    border-color: transparent;
}

.active-voting-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    color: var(--orange);
    background: rgb(255 118 43 / 10%);
    border-radius: 10px;
}

.active-voting-icon svg {
    width: 21px;
    height: 21px;
}

.active-voting-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.active-voting-content strong {
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.3;
}

.active-voting-content > span {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.active-voting-action {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    color: var(--muted);
    transition: color 150ms ease, transform 150ms ease;
}

.active-voting-action svg {
    width: 18px;
    height: 18px;
}

.active-voting-banner-open:hover .active-voting-action {
    color: var(--orange);
    transform: translateX(2px);
}

.active-voting-banner-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
}

.active-voting-banner-close:hover {
    color: var(--text);
    background: var(--surface-raised);
    border-color: var(--border);
}

.active-voting-banner-close svg {
    width: 17px;
    height: 17px;
}

/* Ended voting: shift the accent toward results */
.active-voting-banner:has(
    .active-voting-banner-close:not([hidden])
) {
    border-left-color: var(--gold);
}

.active-voting-banner:has(
    .active-voting-banner-close:not([hidden])
) .active-voting-icon {
    color: var(--gold);
    background: rgb(255 209 102 / 10%);
}

@media (max-width: 360px) {
    .active-voting-banner {
        gap: 4px;
        padding: 6px;
    }

    .active-voting-banner-open {
        gap: 8px;
        padding: 8px 4px;
    }

    .active-voting-icon {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
    }

    .active-voting-banner-close {
        flex-basis: 30px;
        width: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .active-voting-action {
        transition: none;
    }
}

/* ========================================
   PLAYER VOTING SCREEN
======================================== */

#player-voting-content {
    display: grid;
    gap: 14px;
    min-width: 0;
}

#player-voting-content > h3 {
    margin: 4px 0 0;
    font-size: 1.2rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

#player-voting-content > p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

/* Available voting choices */
.player-voting-choices {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.player-voting-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: background 150ms ease, border-color 150ms ease;
}

.player-voting-choice:hover {
    background: var(--surface-raised);
    border-color: #685080;
}

.player-voting-choice.is-selected {
    background:
        linear-gradient(100deg, rgb(255 118 43 / 9%), transparent 90%),
        var(--surface);
    border-color: var(--orange);
}

.player-voting-choice-button {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 12px;
    color: var(--text);
    text-align: left;
    overflow-wrap: anywhere;
    background: transparent;
    border: 0;
    border-radius: 8px;
}

.player-voting-choice-button:hover:not(:disabled) {
    background: transparent;
    border-color: transparent;
}

.player-voting-choice-button:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 1px;
}

.player-voting-choice-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.player-voting-selected {
    flex: 0 0 auto;
    max-width: 44%;
    padding: 6px 9px;
    color: var(--orange);
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
    background: rgb(255 118 43 / 10%);
    border: 1px solid rgb(255 118 43 / 25%);
    border-radius: 8px;
}

/* ========================================
   PLAYER VOTING RESULTS
======================================== */

.player-voting-results {
    display: grid;
    gap: 10px;
    min-width: 0;
    margin-top: 2px;
}

.player-voting-results .voting-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.player-voting-results .voting-result-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 750;
}

.player-voting-results .voting-result-count {
    flex: 0 0 auto;
    color: var(--orange);
    font-size: 0.85rem;
    font-weight: 850;
    white-space: nowrap;
}

/* Mobile layout */
@media (max-width: 380px) {
    .player-voting-choice {
        gap: 5px;
        padding: 4px;
    }

    .player-voting-choice-button {
        padding: 10px 8px;
    }

    .player-voting-selected {
        max-width: 40%;
        padding: 5px 6px;
        font-size: 0.65rem;
    }

    .player-voting-results .voting-result-row {
        gap: 8px;
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .player-voting-choice {
        transition: none;
    }
}

.player-voting-results .voting-result-row.is-winner {
    background:
        linear-gradient(100deg, rgb(255 209 102 / 8%), transparent 90%),
        var(--surface);
    border-color: rgb(255 209 102 / 45%);
}

.player-voting-results .voting-result-row.is-winner .voting-result-count {
    color: var(--gold);
}

/* ========================================
   REWARD CARD + REWARD CLAIMS POLISH
======================================== */

/* Keep reward information grouped and actions aligned */
#rewards-list .catalog-card-content,
#home-rewards-list .catalog-card-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
}

/* Give the stock count a subtle, compact status treatment */
#rewards-list .catalog-card-stock,
#home-rewards-list .catalog-card-stock {
    align-self: flex-start;
    margin-top: 10px;
    padding: 5px 9px;
    color: var(--muted);
    background: rgb(255 255 255 / 3%);
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 0.78rem;
    line-height: 1.35;
}

.admin-shortcut-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    color: var(--orange);
}

/* Redeem becomes a deliberate primary action */
#rewards-list .redeem-reward-button,
#home-rewards-list .redeem-reward-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 38px;
    margin-top: 10px;
    padding: 8px 10px;
    color: #1b1010;
    background: var(--orange);
    border: 1px solid var(--orange);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: anywhere;
    transition:
        background 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

#rewards-list .redeem-reward-button:hover:not(:disabled),
#home-rewards-list .redeem-reward-button:hover:not(:disabled) {
    background: var(--orange-hover);
    border-color: var(--orange-hover);
    box-shadow: 0 4px 14px rgb(255 118 43 / 16%);
}

#rewards-list .redeem-reward-button:focus-visible,
#home-rewards-list .redeem-reward-button:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 3px;
}

#rewards-list .redeem-reward-button:disabled,
#home-rewards-list .redeem-reward-button:disabled {
    color: var(--muted);
    background: #211b29;
    border-color: var(--border);
    box-shadow: none;
    opacity: 1;
    cursor: not-allowed;
}

/* Slightly tighten the compact home-preview cards */
#home-rewards-list .catalog-card {
    gap: 10px;
    padding: 12px;
}

#home-rewards-list .catalog-card-content h3 {
    margin-bottom: 4px;
}

#home-rewards-list .redeem-reward-button {
    min-height: 38px;
    margin-top: 10px;
    font-size: 0.82rem;
}

/* Reward claims admin view */
#admin-reward-claims-view .view-heading {
    align-items: center;
}

#admin-reward-claims-view #reward-claims-status {
    width: auto;
    max-width: 58%;
    min-width: 0;
    min-height: 42px;
    padding: 8px 30px 8px 10px;
    font-size: 0.88rem;
}

#refresh-reward-claims-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 8px;
    margin: 8px 0 14px;
}

/* Give claim status feedback a consistent panel */
#reward-claims-status-message {
    margin: 12px 0;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* Make the claim table feel like a deliberate admin component */
#reward-claims-list {
    margin-top: 12px;
    background: rgb(27 23 35 / 70%);
    border: 1px solid var(--border);
    border-radius: 12px;
}

#reward-claims-list:empty {
    display: none;
}

#reward-claims-list table {
    min-width: 100%;
}

#reward-claims-list td button {
    margin: 2px 4px 2px 0;
}

/* Small-screen refinements */
@media (max-width: 380px) {
    #rewards-list .catalog-card,
    #home-rewards-list .catalog-card {
        gap: 9px;
        padding: 11px;
    }

    #rewards-list .catalog-card-icon,
    #home-rewards-list .catalog-card-icon {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
    }

    #admin-reward-claims-view #reward-claims-status {
        max-width: 62%;
        font-size: 0.82rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    #rewards-list .redeem-reward-button,
    #home-rewards-list .redeem-reward-button {
        transition: none;
    }
}

/* Align reward availability and redeem action in one row */
.catalog-card-reward-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    min-width: 0;
}

.catalog-card-reward-actions .catalog-card-stock {
    flex: 0 1 auto;
    width: fit-content;
    min-width: 0;
    margin: 0;
    padding: 7px 9px;
    text-align: center;
    overflow-wrap: anywhere;
}

.catalog-card-reward-actions .redeem-reward-button {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    margin-top: 0;
}

/* Keep the row compact on the home preview cards */
#home-rewards-list .catalog-card-reward-actions {
    gap: 8px;
    margin-top: 10px;
}

#home-rewards-list .catalog-card-reward-actions .catalog-card-stock {
    padding: 6px 8px;
    font-size: 0.72rem;
}

#home-rewards-list .catalog-card-reward-actions .redeem-reward-button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.82rem;
}

@media (max-width: 380px) {
    .catalog-card-reward-actions {
        gap: 6px;
    }

    .catalog-card-reward-actions .catalog-card-stock {
        padding: 6px 7px;
        font-size: 0.72rem;
    }

    .catalog-card-reward-actions .redeem-reward-button {
        padding: 8px;
        font-size: 0.78rem;
    }
}

.catalog-card-reward-actions .catalog-card-stock {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 112px;
    width: 112px;
    height: 38px;
    margin: 0;
    padding: 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.76rem;
    line-height: 1;
}

/* Keep the pill the same size on home preview cards */
#home-rewards-list .catalog-card-reward-actions .catalog-card-stock {
    flex-basis: 112px;
    width: 112px;
    height: 38px;
    padding: 0 6px;
    font-size: 0.72rem;
}

@media (max-width: 380px) {
    .catalog-card-reward-actions .catalog-card-stock,
    #home-rewards-list .catalog-card-reward-actions .catalog-card-stock {
        flex-basis: 112px;
        width: 112px;
        height: 38px;
    }
}

/* ========================================
   OWNER-ONLY GAME MANAGEMENT
======================================== */

#admin-manage-game-view .view-heading {
    position: relative;
    align-items: center;
    margin-bottom: 12px;
}

#admin-manage-game-view .view-heading > div {
    min-width: 0;
}

#admin-manage-game-view .admin-shortcut-icon {
    width: 30px;
    height: 30px;
    color: var(--orange);
    filter: drop-shadow(0 0 10px rgb(255 118 43 / 18%));
}

#admin-manage-game-view .view-description {
    margin-bottom: 24px;
    line-height: 1.65;
}

/* Reset option cards */

#admin-manage-game-view .voting-admin-card {
    position: relative;
    margin-top: 14px;
    padding: 20px;
    overflow: hidden;
    background:
        radial-gradient(
            ellipse at 100% 0%,
            rgb(155 109 255 / 9%),
            transparent 65%
        ),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition:
        border-color 180ms ease,
        background 180ms ease,
        transform 180ms ease;
}

#admin-manage-game-view .voting-admin-card::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    background: var(--orange);
    content: "";
    opacity: 0.8;
}

#admin-manage-game-view .voting-admin-card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    line-height: 1.4;
}

#admin-manage-game-view .voting-admin-card p {
    margin: 0 0 18px;
    font-size: 0.88rem;
    line-height: 1.65;
}

/* Reset buttons */

#admin-manage-game-view .voting-admin-card > button {
    width: 100%;
    min-height: 46px;
    gap: 8px;
}

#admin-manage-game-view .button-danger {
    color: #ffe8ed;
    background: #48202b;
    border-color: #743343;
}

#admin-manage-game-view .button-danger:hover:not(:disabled) {
    background: #602735;
    border-color: #b94d63;
}

#admin-manage-game-view .voting-admin-card:first-of-type .button-danger {
    color: #fff0e7;
    background: #542a24;
    border-color: #8d4937;
}

#admin-manage-game-view .voting-admin-card:first-of-type .button-danger:hover:not(:disabled) {
    background: #6b3329;
    border-color: var(--orange);
}

/* Confirmation panel */

#manage-game-reset-form {
    display: grid;
    gap: 10px;
    margin-top: 22px;
    padding: 22px;
    background:
        linear-gradient(
            145deg,
            rgb(255 118 43 / 7%),
            transparent 60%
        ),
        #17121f;
    border: 1px solid rgb(255 118 43 / 35%);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgb(0 0 0 / 18%);
}

#manage-game-reset-form h3 {
    margin: 0;
    font-size: 1.15rem;
}

#manage-game-reset-description {
    margin: 0 0 8px;
    font-size: 0.9rem;
    line-height: 1.6;
}

#manage-game-reset-form > label,
#manage-game-hard-confirmation > label {
    display: block;
    margin: 8px 0 0;
}

#manage-game-reset-form input {
    margin-bottom: 8px;
}

#manage-game-hard-confirmation {
    display: grid;
    gap: 8px;
    margin-top: 4px;
    padding: 14px;
    background: rgb(185 77 99 / 8%);
    border: 1px solid rgb(185 77 99 / 30%);
    border-radius: 12px;
}

#manage-game-hard-confirmation[hidden] {
    display: none !important;
}

#manage-game-hard-confirmation label {
    color: #ffb5c2;
}

#manage-game-confirmation {
    border-color: #743343;
}

#manage-game-confirmation:focus {
    outline-color: #e36b83;
    border-color: #e36b83;
}

/* Confirmation actions */

#manage-game-confirm-reset,
#manage-game-cancel-reset {
    width: 100%;
    margin-top: 4px;
}

#manage-game-confirm-reset {
    min-height: 48px;
}

#manage-game-cancel-reset {
    color: var(--muted);
    background: transparent;
    border-color: var(--border);
}

#manage-game-cancel-reset:hover:not(:disabled) {
    color: var(--text);
    background: var(--surface-raised);
    border-color: var(--purple);
}

/* Inline reset status */

#manage-game-reset-status {
    margin: 4px 0 0;
    padding: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#manage-game-reset-status:empty {
    display: none;
}

#manage-game-reset-status[data-state="error"] {
    padding: 11px 12px;
    color: #ffb5c2;
    background: rgb(185 77 99 / 10%);
    border: 1px solid rgb(185 77 99 / 30%);
    border-radius: 10px;
}

#manage-game-reset-status[data-state="success"] {
    color: #8ce6b1;
}

/* Keyboard and touch accessibility */

#admin-manage-game-view button:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 3px;
}

#admin-manage-game-view button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Larger screens */

@media (min-width: 600px) {
    #admin-manage-game-view .voting-admin-card {
        padding: 24px;
    }

    #manage-game-reset-form {
        padding: 26px;
    }

    #admin-manage-game-view .voting-admin-card > button {
        width: auto;
        min-width: 190px;
    }

    #manage-game-reset-form > button {
        width: auto;
    }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
    #admin-manage-game-view .voting-admin-card {
        transition: none;
    }
}

/* ========================================
   ACTIVITY PAYOUT SETTINGS
======================================== */

#admin-activity-payouts-view .view-heading {
    margin-bottom: 12px;
}

#admin-activity-payouts-view .view-heading > div {
    min-width: 0;
}

#admin-activity-payouts-view .admin-shortcut-icon {
    width: 30px;
    height: 30px;
    color: var(--orange);
    filter: drop-shadow(0 0 10px rgb(255 118 43 / 18%));
}

#admin-activity-payouts-view .view-description {
    margin-bottom: 22px;
    font-size: 0.9rem;
    line-height: 1.65;
}

/* Configuration form panel */

#activity-payout-settings-form {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 18px;
    background:
        radial-gradient(
            ellipse at 100% 0%,
            rgb(155 109 255 / 7%),
            transparent 65%
        ),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

#activity-payout-settings-form > label {
    display: block;
    margin: 8px 0 -4px;
}

#activity-payout-settings-form select {
    margin-bottom: 4px;
}

/* Current activity summary */

#payout-current-summary {
    min-width: 0;
    margin: 4px 0 8px;
    padding: 14px;
    background: rgb(16 13 22 / 65%);
    border: 1px solid var(--border);
    border-left: 3px solid var(--purple);
    border-radius: 11px;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#payout-current-summary:empty {
    display: none;
}

/* Template explanation */

#payout-template-description {
    margin: -2px 0 8px;
    padding: 11px 12px;
    background: rgb(155 109 255 / 7%);
    border: 1px solid rgb(155 109 255 / 20%);
    border-radius: 10px;
    font-size: 0.84rem;
    line-height: 1.55;
}

/* Dynamically generated payout fields */

#payout-config-fields {
    display: grid;
    gap: 14px;
    min-width: 0;
    margin-top: 2px;
}

#payout-config-fields > label {
    display: block;
    margin: 0 0 -6px;
}

#payout-config-fields input,
#payout-config-fields select,
#payout-config-fields textarea {
    width: 100%;
    min-width: 0;
}

#payout-config-fields textarea {
    min-height: 130px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.55;
}

#payout-config-fields p {
    margin: -4px 0 0;
    font-size: 0.82rem;
    line-height: 1.5;
}

/* Save action */

#save-payout-settings-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin-top: 8px;
    color: #1b1010;
    background: var(--orange);
    border-color: var(--orange);
}

#save-payout-settings-button:hover:not(:disabled) {
    background: var(--orange-hover);
    border-color: var(--orange-hover);
    box-shadow: 0 4px 14px rgb(255 118 43 / 16%);
}

/* Inline status feedback */

#payout-settings-status {
    margin: 2px 0 0;
    font-size: 0.88rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#payout-settings-status:empty {
    display: none;
}

#payout-settings-status[data-state="error"] {
    padding: 11px 12px;
    color: #ffb5c2;
    background: rgb(185 77 99 / 10%);
    border: 1px solid rgb(185 77 99 / 30%);
    border-radius: 10px;
}

#payout-settings-status[data-state="success"] {
    color: #8ce6b1;
}

/* Focus and disabled states */

#admin-activity-payouts-view button:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 3px;
}

#admin-activity-payouts-view button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Larger screens */

@media (min-width: 600px) {
    #activity-payout-settings-form {
        padding: 24px;
    }

    #save-payout-settings-button {
        width: auto;
        min-width: 220px;
        justify-self: start;
    }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
    #save-payout-settings-button {
        transition: none;
    }
}

/* =========================================
   ACTIVITY PAYOUT ADMIN
   ========================================= */

#admin-activity-payouts-view,
#admin-activity-results-view {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

#admin-activity-payouts-view .view-heading,
#admin-activity-results-view .view-heading {
    margin-bottom: 0;
}

#admin-activity-payouts-view .view-description,
#admin-activity-results-view .view-description {
    max-width: 70ch;
    margin-top: -0.5rem;
    color: var(--muted);
    line-height: 1.65;
}

/* Shared panels */

#activity-payout-settings-form,
#activity-result-form,
#activity-result-preview,
#activity-result-history {
    min-width: 0;
}

#activity-payout-settings-form,
#activity-result-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        radial-gradient(
            circle at top right,
            rgb(155 109 255 / 7%),
            transparent 45%
        ),
        var(--surface);
    box-shadow: 0 8px 24px rgb(0 0 0 / 12%);
}

#activity-payout-settings-form label,
#activity-result-form label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Inputs and selectors */

#admin-activity-payouts-view select,
#admin-activity-payouts-view input,
#admin-activity-payouts-view textarea,
#admin-activity-results-view select,
#admin-activity-results-view input {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--background);
    color: var(--text);
    font: inherit;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

#admin-activity-payouts-view textarea {
    min-height: 9rem;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.55;
}

#admin-activity-payouts-view select:focus,
#admin-activity-payouts-view input:focus,
#admin-activity-payouts-view textarea:focus,
#admin-activity-results-view select:focus,
#admin-activity-results-view input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgb(155 109 255 / 18%);
}

#admin-activity-payouts-view input:disabled,
#admin-activity-results-view input:disabled,
#admin-activity-results-view select:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Current settings and template explanation */

#payout-current-summary,
#payout-template-description,
#activity-result-template-info {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--surface-raised);
    line-height: 1.6;
}

#payout-current-summary {
    border-left: 3px solid var(--purple);
    color: var(--text);
    font-weight: 600;
}

#payout-template-description {
    color: var(--muted);
    font-size: 0.9rem;
}

#activity-result-template-info {
    border-left: 3px solid var(--orange);
    color: var(--text);
}

/* Dynamic payout configuration fields */

#payout-config-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

#payout-config-fields label {
    margin-bottom: 0.45rem;
}

/* Buttons */

#admin-activity-payouts-view button,
#admin-activity-results-view button {
    min-height: 2.75rem;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--surface-raised);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        background 140ms ease,
        opacity 140ms ease;
}

#admin-activity-payouts-view button:hover:not(:disabled),
#admin-activity-results-view button:hover:not(:disabled) {
    border-color: var(--purple);
    background: #30263e;
}

#admin-activity-payouts-view button:active:not(:disabled),
#admin-activity-results-view button:active:not(:disabled) {
    transform: scale(0.985);
}

#admin-activity-payouts-view button:disabled,
#admin-activity-results-view button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#save-payout-settings-button,
#activity-result-preview-button,
#activity-result-confirm-button {
    width: 100%;
    border-color: transparent;
    background: var(--orange);
    color: #1b1010;
}

#admin-activity-payouts-view #save-payout-settings-button:hover:not(:disabled),
#admin-activity-results-view #activity-result-preview-button:hover:not(:disabled),
#admin-activity-results-view #activity-result-confirm-button:hover:not(:disabled) {
    border-color: transparent;
    background: var(--orange-hover);
}

#activity-result-confirm-button {
    background: var(--purple);
    color: #160e20;
}

#admin-activity-results-view #activity-result-confirm-button:hover:not(:disabled) {
    background: #b18cff;
}

/* Status and feedback */

#payout-settings-status,
#activity-result-status,
#activity-result-history-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

#payout-settings-status:empty,
#activity-result-status:empty {
    display: none;
}

/* Participant selection */

#activity-result-participants {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

#activity-result-participants legend {
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
}

#activity-result-participants-description {
    margin: 0 0 0.5rem;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

#activity-result-participants .activity-result-participant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.85rem;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: rgb(255 255 255 / 2%);
}

#activity-result-participants .activity-result-participant-row:has(
    .activity-result-participant-checkbox:checked
) {
    border-color: rgb(255 118 43 / 65%);
    background: rgb(255 118 43 / 6%);
}

#activity-result-participants .activity-result-participant-label {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex: 1;
    min-width: 0;
    margin: 0;
    font-weight: 500;
}

#activity-result-participants .activity-result-participant-label span {
    overflow-wrap: anywhere;
}

#activity-result-participants .activity-result-participant-checkbox {
    flex: 0 0 auto;
    width: 1.15rem;
    height: 1.15rem;
    min-height: auto;
    margin: 0;
    accent-color: var(--orange);
    cursor: pointer;
}

/* Team and placement selectors */

#activity-result-participants .activity-result-team,
#activity-result-participants .activity-result-placement {
    flex: 0 1 9rem;
    width: auto;
    max-width: 45%;
}

#activity-result-participants .activity-result-wager {
    width: 6.5rem;
    flex: 0 0 6.5rem;
}

#activity-result-participants .activity-result-participant-row > label:not(
    .activity-result-participant-label
) {
    flex: 0 0 auto;
    width: 6.5rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

/* Result preview */

#activity-result-preview {
    padding: 1.25rem;
    border: 1px solid rgb(255 118 43 / 35%);
    border-radius: var(--radius);
    background:
        radial-gradient(
            circle at top right,
            rgb(255 118 43 / 7%),
            transparent 45%
        ),
        var(--surface);
}

#activity-result-preview h3,
#activity-result-history h3 {
    margin-top: 0;
}

#activity-result-preview-summary {
    color: var(--muted);
    line-height: 1.6;
}

/* History cards */

.activity-result-history-card {
    margin-bottom: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--surface);
}

.activity-result-history-card h4 {
    margin: 0 0 0.5rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.activity-result-history-card p {
    margin: 0 0 0.75rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.activity-result-history-card ul {
    display: grid;
    gap: 0.4rem;
    padding-left: 1.25rem;
    margin-bottom: 0;
    line-height: 1.5;
}

/* Responsive layout */

@media (min-width: 640px) {
    #activity-payout-settings-form,
    #activity-result-form {
        padding: 1.5rem;
    }

    #payout-config-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #save-payout-settings-button,
    #activity-result-preview-button,
    #activity-result-confirm-button {
        width: auto;
        align-self: flex-start;
        min-width: 12rem;
    }
}

@media (max-width: 420px) {
    #activity-payout-settings-form,
    #activity-result-form,
    #activity-result-preview {
        padding: 0.9rem;
    }

    #activity-result-participants .activity-result-participant-row {
        align-items: stretch;
        flex-wrap: wrap;
    }

    #activity-result-participants .activity-result-participant-label {
        flex-basis: 100%;
    }

    #activity-result-participants .activity-result-team,
    #activity-result-participants .activity-result-placement {
        flex: 1 1 7rem;
        max-width: none;
    }
}