html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Catan app layout */

body {
    background: #f4f1ea;
}

.catan-app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* --- Cities & Knights --- */

.expansion-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.pirate-ship {
    width: 1.3em;
    height: 1.3em;
    vertical-align: -0.3em;
}

.improvement-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
    padding: 0.35rem 0;
    border-top: 1px solid #e5e7eb;
}

.improvement-row:first-of-type {
    border-top: none;
}

.improvement-track {
    font-weight: 600;
    min-width: 7rem;
}

.improvement-pips {
    display: inline-flex;
    gap: 3px;
}

.improvement-pip {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid var(--track-color);
    background: #fff;
}

.improvement-pip-on {
    background: var(--track-color);
}

.improvement-pip-ability {
    box-shadow: 0 0 0 1px #2f2a24;
}

.improvement-name {
    font-size: 0.85rem;
    color: #4b5563;
}

.player-improvements {
    display: inline-flex;
    gap: 2px;
}

.player-improvement {
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 3px;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.knight-menu {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

.decision-panel {
    border-left: 4px solid #d4a22b;
}

.decision-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.board-pick-panel {
    border-left: 4px solid #3a6fb0;
}

.board-tooltip {
    position: fixed;
    z-index: 1100;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    background: #2f2a24;
    color: #fff;
    font-size: 0.8rem;
    white-space: pre;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.board-tooltip::before {
    content: "";
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--tooltip-color);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.board-tooltip[hidden] {
    display: none;
}

.app-topbar {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.language-switcher {
    display: inline-flex;
    border: 1px solid #c9c2b3;
    border-radius: 999px;
    overflow: hidden;
    background: #fffdf6;
}

.language-switcher button {
    border: none;
    background: transparent;
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b6457;
    cursor: pointer;
}

.language-switcher button.active {
    background: #2f2a24;
    color: #fff;
}

.home-page {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.home-hero h1 {
    margin-bottom: 0.25rem;
}

.home-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.home-card, .lobby-card, .winner-card {
    width: 320px;
    padding: 1.5rem;
    text-align: left;
}

.winner-card.results {
    width: 100%;
    max-width: 1100px;
}

.game-timing {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    color: #4b5563;
}

.stats-table-wrapper {
    overflow-x: auto;
}

.stats-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
}

.stats-table th, .stats-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
    white-space: nowrap;
}

.stats-table th {
    font-weight: 600;
    color: #4b5563;
}

.stats-table th:first-child, .stats-table td.stats-player {
    text-align: left;
    position: sticky;
    left: 0;
    background: #fff;
    box-shadow: 1px 0 0 #e5e7eb;
}

.stats-table tbody tr:nth-child(even), .stats-table tbody tr:nth-child(even) td.stats-player {
    background: #faf8f3;
}

.stats-table tr.stats-winner, .stats-table tr.stats-winner td.stats-player {
    background: #fff6d1;
    font-weight: 600;
}

.stats-player .color-dot {
    margin-right: 0.35rem;
    vertical-align: middle;
}

.home-games {
    margin-top: 1.5rem;
    text-align: left;
}

.games-table td {
    text-align: left;
    vertical-align: middle;
}

.games-players {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
}

.games-player {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.games-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
}

.spectator-badge {
    font-size: 0.85rem;
    opacity: 0.85;
}

.lobby-view, .winner-view {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.room-code {
    font-family: monospace;
    letter-spacing: 0.15em;
    font-weight: 700;
}

.lobby-player, .score-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-dot {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.hint {
    color: #6b7280;
    font-size: 0.85rem;
}

.join-prompt {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.game-page {
    min-height: 60vh;
}

.play-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #2f2a24;
    color: #f4f1ea;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.play-main {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.play-board-column {
    flex: 2;
    min-width: 320px;
}

.play-sidebar {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-card h4 {
    margin-top: 0;
}

.player-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    flex-wrap: wrap;
}

.player-row-active {
    background: rgba(255, 215, 0, 0.15);
    border-radius: 0.25rem;
    padding-left: 0.3rem;
}

.player-name {
    font-weight: 600;
}

.player-vp, .player-cards, .player-devcards {
    font-size: 0.85rem;
    color: #4b5563;
}

.card-hand {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    padding-top: 0.5rem;
}

.card-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.card-caption {
    font-size: 0.7rem;
    color: #4b5563;
    text-align: center;
    max-width: 64px;
    line-height: 1.1;
}

/* Sized for 5 layers offset by 3px each (MaxStackLayers / StackOffset in PlayView.razor). */
.card-stack {
    position: relative;
    width: 48px;
    height: 62px;
}

.card-stack-clickable {
    cursor: pointer;
    transition: transform 0.12s ease;
}

.card-stack-clickable:hover {
    transform: translateY(-3px);
}

.card-stack-inactive .game-card {
    filter: saturate(0.45) brightness(0.95);
}

.game-card {
    position: absolute;
    width: 36px;
    height: 50px;
    border-radius: 5px;
    background:
        linear-gradient(155deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 55%),
        var(--card-color);
    border: 1px solid rgba(0, 0, 0, 0.35);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55), 1px 1px 2px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon {
    font-size: 1.3rem;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.card-count {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #2f2a24;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.card-stack-empty .game-card {
    background: transparent;
    border: 1px dashed #b8b2a6;
    box-shadow: none;
}

.card-stack-empty .card-icon {
    opacity: 0.35;
    filter: grayscale(1);
}

/* Scrolls when the popup is taller than the window; auto margins center it when it fits.
   No transforms here: a transformed ancestor would offset Radzen's absolutely positioned dropdown panels. */
.card-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(20, 16, 12, 0.45);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.card-popup-shell {
    margin: auto;
    width: min(320px, 100%);
}

.card-popup {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.game-card.game-card-large {
    position: relative;
    width: 150px;
    height: 210px;
    border-radius: 12px;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.55), 2px 4px 10px rgba(0, 0, 0, 0.3);
}

.game-card-large .card-icon {
    font-size: 4rem;
}

@media (max-height: 640px) {
    .game-card.game-card-large {
        width: 110px;
        height: 154px;
    }

    .game-card-large .card-icon {
        font-size: 2.8rem;
    }
}

.card-title {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    padding: 0 0.5rem;
}

.card-popup-description {
    margin: 0;
    text-align: center;
    font-size: 0.9rem;
    color: #374151;
}

.card-popup-choice {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.card-popup-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.resource-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.resource-stepper .rz-numeric {
    width: 5rem;
}

.inline-panel {
    margin-top: 1rem;
    padding: 1rem;
}

.trade-offer {
    border-top: 1px solid #e5e7eb;
    padding: 0.5rem 0;
}

.game-log-entries {
    max-height: 220px;
    overflow-y: auto;
    font-size: 0.85rem;
}

.game-log-entry {
    padding: 0.15rem 0;
    border-bottom: 1px dashed #e5e7eb;
}

.log-time {
    color: #9ca3af;
    margin-right: 0.5rem;
}
/* Dice (DiceDisplay) */
.dice-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.25rem 0 0.5rem;
    min-height: 2.25rem;
}

.die {
    display: inline-flex;
    width: 2.1rem;
    height: 2.1rem;
    filter: drop-shadow(1px 2px 1.5px rgba(0, 0, 0, 0.3));
}

.die svg {
    width: 100%;
    height: 100%;
}

.dice-total {
    font-size: 1.15rem;
    font-weight: 700;
    margin-left: 0.2rem;
}

.dice-rolling .die {
    animation: dice-tumble 0.7s cubic-bezier(0.3, 0.7, 0.4, 1);
}

.dice-rolling .die:nth-child(2) {
    animation-delay: 0.06s;
}

.dice-rolling .die:nth-child(3) {
    animation-delay: 0.12s;
}

.dice-rolling .dice-total {
    animation: dice-total-in 0.9s ease-out;
}

@keyframes dice-tumble {
    0% { transform: translate(-1.2rem, -0.6rem) rotate(-300deg) scale(0.6); opacity: 0; }
    55% { transform: translate(0.15rem, 0.1rem) rotate(20deg) scale(1.08); opacity: 1; }
    80% { transform: rotate(-6deg) scale(0.98); }
    100% { transform: none; }
}

@keyframes dice-total-in {
    0%, 60% { opacity: 0; }
    100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .dice-rolling .die,
    .dice-rolling .dice-total {
        animation: none;
    }
}

/* Themed heading font */
h1, h2, h3,
.play-header .turn-indicator,
.sidebar-card h4 {
    font-family: 'Cinzel', Georgia, 'Times New Roman', serif;
    letter-spacing: 0.02em;
}

/* SVG icons in UI text (UiIcons) — sized with the surrounding text */
.ui-icon {
    display: inline-block;
    width: 1.25em;
    height: 1.25em;
    vertical-align: -0.28em;
    flex-shrink: 0;
}

/* Glyphs on coloured card faces are white, like the card titles */
.card-icon .ui-glyph {
    color: #fff;
}

.game-card-large .card-icon .ui-icon {
    width: 1em;
    height: 1em;
}

/* 3D board prototype */
.board3d {
    width: 100%;
    height: min(80vh, 900px);
    min-height: 420px;
    border-radius: 0.75rem;
    overflow: hidden;
    touch-action: none;
}

.board3d canvas {
    display: block;
}

.board3d-wrap {
    position: relative;
}

/* Zoom / reset buttons over the bottom-right corner of the 3D board */
.board3d-controls {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.board3d-controls .rz-button {
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Phones: a shorter 3D board so the sidebar below stays within reach */
@media (max-width: 700px) {
    .board3d {
        height: min(62vh, 100vw);
        min-height: 320px;
    }
}

/* Site password page */
.access-card {
    max-width: 22rem;
    margin: 3rem auto;
    padding: 1.5rem;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    text-align: center;
}

.access-card h1 {
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
}

.access-input {
    width: 100%;
    margin: 0.5rem 0 0.75rem;
}

.access-button {
    width: 100%;
}

.access-error {
    color: #b3261e;
    margin: 0 0 0.75rem;
}
