.dash-body {
    color: var(--ink);
    background: var(--bg);
    font-family: var(--font-body);
}

.dash-top {
    padding: var(--chrome-inset, 4px);
    background: var(--panel);
    border: 1px solid #7aaa7a;
    border-radius: var(--radius);
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: var(--chrome-inset, 4px);
    width: calc(100% - (2 * var(--page-gutter, 10px)));
    max-width: calc(var(--page-max, 1100px) - (2 * var(--page-gutter, 10px)));
    box-sizing: border-box;
}

.dash-top:not(.dash-top-guest) {
    align-items: stretch;
}

/* Flatten brand/nav into the header flex so Profile can stay on the top row
 * when nav wraps (same pattern as admin). Admin overrides via .admin-top. */
.dash-top:not(.admin-top) > .dash-top-main {
    display: contents;
}

.dash-top:not(.admin-top) .brand {
    flex: 0 1 auto;
    box-sizing: border-box;
}

.dash-top:not(.admin-top) .dash-nav {
    flex: 0 1 auto;
    min-width: 0;
}

.dash-top-spacer {
    flex: 1 1 0;
    min-width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    pointer-events: none;
}

.dash-top:not(.dash-top-guest) .brand {
    align-self: stretch;
}

.dash-top:not(.dash-top-guest) .user-card {
    box-sizing: border-box;
    align-self: stretch;
    padding: 2px 6px;
    gap: 6px;
}

.dash-top:not(.dash-top-guest) .user-card-logout {
    margin-left: 0;
}

.dash-top-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.dash-top:not(.admin-top) > .user-card,
.dash-top:not(.admin-top) > .user-card-login {
    flex: 0 1 auto;
}

.dash-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: flex-start;
}

.dash-nav a,
.dash-nav .nav-big {
    color: var(--ink);
    text-decoration: none;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 8pt;
    font-weight: normal;
    background: var(--panel-light);
    border: 1px solid #7aaa7a;
    border-radius: var(--radius);
    box-sizing: border-box;
    min-width: 4rem;
    max-width: 5.5rem;
    padding: 2px 4px;
    text-align: center;
    line-height: 1.15;
}

.dash-nav a:hover {
    color: var(--link-hover);
    background: var(--link-hover-bg);
    text-decoration: none;
}

