/* Match catchandcraft.cc theme: dark background, purple accent, Poppins */
:root {
    --bg: #050816;
    --bg-alt: #0b1020;
    --card-bg: #111827;
    --accent: #7c3aed;
    --accent-soft: rgba(124, 58, 237, 0.15);
    --accent-strong: #a855f7;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border-subtle: rgba(148, 163, 184, 0.2);
    --radius-lg: 18px;
    --radius-pill: 999px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.6);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Poppins", system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at top left, #111827 0, var(--bg) 40%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 900px;
    margin: 30px auto;
    background: rgba(17, 24, 39, 0.95);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
}

h1 {
    font-family: "Poppins", sans-serif;
    text-align: center;
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5em;
}

.game-title-with-logo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.game-title-text {
    margin: 0;
}

.game-title-logo-link {
    display: inline-flex;
    line-height: 0;
}

.game-title-logo {
    height: 48px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    border-radius: 10px;
}

.game-title-logo-link:hover .game-title-logo {
    opacity: 0.9;
}

h2 {
    font-family: "Poppins", sans-serif;
    color: var(--accent-strong);
    font-size: 1.15rem;
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 600;
    color: var(--text);
}

.bobber-scene {
    position: relative;
    height: 64px;
    margin-bottom: 12px;
    background: linear-gradient(to bottom, #8ec5e0 0%, #6aadcf 35%, #3d8bb8 70%, #2e7ab0 100%);
    border-radius: 12px;
    overflow: hidden;
}

.bobber-scene .water {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 28px;
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.12));
    pointer-events: none;
}

.bobber {
    position: absolute;
    left: 50%;
    bottom: 32px;
    width: 22px;
    height: 16px;
    margin-left: -11px;
    background: linear-gradient(to bottom, #fff 0%, #fff 45%, #e74c3c 55%, #c0392b 100%);
    border-radius: 50%;
    box-shadow:
        0 2px 4px rgba(0,0,0,0.25),
        inset 0 2px 0 rgba(255,255,255,0.4),
        inset 0 -1px 0 rgba(0,0,0,0.15);
    transform: translateY(0) translateX(0) rotate(0deg);
    transform-origin: center center;
    pointer-events: none;
}

.bobber.bobber-waiting {
    animation: bobber-float 3s ease-in-out infinite;
}

.bobber.bobber-pulled {
    animation: bobber-dunk 0.4s ease-in forwards;
}

@keyframes bobber-float {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(-1deg);
    }
    15% {
        transform: translateY(-4px) translateX(5px) rotate(2deg);
    }
    30% {
        transform: translateY(-1px) translateX(-3px) rotate(-2deg);
    }
    45% {
        transform: translateY(-3px) translateX(2px) rotate(1deg);
    }
    60% {
        transform: translateY(-2px) translateX(-4px) rotate(-1deg);
    }
    75% {
        transform: translateY(-4px) translateX(3px) rotate(2deg);
    }
    90% {
        transform: translateY(-1px) translateX(-2px) rotate(0deg);
    }
}

@keyframes bobber-dunk {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    30% {
        transform: translateY(14px) translateX(0) rotate(6deg);
    }
    100% {
        transform: translateY(32px) translateX(0) rotate(4deg);
    }
}

.game-controls-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 15px;
}

.game-controls-row .controls {
    margin-bottom: 0;
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 10px;
    min-width: 0;
    max-width: 320px;
}

.game-controls-row .controls .catch-feedback {
    width: 100%;
    flex-basis: 100%;
    min-width: 0;
    overflow-wrap: break-word;
}

.game-controls-row .reel-minigame-wrap {
    flex: 1 1 320px;
    min-width: 320px;
}

@media (max-width: 700px) {
    .game-controls-row {
        flex-wrap: wrap;
    }
    .game-controls-row .reel-minigame-wrap {
        flex: 1 1 100%;
        min-width: 0;
    }
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

select, button {
    padding: 10px 14px;
    font-size: 16px;
    border-radius: var(--radius-pill);
    font-family: "Poppins", sans-serif;
}

select {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text);
    border: 1px solid var(--border-subtle);
}

button {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #f9fafb;
    border: none;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 14px 32px rgba(124, 58, 237, 0.4);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(124, 58, 237, 0.5);
}

button:disabled {
    background: rgba(148, 163, 184, 0.3);
    color: var(--muted);
    cursor: not-allowed;
    box-shadow: none;
}

#hookBtn.ready {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
}
#hookBtn.warn {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
}
#hookBtn.danger {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25);
}

