.island-match-page__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.island-match-hud {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.island-match-hud__stat {
    background: var(--color-surface);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius);
    padding: .75rem 1.25rem;
    min-width: 5.5rem;
    text-align: center;
}

.island-match-hud__label {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-text-muted);
    margin-bottom: .15rem;
}

.island-match-hud__stat strong {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-primary-dark);
}

.island-match-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 1.5rem;
    align-items: start;
}

.island-match-board-wrap {
    background: linear-gradient(145deg, #0a4f4f, var(--color-primary));
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.island-match-fx {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity .25s ease;
    --im-fx-duration: 700ms;
}

.island-match-fx.is-active {
    opacity: 1;
    animation: im-fx-glow var(--im-fx-duration, 700ms) ease-out;
}

@keyframes im-fx-glow {
    0% {
        box-shadow: inset 0 0 0 rgba(255, 255, 255, 0);
    }
    30% {
        box-shadow: inset 0 0 72px rgba(255, 215, 0, 0.28);
    }
    100% {
        box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.08);
    }
}

.island-match-fx__canvas {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

.island-match-hud__stat--combo strong {
    color: #d97706;
}

.island-match-board {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    aspect-ratio: 1;
    max-width: 560px;
    margin: 0 auto;
    touch-action: manipulation;
    user-select: none;
}

.island-match-gameover {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    padding: 1rem;
    border-radius: inherit;
}

.island-match-gameover[hidden] {
    display: none !important;
}

.island-match-gameover__panel {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    text-align: center;
    max-width: 300px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--color-primary);
}

.island-match-gameover__title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    margin: 0 0 .75rem;
    color: var(--color-primary-dark);
}

.island-match-gameover__summary {
    font-size: .95rem;
    margin: 0 0 .75rem;
    color: var(--color-text);
    line-height: 1.5;
}

.island-match-gameover__extra {
    font-size: .85rem;
    font-weight: 600;
    color: #d97706;
    margin: 0 0 1rem;
}

.island-match-gameover__btn {
    margin-top: .25rem;
}

.island-match-tile {
    appearance: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform .15s ease, box-shadow .15s ease, opacity .2s;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15);
    min-height: 0;
}

.island-match-tile svg {
    width: 62%;
    height: 62%;
    stroke: white;
    fill: none;
}

.island-match-tile:hover:not(:disabled) {
    transform: scale(1.04);
    z-index: 1;
}

.island-match-tile.is-selected {
    outline: 3px solid #fff;
    outline-offset: -2px;
    transform: scale(1.06);
    z-index: 2;
}

.island-match-tile.is-hint {
    border: 3px solid #ffeb3b !important;
    outline: none;
    z-index: 4;
    animation: im-hint-border-flash 0.5s ease-in-out infinite;
}

@keyframes im-hint-border-flash {
    0%, 100% {
        border-color: #ffeb3b;
        box-shadow: 0 0 0 2px #ffd700, 0 0 14px rgba(255, 235, 59, 0.85);
    }
    50% {
        border-color: #fff176;
        box-shadow: 0 0 0 4px #ff9800, 0 0 20px rgba(255, 193, 7, 1);
    }
}

.island-match-hint-wrap {
    margin-top: 1rem;
}

.island-match-hint-wrap__note {
    font-size: .75rem;
    color: var(--color-text-muted);
    margin: .35rem 0 0;
    text-align: center;
}

.island-match-hint-btn__cost {
    font-weight: 700;
    color: var(--color-primary-dark);
}

.island-match-hint-btn.is-unavailable {
    opacity: 0.55;
    cursor: not-allowed;
}

.island-match-hint-btn[aria-disabled="true"] {
    opacity: 0.55;
}

.island-match-tile.is-clearing {
    animation: im-pop .25s ease forwards;
}

.island-match-tile.is-invalid {
    animation: im-shake .35s ease;
}

@keyframes im-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .5); }
    50% { box-shadow: 0 0 0 4px rgba(255, 255, 255, .35); }
}

@keyframes im-pop {
    to { transform: scale(0); opacity: 0; }
}

@keyframes im-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.tile--hiking { background: linear-gradient(145deg, #9333ea, #7e22ce); }
.tile--walking { background: linear-gradient(145deg, #65a30d, #4d7c0f); }
.tile--camping { background: linear-gradient(145deg, #d97706, #b45309); }
.tile--fishing { background: linear-gradient(145deg, #0284c7, #0369a1); }
.tile--boating { background: linear-gradient(145deg, #ec4899, #db2777); }
.tile--maple { background: linear-gradient(145deg, #dc2626, #b91c1c); }

.island-match-message {
    text-align: center;
    color: white;
    font-weight: 600;
    min-height: 1.5rem;
    margin-top: .75rem;
    font-size: .95rem;
}

.island-match-sidebar {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.island-match-sidebar h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: .75rem;
}

.island-match-legend {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    font-size: .85rem;
}

.island-match-legend li {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.island-match-legend__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.island-match-legend__icon svg {
    width: 1.1rem;
    height: 1.1rem;
    stroke: white;
}

.island-match-leaderboard {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.island-match-leaderboard h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: .5rem;
}

.island-match-leaderboard h3 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-muted);
    margin-bottom: .5rem;
}

.island-match-leaderboard__cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.island-match-leaderboard__list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: .8rem;
}

.island-match-leaderboard__list li {
    display: grid;
    grid-template-columns: 1.25rem 1fr auto;
    gap: .35rem;
    align-items: center;
    padding: .25rem 0;
}

.island-match-leaderboard__rank {
    color: var(--color-text-muted);
    font-weight: 600;
}

.island-match-leaderboard__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.island-match-leaderboard__name a {
    color: var(--color-primary-dark);
    text-decoration: none;
}

.island-match-leaderboard__name a:hover {
    text-decoration: underline;
}

.island-match-leaderboard__value {
    font-weight: 700;
    color: var(--color-primary-dark);
}

@media (max-width: 900px) {
    .island-match-layout {
        grid-template-columns: 1fr;
    }

    .island-match-board {
        max-width: 100%;
    }
}
