/* ==========================================================================
   Sushi Go! custom font
   --------------------------------------------------------------------------
   The display font is controlled by the single --sushi-font variable below.

   Option A (current): a Google Font loaded in base.html (e.g. "Lobster").
   Option B: self-host your own font file. Drop the font in
   static/fonts/sushi_go/ and uncomment the @font-face block, then set
   --sushi-font to "SushiGo".
   ========================================================================== */

/*
@font-face {
    font-family: 'SushiGo';
    src: url('../fonts/sushi_go/sushi_go.woff2') format('woff2'),
         url('../fonts/sushi_go/sushi_go.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
*/

/* Match the page colour so no white shows when iOS bounces past the edges. */
body.sushi-go {
    /* Change this to your custom font, e.g. 'SushiGo', cursive. */
    --sushi-font: 'Lobster', cursive;

    background-color: #3a1f14;
}

/* Box model and no double-tap zoom delay for every Sushi Go! control. */
.sushi-menu,
.sushi-menu *,
.sushi-overlay,
.sushi-overlay * {
    box-sizing: border-box;
    touch-action: manipulation;
}

/*
 * The section is its own full-screen scroll area. Its background stays still while the content
 * scrolls inside it, which works on iOS where background-attachment: fixed and fixed layers do not.
 */
.sushi-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 3rem 0;
    text-align: center;
    background-color: #3a1f14;
    background-image: url("../img/sushi_go/background.jpg");
    background-size: cover;
    background-position: center;
}

/* Leave room for the site sidebar on desktop. */
@media (min-width: 1200px) {
    .sushi-menu {
        left: 300px;
    }
}

.sushi-nav {
    display: flex;
    justify-content: flex-start;
    max-width: 640px;
    margin: 0 auto 1.5rem auto;
}

.sushi-nav-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.55);
    border: 2px solid #fff3d6;
    border-radius: 8px;
    box-shadow: 2px 2px 0 #000;
    transition: background 0.2s ease;
}

.sushi-nav-button:hover,
.sushi-nav-button:focus {
    color: #fff;
    background: #8A0018;
}

.sushi-title {
    color: #fff;
    font-family: var(--sushi-font);
    font-size: 3.25rem;
    text-shadow: 3px 3px 0 #8A0018, 5px 5px 0 #000;
    margin-bottom: 0.5rem;
}

.sushi-subtitle {
    max-width: 640px;
    margin: 0 auto 2rem auto;
    color: #fff;
    font-size: 1.1rem;
    text-shadow: 1px 1px 0 #000;
}

.sushi-group {
    max-width: 640px;
    margin: 0 auto 1.5rem auto;
    padding: 1rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 12px;
}

.sushi-group h5 {
    color: #fff3d6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.sushi-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.sushi-button {
    flex: 1 1 160px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    font-family: var(--sushi-font);
    font-size: 1.6rem;
    color: #fff;
    text-decoration: none;
    background: #8A0018;
    border: 2px solid #fff3d6;
    border-radius: 8px;
    box-shadow: 2px 2px 0 #000;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.sushi-button:hover,
.sushi-button:focus {
    color: #fff;
    background: #A5001D;
}

.sushi-button:active {
    transform: translateY(2px);
}

.sushi-empty {
    margin: 0;
}

.sushi-empty a {
    color: #AAC722;
}

/* ======= Setup: player name fields ======= */
.sushi-field + .sushi-field {
    margin-top: 0.75rem;
}

.sushi-input {
    display: block;
    width: 100%;
    height: 3rem;
    padding: 0 1rem;
    /* Over 16px, so iOS does not zoom in on focus. */
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    color: #AAC722;
    background-color: #9D6896;
    border: 2px solid transparent;
    border-radius: 20px;
    box-shadow: 2px 2px 0 #000;
}

.sushi-input::placeholder {
    color: #e3c8df;
    opacity: 0.8;
}

.sushi-input:focus {
    outline: none;
    border-color: #AAC722;
}

.sushi-input[aria-invalid="true"] {
    border-color: #ff6b7f;
}

.sushi-error {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.15rem 0.75rem;
    font-size: 0.9rem;
    color: #fff;
    background: #8A0018;
    border-radius: 20px;
}

/* ======= Player scoring buttons ======= */
.players-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.round-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.9rem 1rem;
    color: #AAC722;
    background-color: #9D6896;
    border: 2px solid transparent;
    border-radius: 10px;
    box-shadow: 2px 2px 0 #000;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.round-btn:hover,
.round-btn:focus {
    background-color: #8F628B;
    outline: none;
}

.round-btn:focus-visible {
    border-color: #fff3d6;
}

.round-btn:active {
    transform: translateY(2px);
}

.round-btn.is-scored {
    border-color: #AAC722;
}

/* Check mark on players that have been scored this round. */
.round-btn.is-scored::after {
    content: "\F26E";
    font-family: "bootstrap-icons";
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    width: 1.75rem;
    height: 1.75rem;
    line-height: 1.75rem;
    font-size: 1.25rem;
    color: #2f3f06;
    background: #AAC722;
    border-radius: 50%;
}

.round-btn-label {
    font-family: var(--sushi-font);
    font-size: 1.6rem;
}

.round-btn-summary {
    max-width: calc(100% - 3rem);
    margin-top: 0.25rem;
    font-size: 0.9rem;
    text-align: center;
    color: #fff;
    opacity: 0.9;
}

/* ======= Final scoring results board ======= */
.results-board {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-align: left;
    color: #AAC722;
    background-color: #9D6896;
    border: 2px solid transparent;
    border-radius: 10px;
    box-shadow: 2px 2px 0 #000;
}

.result-row.is-winner {
    border-color: #AAC722;
    background-color: #8F628B;
}

.result-rank {
    flex: 0 0 auto;
    width: 2rem;
    font-family: var(--sushi-font);
    font-size: 1.6rem;
    text-align: center;
}

.result-info {
    flex: 1 1 auto;
    min-width: 0;
}

.result-name {
    font-family: var(--sushi-font);
    font-size: 1.5rem;
}

.result-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin-top: 0.2rem;
    font-size: 0.8rem;
    color: #fff;
    opacity: 0.9;
}