/* Catch / miss feedback strip under controls */
.catch-feedback {
    min-height: 0;
    overflow: hidden;
    margin-bottom: 12px;
    border-radius: 8px;
    padding: 0 12px;
    line-height: 0;
    opacity: 0;
    transition: min-height 0.2s ease-out, line-height 0.2s ease-out, opacity 0.25s ease-out, padding 0.2s ease-out;
}

.catch-feedback.catch-feedback-show {
    min-height: 44px;
    line-height: 1.35;
    opacity: 1;
    padding: 10px 14px;
}

.catch-feedback.result-caught {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.5);
    color: #86efac;
}

.catch-feedback.result-missed {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.catch-feedback.result-bait {
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.5);
    color: #c4b5fd;
}

.catch-feedback-msg {
    font-size: 0.95rem;
    animation: catch-feedback-pop 0.35s ease-out;
}

.catch-feedback-line {
    margin-bottom: 4px;
}

.catch-feedback-line:last-child {
    margin-bottom: 0;
}

@keyframes catch-feedback-pop {
    0% {
        opacity: 0;
        transform: scale(0.92);
    }
    70% {
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.game-log,
#log {
    height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.6);
    color: var(--text);
}

.round-summary-heading {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.round-summary-sub {
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: var(--muted);
}

.round-summary-list {
    margin: 0;
    padding-left: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.round-summary-empty {
    color: var(--muted);
    font-style: italic;
}

.log-entry {
    margin-bottom: 8px;
}

#gameOverScreen {
    text-align: center;
    padding: 24px;
    color: var(--text);
}

#gameOverScreen h1 {
    margin-bottom: 20px;
    color: var(--text);
}

.final-stats {
    font-size: 1.1em;
    margin: 12px 0;
    color: var(--text);
}

#gameOverScreen #playAgainBtn {
    margin-top: 20px;
    padding: 12px 24px;
    font-size: 18px;
}

.how-to-play {
    text-align: left;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.how-to-play h2 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: var(--accent-strong);
}

.how-to-play ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.5;
    color: var(--text);
}

.how-to-play li {
    margin-bottom: 8px;
}

.how-to-play li:last-child {
    margin-bottom: 0;
}

.how-to-play .color-ready { color: #2d7a2d; font-weight: bold; }
.how-to-play .color-warn { color: #c9761a; font-weight: bold; }
.how-to-play .color-danger { color: #b53c3c; font-weight: bold; }

.how-to-play .catch-steps {
    margin: 0 0 12px 0;
    padding-left: 22px;
    line-height: 1.55;
}

.how-to-play .catch-steps li {
    margin-bottom: 10px;
}

.how-to-play .how-to-summary {
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.95em;
    color: var(--muted);
}

.how-to-play kbd {
    display: inline-block;
    padding: 2px 6px;
    font-family: "Poppins", sans-serif;
    font-size: 0.9em;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
}

/* Start screen: leaderboard left, form right — keep above the fold */
#startScreen h1 {
    margin-bottom: 0.4em;
}

.start-main-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.start-leaderboard {
    margin-bottom: 0;
    flex: 0 0 auto;
}

.start-form-wrap {
    flex: 1 1 280px;
    min-width: 0;
}

.start-form-wrap .difficulty-wrap {
    margin-bottom: 14px;
}

.start-form-wrap label[for="playerName"] {
    display: block;
    margin-bottom: 6px;
}

.start-form-wrap input#playerName {
    display: block;
    width: 100%;
    max-width: 220px;
    margin-bottom: 14px;
}

.start-form-wrap #startBtn {
    display: block;
}

