/* Browser-side fishie */

.fishie-body {
    --fishie-color: hsl(185 80% 56%);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 2147482400;
    display: inline-block;
    box-sizing: border-box;
    min-width: 1.25em;
    min-height: 1.25em;
    color: var(--fishie-color);
    font-family: "Yu Gothic", "Meiryo", "Hiragino Sans", "Noto Sans JP", serif;
    font-size: clamp(28px, 4vw, 46px);
    font-weight: 700;
    line-height: 1;
    text-align: center;
    user-select: none;
    cursor: pointer;
    pointer-events: auto;
    will-change: transform;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.55),
        0 2px 7px rgba(0, 0, 0, 0.32);
    transform-origin: center center;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.22));
}

.fishie-body::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 52%;
    width: 1.6em;
    height: 0.72em;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    background: currentColor;
    opacity: 0.08;
    z-index: -1;
}

.fishie-body.hungry {
    text-shadow:
        0 0 5px rgba(88, 0, 16, 0.35),
        0 2px 7px rgba(0, 0, 0, 0.34);
}

.fishie-body.sad {
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.22)) saturate(0.75);
}

.fishie-body.zero {
    animation: fishie-zero-wobble 1.8s ease-in-out infinite;
}

@keyframes fishie-zero-wobble {
    0%, 100% {
        margin-top: 0;
    }

    50% {
        margin-top: 2px;
    }
}

.fishie-menu {
    position: fixed;
    z-index: 2147482450;
    display: inline-flex;
    gap: 4px;
    padding: 5px;
    border: 1px solid color-mix(in srgb, var(--text-border, #aaa) 80%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--box-bg, #fff) 88%, transparent);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    touch-action: none;
    user-select: none;
    cursor: grab;
}

.fishie-menu:active {
    cursor: grabbing;
}

.fishie-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--text-border, #aaa);
    border-radius: 50%;
    background: var(--background, #fff);
    color: var(--text, #222);
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    touch-action: none;
}

.fishie-menu-btn:hover,
.fishie-menu-btn:focus-visible {
    outline: 2px solid var(--ui-button, #007bff);
    outline-offset: 1px;
}

.fishie-food {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 2147482380;
    display: inline-block;
    font-family: "Yu Gothic", "Meiryo", "Hiragino Sans", "Noto Sans JP", serif;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    user-select: none;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
    will-change: transform;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
    transform-origin: center center;
}

.fishie-food.grabbed {
    cursor: grabbing;
    z-index: 2147482460;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.fishie-particle {
    position: fixed;
    z-index: 2147482500;
    display: inline-block;
    left: 0;
    top: 0;
    font-family: "Yu Gothic", "Meiryo", "Hiragino Sans", "Noto Sans JP", serif;
    font-size: 19px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    will-change: transform, opacity;
    animation-name: fishie-particle-float;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

@keyframes fishie-particle-float {
    0% {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) scale(0.7) rotate(0deg);
    }

    12% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate3d(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -48px)), 0) scale(1.15) rotate(var(--rot, 0deg));
    }
}

/* /fish page */

.fishie-page-host,
.fishie-page {
    max-width: min(980px, 94vw);
    margin: 1.5rem auto;
    color: var(--text, #222);
}

.fishie-page-loading,
.fishie-card {
    border: 1px solid var(--text-border, #ccc);
    border-radius: 14px;
    background: var(--box-bg, #fff);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    padding: clamp(1rem, 2.4vw, 1.6rem);
}

.fishie-card h1,
.fishie-page-loading h1 {
    margin: 0 0 0.45rem;
    font-size: clamp(1.45rem, 3vw, 2.1rem);
    line-height: 1.15;
}

.fishie-muted {
    margin: 0.25rem 0 1rem;
    color: var(--title-text-heavy, #666);
}

.fishie-species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.fishie-species-card {
    display: grid;
    grid-template-rows: auto auto;
    justify-items: center;
    gap: 0.35rem;
    min-height: 118px;
    padding: 0.9rem 0.7rem;
    border: 1px solid var(--text-border, #ccc);
    border-radius: 12px;
    background: var(--background, #fff);
    color: var(--text, #222);
    cursor: pointer;
    font: inherit;
}

.fishie-species-card:hover,
.fishie-species-card:focus-visible {
    outline: 2px solid var(--ui-button, #007bff);
    outline-offset: 2px;
}

.fishie-species-glyph {
    font-size: 44px;
    line-height: 1;
    font-family: "Yu Gothic", "Meiryo", "Hiragino Sans", "Noto Sans JP", serif;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.fishie-species-name {
    font-weight: 700;
}

.fishie-owned-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.fishie-owned-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 78px;
    height: 78px;
    border: 1px solid var(--text-border, #ccc);
    border-radius: 50%;
    background: var(--background, #fff);
    font-family: "Yu Gothic", "Meiryo", "Hiragino Sans", "Noto Sans JP", serif;
    font-size: 46px;
    font-weight: 700;
    line-height: 1;
    box-shadow: inset 0 0 0 6px color-mix(in srgb, currentColor 8%, transparent);
}

.fishie-stat-block {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.fishie-meter-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.fishie-meter-track {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border: 1px solid var(--text-border, #ccc);
    border-radius: 999px;
    background: color-mix(in srgb, var(--title-text-light, #aaa) 22%, transparent);
}

.fishie-meter-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, hsl(190 95% 55%), hsl(330 100% 68%));
    transition: width 0.25s ease;
}

.fishie-meter[data-fishie-meter="satiation"] .fishie-meter-fill {
    background: linear-gradient(90deg, hsl(42 100% 58%), hsl(105 85% 54%));
}

.fishie-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.fishie-stats div {
    padding: 0.7rem;
    border: 1px solid var(--text-border, #ccc);
    border-radius: 10px;
    background: var(--background, #fff);
}

.fishie-stats dt {
    margin: 0 0 0.25rem;
    color: var(--title-text-heavy, #666);
    font-size: 0.92em;
}

.fishie-stats dd {
    margin: 0;
    font-weight: 700;
}

.fishie-name-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.5rem;
    align-items: center;
    margin: 1rem 0;
}

.fishie-name-row input {
    min-width: 0;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--text-border, #ccc);
    border-radius: 8px;
    background: var(--background, #fff);
    color: var(--text, #222);
    font: inherit;
}

.fishie-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.fishie-name-row button,
.fishie-page-actions button {
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--text-border, #ccc);
    border-radius: 9px;
    background: var(--ui-button, #007bff);
    color: var(--pure-white, #fff);
    font: inherit;
    cursor: pointer;
}

.fishie-name-row button:hover,
.fishie-page-actions button:hover,
.fishie-name-row button:focus-visible,
.fishie-page-actions button:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--ui-button, #007bff) 70%, white);
    outline-offset: 2px;
}

.fishie-page-actions button.danger {
    background: #a02030;
}

@media (max-width: 700px) {
    .fishie-menu {
        gap: 3px;
        padding: 4px;
    }

    .fishie-menu-btn {
        width: 32px;
        height: 32px;
        font-size: 17px;
    }

    .fishie-name-row {
        grid-template-columns: 1fr;
    }

    .fishie-owned-header {
        grid-template-columns: 1fr;
        justify-items: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fishie-body.zero,
    .fishie-particle {
        animation: none;
    }

    .fishie-meter-fill {
        transition: none;
    }
}
