/* ── Fishing Mini-Game ────────────────────────────────────────────── */

.fishing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1rem 3rem;
    text-align: center;
    max-width: 1100px;
    margin: 0 auto;
}

.fishing-page__title {
    font-family: 'OldFenris', serif;
    font-size: 2rem;
    color: var(--text-primary, #e0ddd5);
    letter-spacing: 0.04em;
    margin: 0 0 0.25rem;
}

.fishing-page__subtitle {
    color: var(--text-muted, #7a7870);
    font-size: 0.9rem;
    margin: 0 0 1.5rem;
    font-style: italic;
}

/* ── Canvas Outer (holds how-to link + canvas) ──────────────────── */
.fishing-canvas-outer {
    position: relative;
    width: 100%;
    max-width: 1000px;
}

.fishing-howto-link {
    position: absolute;
    top: -1.6rem;
    right: 0;
    font-size: 0.75rem;
    color: var(--text-muted, #7a7870);
    text-decoration: none;
    transition: color 0.2s;
    z-index: 1;
}

.fishing-howto-link:hover {
    color: #c4a24e;
}

/* ── Canvas Container ────────────────────────────────────────────── */
.fishing-canvas-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 2px solid #252830;
    border-radius: 4px;
    overflow: hidden;
    background: #050510;
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.6),
        inset 0 0 40px rgba(10, 20, 40, 0.3);
    cursor: pointer;
}

.fishing-canvas-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.06) 0px,
            rgba(0, 0, 0, 0.06) 1px,
            transparent 1px,
            transparent 3px
        );
    mix-blend-mode: multiply;
}

.fishing-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.fishing-canvas-wrap:focus-within {
    border-color: #c4a24e;
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.6),
        0 0 8px rgba(196, 162, 78, 0.2);
}

/* ── Stats Bar ───────────────────────────────────────────────────── */
.fishing-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    width: 100%;
    max-width: 1000px;
    margin-top: 1rem;
    background: #1a1c22;
    border: 1px solid #252830;
    border-radius: 4px;
    overflow: hidden;
}

.fishing-stats__item {
    background: #13151a;
    padding: 0.6rem 0.5rem;
    text-align: center;
}

.fishing-stats__label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #7a7870);
    margin-bottom: 0.2rem;
}

.fishing-stats__value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #e0ddd5);
    font-variant-numeric: tabular-nums;
}

/* ── Collection Grid ─────────────────────────────────────────────── */
.fishing-collection {
    width: 100%;
    max-width: 1000px;
    margin-top: 1.5rem;
}

.fishing-collection__title {
    font-family: 'OldFenris', serif;
    font-size: 1.1rem;
    color: var(--text-primary, #e0ddd5);
    margin: 0 0 0.75rem;
    text-align: left;
}

#fishing-collection-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.fish-card {
    background: #0d0d14;
    border: 1px solid #1a1c22;
    border-radius: 3px;
    padding: 8px 6px;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
}

.fish-card--caught {
    border-color: #252830;
}

