:root {
    font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: #f6f7fb;
    color: #1f2a44;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.quiz-container {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(31, 42, 68, 0.1);
    width: min(1000px, 100%);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    margin: 0;
    color: #8a8ea3;
}

.app-header h1 {
    margin: 0.2rem 0 0;
    font-size: 1.8rem;
}

.view-switch {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    border: 1px solid #dfe4f2;
    background: #f5f7ff;
    color: #1f2a44;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.view-btn.active {
    background: #5c6ac4;
    color: #fff;
    border-color: #5c6ac4;
    box-shadow: 0 10px 20px rgba(92, 106, 196, 0.25);
}

.resource-panel {
    background: #f8f9ff;
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: inset 0 0 0 1px #e1e6fb;
}

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

.food-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.food-label {
    margin: 0;
    font-weight: 600;
    color: #4f5773;
}

.food-bar {
    width: 100%;
    height: 36px;
    border-radius: 999px;
    background: #e5e8ff;
    overflow: hidden;
    position: relative;
}

.food-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff9b40, #ffcf40);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    transition: width 0.3s ease, background 0.3s ease;
}

.food-bar-fill span {
    padding: 0 1rem;
}

.food-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.food-btn {
    border: none;
    background: #5c6ac4;
    color: #fff;
    padding: 0.4rem 0.9rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}

.food-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#foodCustomForm {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

#foodCustomForm input {
    width: 90px;
    padding: 0.3rem;
    border-radius: 8px;
    border: 1px solid #cdd2ec;
}

#foodCustomForm label {
    font-size: 0.85rem;
    color: #5c5f7d;
}

.text-panel h1 {
    margin-top: 0;
}

.text-panel p {
    line-height: 1.6;
    font-size: 1.1rem;
}

.question-panel h2 {
    margin-bottom: 1rem;
}

.next-btn {
    align-self: flex-start;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    border: none;
    background: #5c6ac4;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(92, 106, 196, 0.25);
    transition: transform 0.1s ease, opacity 0.2s ease;
}

.next-btn:active {
    transform: translateY(1px);
}

.next-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.answers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}

.answer-btn {
    padding: 0.9rem 1rem;
    font-size: 1rem;
    border-radius: 12px;
    border: 2px solid #dfe4f2;
    background: #f8f9ff;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.2s ease, background 0.2s ease;
}

.answer-btn:hover {
    transform: translateY(-2px);
    border-color: #5c6ac4;
}

.answer-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.feedback {
    font-weight: 600;
    min-height: 1.5em;
}

.feedback.correct {
    color: #2e8b57;
}

.feedback.incorrect {
    color: #c0392b;
}

.stats {
    font-size: 0.95rem;
    color: #5c6ac4;
}

.hidden {
    display: none !important;
}

.aquarium-panel {
    border-top: 1px solid #eaedf8;
    padding-top: 1rem;
}

.aquarium-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tank-wrap {
    width: 100%;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.6), transparent 40%),
        linear-gradient(180deg, #9cd6f7 0%, #2b69a8 70%);
    border-radius: 24px;
    position: relative;
    aspect-ratio: 16 / 9;
    min-height: 320px;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.15);
}

#aquariumCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.tank-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(17, 32, 60, 0.25), rgba(17, 32, 60, 0.5));
}

.fish-thought {
    position: absolute;
    top: 15%;
    left: 65%;
    max-width: 220px;
    padding: 0.75rem 1rem;
    border-radius: 20px;
    background: #ffffff;
    color: #1e2a44;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(12, 31, 56, 0.25);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    --tail-main-x: 80%;
    --tail-main-y: calc(100% + 10px);
    --tail-sub-x: 72%;
    --tail-sub-y: calc(100% + 26px);
}

.fish-thought::after,
.fish-thought::before {
    content: '';
    position: absolute;
    background: #ffffff;
    border-radius: 50%;
    transition: left 0.2s ease, top 0.2s ease;
}

.fish-thought::after {
    width: 22px;
    height: 22px;
    box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.05);
    left: var(--tail-main-x);
    top: var(--tail-main-y);
    transform: translate(-50%, -50%);
}

.fish-thought::before {
    width: 12px;
    height: 12px;
    opacity: 0.8;
    left: var(--tail-sub-x);
    top: var(--tail-sub-y);
    transform: translate(-50%, -50%);
}

.fish-thought.no-tail-transition::after,
.fish-thought.no-tail-transition::before {
    transition: none;
}

.fish-thought.visible {
    opacity: 1;
}

.shop-panel {
    width: 100%;
    background: #f7f8ff;
    border-radius: 20px;
    padding: 1.25rem;
    box-shadow: inset 0 0 0 1px #e1e6fb;
}

@media (min-width: 768px) {
    .aquarium-layout {
        flex-direction: column;
    }

    .tank-wrap {
        aspect-ratio: 16 / 7;
        min-height: 420px;
    }
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.shop-headline {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

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

.shop-card {
    background: #fff;
    border-radius: 16px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border: 1px solid #e1e6fb;
}

.shop-card img {
    width: 100%;
    height: 120px;
    object-fit: contain;
}

.shop-card h3 {
    margin: 0;
    font-size: 1rem;
}

.shop-card p {
    margin: 0;
    font-size: 0.9rem;
    color: #4f5773;
}

.shop-card button {
    margin-top: auto;
    border: none;
    background: #5c6ac4;
    color: #fff;
    padding: 0.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.shop-card button:disabled {
    background: #c6c9df;
    cursor: not-allowed;
    color: #fff;
}

.shop-reroll-btn {
    border: 1px solid #5c6ac4;
    background: #fff;
    color: #5c6ac4;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.shop-reroll-btn:hover:not(:disabled) {
    background: #5c6ac4;
    color: #fff;
}

.shop-reroll-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