.dash-nav a.is-active {
    font-weight: bold;
    background: var(--panel, #99cc99);
    color: var(--ink, #000);
}

.dash-nav a.is-active:hover {
    background: var(--link-hover-bg, #b8e0b8);
}

.dash-nav a img,
.dash-nav .nav-big img {
    width: 40px;
    height: 40px;
}

.dash-nav a span,
.dash-nav .nav-big span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.dash-nav .nav-big.is-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.dash-main {
    padding: var(--chrome-inset, 4px) var(--page-gutter, 10px) 24px;
    display: grid;
    gap: var(--chrome-inset, 4px);
}

.user-card {
    --user-card-action-size: 3.25rem;
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--panel-light);
    border: 1px solid #7aaa7a;
    border-radius: var(--radius);
    color: var(--ink);
    padding: 6px 8px;
    /* No margin-left:auto — that keeps the tile right-aligned after wrap.
       Same-row right placement comes from .dash-top-main { flex: 1 } + space-between. */
    flex: 0 1 auto;
    max-width: 24rem;
}

.user-card-photo {
    position: relative;
    flex-shrink: 0;
    width: var(--user-card-action-size);
    height: var(--user-card-action-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    background: transparent;
    border: 1px solid #7aaa7a;
    border-radius: var(--radius);
    box-sizing: border-box;
    padding: 2px;
    text-decoration: none;
}

.user-card-photo:hover {
    color: var(--link-hover);
    background: var(--link-hover-bg);
    text-decoration: none;
}

/* Shine sweep clipped to the avatar shape (shirt SVG alpha).
   Loop period: animation duration below (default 10s). */
@keyframes user-avatar-shine {
    0%,
    2% {
        opacity: 0;
        background-position: 120% 0;
    }

    4% {
        opacity: 1;
        background-position: 120% 0;
    }

    14% {
        opacity: 1;
        background-position: -20% 0;
    }

    16%,
    100% {
        opacity: 0;
        background-position: -20% 0;
    }
}

.user-avatar-shine {
    position: relative;
}

.user-avatar-shine::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(
        115deg,
        transparent 35%,
        rgba(255, 255, 255, 0.15) 42%,
        rgba(255, 255, 255, 0.75) 50%,
        rgba(255, 255, 255, 0.15) 58%,
        transparent 65%
    );
    background-size: 250% 100%;
    background-position: 120% 0;
    opacity: 0;
    -webkit-mask-image: var(--user-avatar-mask);
    mask-image: var(--user-avatar-mask);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    mask-mode: alpha;
    /* linear so JS can flip reliably after the 16% shine window */
    animation: user-avatar-shine 10s linear infinite;
}

/* JS briefly toggles this to restart the shine from frame 0 (e.g. on hover). */
.user-avatar-shine--restart::after {
    animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .user-avatar-shine::after {
        display: none;
        animation: none;
    }
}

.user-card-nickname {
    color: inherit;
    text-decoration: underline;
}

.user-card-nickname:hover {
    color: inherit;
    background: transparent;
}

.user-card-text {
    min-width: 0;
    flex: 1 1 auto;
}

.user-card-logout {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 0 0 auto;
    min-height: var(--user-card-action-size);
    margin-left: 4px;
    padding: 2px 4px;
    color: var(--ink);
    text-decoration: none;
    font-size: 8pt;
    font-family: inherit;
    line-height: 1.15;
    background: transparent;
    border: 1px solid #7aaa7a;
    border-radius: var(--radius);
    box-sizing: border-box;
    cursor: pointer;
}

.user-card-logout img {
    display: block;
    width: 32px;
    height: 32px;
}

.user-card-logout:hover {
    color: var(--link-hover);
    background: var(--link-hover-bg);
    text-decoration: none;
}

.user-card-login {
    max-width: 28rem;
    align-items: stretch;
}

.user-card-login .user-card-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Keep room for two fields so forgot-mode can sit the input at the bottom. */
    min-height: 4.75rem;
}

.user-card-login[data-mode="forgot"] .user-card-text {
    justify-content: flex-end;
}

.user-card-login .hello {
    margin: 0;
}

.user-card-login label {
    display: block;
    margin: 0;
    font-size: 9pt;
}

.user-card-login label[hidden] {
    display: none !important;
}

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

.user-card-login input[type="text"],
.user-card-login input[type="password"] {
    display: block;
    width: 100%;
    min-width: 10rem;
    max-width: 14rem;
    padding: 3px 6px;
    border: 1px solid #7aaa7a;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 10pt;
    background: var(--panel-light, #ccffcc);
    color: var(--ink);
    box-sizing: border-box;
}

.user-card-login input::placeholder {
    color: var(--muted, #333);
    opacity: 0.75;
}

.user-card-login input:focus {
    outline: none;
    border-color: #008000;
    background: #bbffbb;
    box-shadow: 0 0 0 1px #008000;
}

.user-card-login input.is-error,
.user-card-login input.is-error:focus {
    border-color: #c00;
    background: #ffe8e8;
    box-shadow: 0 0 0 1px #c00;
}

.user-card-login .feedback {
    width: auto;
    margin: 0 0 2px;
    padding: 4px 5px;
    font-size: 9pt;
}

.user-card-login .login-links {
    margin: 2px 0 0;
    justify-content: flex-start;
}

.user-card-login .user-card-logout {
    align-self: center;
    margin-top: 2px;
}

.user-card-login-submit img {
    width: 40px;
    height: 40px;
}

.user-photo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border: 1px solid #666;
    border-radius: var(--radius-sm);
    background: #fff;
    flex-shrink: 0;
}

.user-card-photo .user-photo {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
}

.user-photo-avatar {
    object-fit: contain;
    background: transparent;
}

.hello {
    margin: 0 0 2px;
    font-family: var(--font-body);
    font-size: 10pt;
}

.user-card .muted {
    margin: 0;
    font-size: 8pt;
}

.user-card-admin {
    margin: 4px 0 0;
    font-size: 8pt;
}

.user-card-admin a {
    color: var(--ink);
    font-weight: bold;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.section-head h2,
.panel h2 {
    margin: 0;
    font-family: var(--font-title);
    font-size: 14pt;
    font-weight: bold;
}

.games-section {
    background: var(--panel);
    border: 1px solid #7aaa7a;
    border-radius: var(--radius);
    padding: var(--chrome-inset, 4px);
}

.hint {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 8pt;
    font-weight: normal;
    font-family: Verdana, sans-serif;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.game-tile {
    appearance: none;
    border: 1px solid #7aaa7a;
    border-radius: var(--radius);
    background: var(--panel-light);
    color: var(--ink);
    padding: 8px 6px;
    display: grid;
    justify-items: center;
    gap: 4px;
    cursor: pointer;
    font-family: var(--font-title);
    font-size: 10pt;
    text-align: center;
}

.game-tile:hover {
    background: var(--link-hover-bg);
}

.game-tile.is-selected {
    background: var(--selected);
    color: #fff;
    border-color: #990000;
}

.game-tile.is-faded {
    opacity: 0.45;
}

.game-tile.is-faded:hover,
.game-tile.is-faded.is-selected {
    opacity: 0.7;
}

.game-tile.is-test {
    filter: grayscale(1);
    border-color: #9a9a9a;
    color: #666;
    background: #e8e8e8;
}

.game-tile.is-test:hover,
.game-tile.is-test.is-selected {
    filter: grayscale(0.7);
}

.game-tile img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.dash-columns {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: var(--chrome-inset, 4px);
}

.panel {
    background: var(--panel);
    border: 1px solid #7aaa7a;
    border-radius: var(--radius);
    padding: var(--chrome-inset, 4px);
}

.news-item {
    padding: 8px 0;
    border-bottom: 1px solid #7aaa7a;
}

.news-item:last-child {
    border-bottom: 0;
}

.news-item h3 {
    margin: 0 0 2px;
    font-size: 11pt;
    font-family: var(--font-body);
}

.news-item time {
    color: var(--muted);
    font-size: 8pt;
}

.news-body {
    margin-top: 4px;
    font-size: 10pt;
    line-height: 1.35;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.page-btn {
    appearance: none;
    border: 1px solid #666;
    border-radius: var(--radius-sm);
    background: var(--panel-light);
    color: var(--ink);
    min-width: 1.6rem;
    height: 1.6rem;
    cursor: pointer;
    font-family: Verdana, sans-serif;
    font-size: 9pt;
}

.page-btn.is-active,
.page-btn:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover);
}

.poll-title {
    font-weight: bold;
    text-decoration: underline;
    margin: 4px 0 8px;
    font-size: 11pt;
}

.poll-answers,
.poll-results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.poll-vote {
    width: 100%;
    text-align: left;
    appearance: none;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
    padding: 4px 2px;
    cursor: pointer;
    font: inherit;
    font-size: 10pt;
    text-decoration: none;
}

.poll-vote:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover);
    text-decoration: none;
}

.result-label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 10pt;
    margin-bottom: 2px;
}