.fish-card--caught.fish-card--common    { border-color: #3a3a3a; }
.fish-card--caught.fish-card--magic     { border-color: #2a4a6a; }
.fish-card--caught.fish-card--rare      { border-color: #5a5a20; }
.fish-card--caught.fish-card--legendary { border-color: #5a3a10; }
.fish-card--caught.fish-card--unique    { border-color: #5a4a1a; }
.fish-card--caught.fish-card--mythic    { border-color: #5a1a1a; }

.fish-card--caught:hover {
    transform: translateY(-1px);
}
.fish-card--caught.fish-card--legendary:hover { box-shadow: 0 0 8px rgba(255,140,0,0.2); }
.fish-card--caught.fish-card--unique:hover    { box-shadow: 0 0 8px rgba(196,162,78,0.2); }
.fish-card--caught.fish-card--mythic:hover    { box-shadow: 0 0 10px rgba(255,68,68,0.25); }

.fish-card__icon {
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fish-card__icon svg {
    display: block;
    width: 20px;
    height: 20px;
}

.fish-card__icon--unknown {
    font-size: 1.3rem;
    color: #252830;
    font-weight: 700;
}

.fish-card__name {
    font-size: 0.7rem;
    color: var(--text-primary, #e0ddd5);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.fish-card__rarity {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fish-card__count {
    font-size: 0.6rem;
    color: var(--text-muted, #7a7870);
}

/* uncaught cards dimmed */
.fish-card:not(.fish-card--caught) {
    opacity: 0.35;
}
.fish-card:not(.fish-card--caught) .fish-card__name {
    color: #333;
}

/* ── Fish Detail Popup ───────────────────────────────────────────── */
.fish-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.fish-popup-overlay--visible {
    display: flex;
}

.fish-popup {
    background: #13151a;
    border: 1px solid #252830;
    border-radius: 6px;
    padding: 1.5rem 2rem;
    max-width: 340px;
    width: 100%;
    position: relative;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.fish-popup__close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted, #7a7870);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.fish-popup__close:hover {
    color: var(--text-primary, #e0ddd5);
}

.fish-popup__icon {
    margin-bottom: 0.5rem;
}

.fish-popup__icon svg {
    width: 40px;
    height: 40px;
}

.fish-popup__name {
    font-family: 'OldFenris', serif;
    font-size: 1.15rem;
    color: var(--text-primary, #e0ddd5);
    margin: 0 0 0.25rem;
}

.fish-popup__rarity {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.fish-popup__flavor {
    font-size: 0.8rem;
    color: var(--text-muted, #7a7870);
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.fish-popup__stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    border-top: 1px solid #252830;
    padding-top: 0.75rem;
}

.fish-popup__stat-item {
    text-align: center;
}

.fish-popup__stat-label {
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #7a7870);
    margin-bottom: 0.15rem;
}

.fish-popup__stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #e0ddd5);
    font-variant-numeric: tabular-nums;
}

.fish-popup__uncaught {
    font-size: 0.85rem;
    color: var(--text-muted, #7a7870);
    font-style: italic;
    padding-top: 0.5rem;
}

/* ── Reset Button ────────────────────────────────────────────────── */
.fishing-reset {
    margin-top: 1.5rem;
}

.fishing-reset__btn {
    background: transparent;
    border: 1px solid #2a2a35;
    color: #555;
    padding: 0.4rem 1rem;
    border-radius: 3px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.fishing-reset__btn:hover {
    color: #cc3333;
    border-color: #553333;
}

/* ── Leaderboard ────────────────────────────────────────────────── */
.fishing-leaderboard {
    width: 100%;
    max-width: 1000px;
    margin-top: 2rem;
}

.fishing-leaderboard__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.fishing-leaderboard__title {
    font-family: 'OldFenris', serif;
    font-size: 1.1rem;
    color: var(--text-primary, #e0ddd5);
    margin: 0;
    text-align: left;
}

.fishing-myrank-btn {
    font-size: 0.78rem;
    color: #c4a24e;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    white-space: nowrap;
}

.fishing-myrank-btn:hover {
    color: #e0c060;
    text-decoration: underline;
}

.fishing-lb-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #252830;
    border-radius: 4px;
    overflow: hidden;
    background: #0d0d14;
    font-size: 0.85rem;
}

.fishing-lb-table thead th {
    background: #13151a;
    color: #c4a24e;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.6rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid #252830;
}

.fishing-lb-table tbody tr {
    border-bottom: 1px solid #1a1c22;
    transition: background 0.3s;
}

.fishing-lb-table tbody tr:hover {
    background: rgba(196, 162, 78, 0.04);
}

.fishing-lb-table td {
    padding: 0.5rem 0.75rem;
    color: var(--text-primary, #e0ddd5);
    text-align: center;
}

.fishing-lb__rank {
    color: #c4a24e;
    font-weight: 700;
    width: 50px;
}

.fishing-lb__user {
    font-weight: 600;
}

.fishing-lb__user-link {
    color: var(--text-primary, #e0ddd5);
    text-decoration: none;
    transition: color 0.2s;
}

.fishing-lb__user-link:hover {
    color: #c4a24e;
    text-decoration: underline;
}

.fishing-lb__score {
    color: #c4a24e;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.fishing-lb__caught,
.fishing-lb__coll,
.fishing-lb__streak {
    color: var(--text-muted, #7a7870);
    font-variant-numeric: tabular-nums;
}

.fishing-lb__empty {
    text-align: center;
    color: var(--text-muted, #7a7870);
    padding: 1.5rem !important;
    font-style: italic;
}

/* ── How-to-Play Modal ──────────────────────────────────────────── */
.fishing-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.75);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.fishing-modal-overlay--visible {
    display: flex;
}

.fishing-modal {
    background: #13151a;
    border: 1px solid #252830;
    border-radius: 6px;
    padding: 1.5rem 2rem;
    max-width: 520px;
    width: 100%;
    position: relative;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.fishing-modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted, #7a7870);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.fishing-modal__close:hover {
    color: var(--text-primary, #e0ddd5);
}

.fishing-modal__title {
    font-family: 'OldFenris', serif;
    font-size: 1.2rem;
    color: #c4a24e;
    margin: 0 0 1rem;
}

.fishing-modal__body {
    text-align: left;
}

.fishing-modal__body p {
    margin: 0 0 0.6rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-primary, #e0ddd5);
}

.fishing-modal__body p:last-child {
    margin-bottom: 0;
}

/* ── Archive (Past Seasons) ──────────────────────────────────────── */
.fishing-archive {
    width: 100%;
    max-width: 1000px;
    margin-top: 2.5rem;
}

.fishing-archive__title {
    font-family: 'OldFenris', serif;
    font-size: 1.1rem;
    color: var(--text-primary, #e0ddd5);
    margin: 0 0 0.75rem;
    text-align: left;
}

.fishing-archive__empty {
    color: var(--text-muted, #7a7870);
    font-style: italic;
    font-size: 0.85rem;
}

.fishing-archive__season {
    border: 1px solid #252830;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: #0d0d14;
    overflow: hidden;
}

.fishing-archive__season[open] {
    border-color: #353840;
}

.fishing-archive__season-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    list-style: none;
}

.fishing-archive__season-header::-webkit-details-marker {
    display: none;
}

.fishing-archive__season-header::before {
    content: '\25B6';
    font-size: 0.6rem;
    color: var(--text-muted, #7a7870);
    margin-right: 0.6rem;
    transition: transform 0.2s;
}

.fishing-archive__season[open] > .fishing-archive__season-header::before {
    transform: rotate(90deg);
}

.fishing-archive__season-header:hover {
    background: rgba(196, 162, 78, 0.04);
}

.fishing-archive__season-name {
    font-weight: 600;
    color: #c4a24e;
    font-size: 0.9rem;
}

.fishing-archive__season-meta {
    font-size: 0.78rem;
    color: var(--text-muted, #7a7870);
}

.fishing-archive__season-body {
    padding: 0 1rem 1rem;
}

.fishing-archive__loading {
    color: var(--text-muted, #7a7870);
    font-style: italic;
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.fishing-lb-table--archive {
    font-size: 0.8rem;
}

/* ── Responsive ──────────────────────────────────────────────────── */

/* Leaderboard scrollable wrapper for all mobile sizes */
.fishing-leaderboard__scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .fishing-page {
        padding: 0.75rem 0.75rem 2rem;
    }

    .fishing-page__title {
        font-size: 1.5rem;
    }

    .fishing-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    #fishing-collection-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .fish-card__name {
        white-space: normal;
        word-break: break-word;
        font-size: 0.65rem;
    }

    .fishing-lb-table {
        font-size: 0.78rem;
    }

    .fishing-lb-table td,
    .fishing-lb-table th {
        padding: 0.4rem 0.5rem;
    }

    /* Hide Streak + Collection columns */
    .fishing-lb-table .fishing-lb__coll,
    .fishing-lb-table .fishing-lb__streak {
        display: none;
    }
    .fishing-lb-table thead th:nth-child(5),
    .fishing-lb-table thead th:nth-child(6) {
        display: none;
    }

    .fishing-collection {
        margin-top: 1rem;
    }

    .fishing-leaderboard {
        margin-top: 1.5rem;
    }

    .fishing-archive__season-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
}

@media (max-width: 480px) {
    .fishing-page {
        padding: 0.5rem 0.5rem 1.5rem;
    }

    .fishing-page__title {
        font-size: 1.3rem;
    }

    .fishing-page__subtitle {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }

    .fishing-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1px;
    }

    .fishing-stats__item {
        padding: 0.4rem 0.3rem;
    }

    .fishing-stats__label {
        font-size: 0.55rem;
    }

    .fishing-stats__value {
        font-size: 0.9rem;
    }

    #fishing-collection-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .fish-card {
        min-height: 62px;
        padding: 5px 3px;
    }

    .fish-card__icon svg {
        width: 16px;
        height: 16px;
    }

    .fish-card__name {
        font-size: 0.6rem;
        white-space: normal;
        word-break: break-word;
        line-height: 1.2;
    }

    .fish-card__rarity {
        font-size: 0.5rem;
    }

    .fish-card__count {
        font-size: 0.5rem;
    }

    /* Hide Caught + Best + Streak + Collection — keep Rank, User, Score */
    .fishing-lb-table .fishing-lb__caught,
    .fishing-lb-table .fishing-lb__best,
    .fishing-lb-table .fishing-lb__streak,
    .fishing-lb-table .fishing-lb__coll {
        display: none;
    }
    .fishing-lb-table thead th:nth-child(3),
    .fishing-lb-table thead th:nth-child(4),
    .fishing-lb-table thead th:nth-child(5),
    .fishing-lb-table thead th:nth-child(6) {
        display: none;
    }

    .fishing-lb-table {
        font-size: 0.75rem;
    }

    .fishing-lb-table td,
    .fishing-lb-table th {
        padding: 0.35rem 0.4rem;
    }

    .fishing-collection__title,
    .fishing-leaderboard__title,
    .fishing-archive__title {
        font-size: 0.95rem;
    }

    .fishing-howto-link {
        font-size: 0.7rem;
        top: -1.4rem;
    }

    /* Fish popup smaller on mobile */
    .fish-popup {
        padding: 1rem 1.25rem;
        max-width: 300px;
    }

    .fish-popup__name {
        font-size: 1rem;
    }

    .fish-popup__icon svg {
        width: 32px;
        height: 32px;
    }

    /* How-to modal tighter */
    .fishing-modal {
        padding: 1rem 1.25rem;
    }

    .fishing-modal__title {
        font-size: 1rem;
    }

    .fishing-modal__body p {
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    #fishing-collection-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .fishing-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Last stat item (5th) spans full width when 2-col */
    .fishing-stats__item:last-child {
        grid-column: 1 / -1;
    }
}