.result-total {
    flex: 0 0 auto;
    font-family: var(--sushi-font);
    font-size: 2rem;
}

.results-empty {
    margin: 0;
    color: #fff;
    text-align: center;
}

/* ======= Sushi choose overlay ======= */
.sushi-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
}

.sushi-overlay.is-open {
    display: flex;
}

.sushi-overlay-content {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem;
    background-color: #2CC2AB;
    border: 2px solid #fff3d6;
    border-radius: 12px;
    box-shadow: 3px 3px 0 #000;
}

.sushi-overlay-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sushi-overlay-header h5 {
    flex: 1;
    margin: 0;
    padding-left: 2.5rem;
    font-family: var(--sushi-font);
    font-size: 1.8rem;
    text-align: center;
    color: #fff;
    text-shadow: 2px 2px 0 #8A0018;
}

.sushi-overlay-close {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.2rem;
    color: #fff;
    background: #8A0018;
    border: 2px solid #fff3d6;
    border-radius: 50%;
    box-shadow: 1px 1px 0 #000;
    cursor: pointer;
}

.sushi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin: 0.75rem 0;
}

.sushi-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.4rem 0.25rem;
    color: #fff;
    background-color: #9D6896;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.sushi-choice.is-selected {
    border-color: #AAC722;
    background-color: #8F628B;
}

.sushi-image {
    width: 44px;
    height: 44px;
    object-fit: contain;
    cursor: pointer;
}

.sushi-name {
    font-family: var(--sushi-font);
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.05;
}

.sushi-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    margin-top: 0.1rem;
}

.sushi-step {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    color: #fff;
    background-color: #8A0018;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.sushi-step:hover,
.sushi-step:focus {
    background-color: #A5001D;
    outline: none;
}

.sushi-step:active {
    transform: scale(0.9);
}

.sushi-count {
    min-width: 1.1rem;
    font-size: 1.05rem;
    font-weight: bold;
    text-align: center;
}

/* Wasabi pairing control on nigiri cards */
.sushi-wasabi {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    width: 100%;
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.sushi-wasabi .sushi-step {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 0.85rem;
    background-color: #5f7d16;
}

.sushi-wasabi .sushi-step:hover,
.sushi-wasabi .sushi-step:focus {
    background-color: #AAC722;
}

.sushi-wasabi-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.sushi-wasabi-count {
    min-width: 0.9rem;
    font-size: 0.95rem;
}

/* ==========================================================================
   Larger screens (tablet / iPad / desktop): scale the whole UI up a bit.
   The base styles above are tuned for phones (~375px).
   ========================================================================== */
@media (min-width: 768px) {
    .round-btn {
        padding: 1.2rem;
    }

    .round-btn-label {
        font-size: 2rem;
    }

    .round-btn-summary {
        font-size: 1rem;
    }

    /* Results board */
    .result-rank {
        width: 2.5rem;
        font-size: 2rem;
    }

    .result-name {
        font-size: 1.8rem;
    }

    .result-breakdown {
        font-size: 0.95rem;
    }

    .result-total {
        font-size: 2.4rem;
    }

    /* Sushi choose overlay */
    .sushi-overlay {
        padding: 1rem;
    }

    .sushi-overlay-content {
        max-width: 640px;
        padding: 1.25rem;
    }

    .sushi-grid {
        gap: 0.75rem;
        margin: 1rem 0;
    }

    .sushi-choice {
        gap: 0.4rem;
        padding: 0.75rem 0.5rem;
    }

    .sushi-image {
        width: 72px;
        height: 72px;
    }

    .sushi-name {
        font-size: 1.2rem;
        line-height: 1.1;
    }

    .sushi-stepper {
        gap: 0.5rem;
    }

    .sushi-step {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 1.3rem;
    }

    .sushi-count {
        min-width: 1.5rem;
        font-size: 1.4rem;
    }

    .sushi-wasabi {
        gap: 0.35rem;
        margin-top: 0.4rem;
        padding-top: 0.4rem;
    }

    .sushi-wasabi .sushi-step {
        width: 1.8rem;
        height: 1.8rem;
        font-size: 1.1rem;
    }

    .sushi-wasabi-icon {
        width: 26px;
        height: 26px;
    }

    .sushi-wasabi-count {
        min-width: 1.2rem;
        font-size: 1.2rem;
    }
}

@media (min-width: 1200px) {
    .sushi-overlay-content {
        max-width: 720px;
    }

    .sushi-image {
        width: 88px;
        height: 88px;
    }

    .sushi-name {
        font-size: 1.35rem;
    }
}

/* ==========================================================================
   2 rows x 4 columns layout for the 8 sushi. Applied on:
   - landscape short viewports (e.g. iPad in landscape), and
   - wide screens / desktop browsers.
   ========================================================================== */
@media (orientation: landscape) and (max-height: 900px),
       (min-width: 992px) {
    .sushi-overlay-content {
        max-width: 860px;
    }

    .sushi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