.bar {
    height: 10px;
    background: #7aaa7a;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    background: #008000;
}

.text-poll textarea {
    width: 100%;
    margin: 4px 0 8px;
    border: 1px solid #666;
    padding: 4px;
    font-family: var(--font-body);
    font-size: 10pt;
}

/* Shared site footer (same as logged-out start page) */
.foot {
    padding: 8px 10px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    justify-content: space-between;
    align-items: center;
    font-size: 9pt;
    color: var(--muted, #333);
}

.foot-copy,
.foot-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
}

.foot-sep {
    opacity: 0.6;
}

.foot a {
    color: var(--ink, #000);
}

@media (max-width: 860px) {
    .dash-columns {
        grid-template-columns: 1fr;
    }

    /* Brand + Profile on top; normal nav below (mirrors admin narrow header). */
    .dash-top:not(.admin-top) .brand {
        order: 1;
    }

    .dash-top:not(.admin-top) > .dash-top-spacer {
        order: 2;
        flex: 1 1 auto;
        min-width: 4px;
    }

    .dash-top:not(.admin-top) > .user-card,
    .dash-top:not(.admin-top) > .user-card-login {
        order: 3;
    }

    .dash-top:not(.admin-top) .dash-nav {
        order: 4;
        flex: 1 1 100%;
        width: 100%;
    }

    .user-card {
        margin-left: 0;
        /* Stay content-sized so login/logout icon stays beside the form/details. */
        width: auto;
        max-width: 100%;
        flex: 0 1 auto;
    }

    .user-card-text {
        flex: 0 1 auto;
    }
}