.recent-rounds-wrap {
    margin-top: 20px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.recent-rounds-title {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.recent-rounds-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-rounds-empty {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.recent-round-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 12px;
    font-size: 0.85rem;
    color: var(--text);
}

.recent-round-meta {
    grid-column: 1;
    color: var(--muted);
    font-size: 0.8rem;
}

.recent-round-name {
    grid-column: 2;
    font-weight: 600;
    text-align: right;
}

.recent-round-fish {
    grid-column: 1;
    color: var(--text);
}

.recent-round-score {
    grid-column: 2;
    font-weight: 600;
    color: var(--accent-strong);
    text-align: right;
}

.difficulty-wrap {
    margin-bottom: 18px;
}

.difficulty-wrap > label {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.difficulty-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
}

.difficulty-option input {
    margin-top: 3px;
}

.difficulty-option span {
    font-weight: 600;
    color: var(--accent-strong);
}

/* Reel-in minigame (Master Angler) */
.reel-minigame-wrap {
    margin-top: 16px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.reel-minigame-title {
    margin: 0 0 12px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.reel-idle-blurb {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.45;
}

.reel-idle-blurb kbd {
    font-size: 0.85em;
}

.reel-arena {
    position: relative;
    height: 180px;
    background: linear-gradient(to bottom, #1e293b 0%, #0f172a 100%);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.reel-bar {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 12px;
    bottom: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.reel-bar .sweet-spot {
    position: absolute;
    left: 0;
    right: 0;
    height: 28%;
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    border-radius: 6px;
    transition: top 0.08s ease-out;
    pointer-events: none;
}

.reel-bar .reel-marker {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 4px;
    box-shadow: 0 0 0 2px var(--card-bg);
    transition: top 0.06s ease-out;
    pointer-events: none;
}

.reel-bar .reel-marker::after {
    content: "YOU";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -18px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.reel-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.reel-progress-bar-wrap {
    flex: 1;
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 999px;
    overflow: hidden;
}

.reel-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-radius: 999px;
    transition: width 0.15s ease-out;
}

.reel-progress-label {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 44px;
}

.reel-instructions {
    margin: 10px 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.reel-instructions kbd {
    background: rgba(15, 23, 42, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    border: 1px solid var(--border-subtle);
}

.reel-fight-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    min-height: 48px;
    font-size: 1.1rem;
    border-radius: 10px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.reel-fight-btn:active,
.reel-fight-btn-held {
    transform: scale(0.98);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
}

label[for="playerName"] {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text);
}

input#playerName {
    font-family: "Poppins", sans-serif;
    padding: 8px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.9);
    color: var(--text);
    font-size: 1rem;
}

#startBtn {
    margin-top: 14px;
}

/* Leaderboards */
.leaderboard-wrap {
    margin-bottom: 20px;
}

.leaderboard-wrap h2 {
    margin: 0 0 12px 0;
    font-size: 1.1em;
    color: var(--accent-strong);
}

.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.leaderboard-grid-stacked {
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 520px;
}

.leaderboard-box {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    min-width: 0;
}

.leaderboard-grid:not(.leaderboard-grid-single):not(.leaderboard-grid-stacked) .leaderboard-box {
    min-width: 280px;
}

.leaderboard-grid-stacked .leaderboard-box {
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
}

.leaderboard-box h3 {
    margin: 0 0 10px 0;
    font-size: 0.95em;
    color: var(--accent-strong);
}

.leaderboard-list {
    margin: 0;
    padding-left: 0;
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--text);
}

/* Uniform column widths so rank/name/score/fish align; full text shown, wraps within cell */
.leaderboard-list li {
    margin-bottom: 6px;
    display: grid;
    grid-template-columns: 2.25em 120px 5em 140px;
    gap: 10px 12px;
    align-items: start;
    list-style: none;
    list-style-position: outside;
}

.leaderboard-list .lb-rank {
    font-weight: bold;
    color: var(--accent-strong);
}

.leaderboard-list .lb-name {
    font-weight: bold;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.leaderboard-list .lb-score {
    color: var(--accent-strong);
    text-align: right;
}

.leaderboard-list .lb-fish {
    font-size: 0.85em;
    color: var(--muted);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.leaderboard-grid-single {
    grid-template-columns: 1fr;
    max-width: 420px;
}

.leaderboard-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.95em;
    color: var(--accent-strong);
}

.leaderboard-link:hover {
    text-decoration: underline;
}

.leaderboard-empty {
    color: var(--muted);
    font-style: italic;
}

/* Hall of Fame — largest fish by type */
.hall-of-fame-wrap {
    margin-top: 28px;
}

.hall-of-fame-desc {
    margin: 0 0 10px 0;
    font-size: 0.9em;
    color: var(--muted);
}

.hall-of-fame-box {
    max-width: 420px;
}

.hall-of-fame-list {
    margin: 0;
    padding-left: 0;
    font-size: 0.95em;
    line-height: 1.6;
    color: var(--text);
    list-style: none;
}

.hall-of-fame-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 6px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.hall-of-fame-item:last-child {
    border-bottom: none;
}

.hall-of-fame-list .hof-fish {
    font-weight: 600;
    color: var(--accent-strong);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hall-of-fame-list .hof-record {
    color: var(--text);
}

.game-over-records {
    margin: 16px 0;
    text-align: left;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.game-over-records h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--accent-strong);
}

.game-over-records-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.95em;
    color: var(--text);
}

.game-over-records-list li {
    padding: 4px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.game-over-records-list li:last-child {
    border-bottom: none;
}

#gameOverScreen .score-submitted {
    margin: 8px 0;
    font-size: 0.95em;
    color: #86efac;
}
