:root {
    --tile-letter-font: "Eagle Lake", "Georgia", serif;
}

@font-face {
    font-family: "Eagle Lake";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/eagle-lake/EagleLake-Regular.ttf") format("truetype");
}

:root {
    --ink: #17212b;
    --paper: #f6f2e8;
    --panel: #fffaf1;
    --line: #d7cbbb;
    --accent: #24786f;
    --accent-strong: #155c55;
    --sun: #f0bf55;
    --danger: #b94040;
    --charged: #f3d063;
    --cracked: #c8bdac;
    --corrupted: #72518c;
    --lasso-offensive: #b94040;
    --lasso-defensive: #24786f;
    --lasso-support: #8b6f20;
    --lasso-scaling: #72518c;
    --letter-tile-image: url("../images/letter-tile.png");
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(100% - 18px, 1180px);
    margin: 0 auto;
    padding: 12px 0 0;
}

.brand-mark {
    color: var(--ink);
    font-weight: 900;
    text-decoration: none;
}

.site-nav nav {
    display: flex;
    gap: 4px;
}

.site-nav nav a {
    padding: 8px 10px;
    border-radius: 8px;
    color: #384551;
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
}

.site-nav nav a.active,
.site-nav nav a:hover {
    color: #ffffff;
    background: var(--accent-strong);
}

.site-shell {
    width: min(100% - 18px, 1180px);
    margin: 0 auto;
    padding: 14px 0 28px;
}

.game-shell {
    width: min(100% - 18px, 720px);
    margin: 0 auto;
    padding: 14px 0 24px;
}

.topbar,
.combat-band,
.forecast,
.side-panel > section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 250, 241, 0.96);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
}

.kicker {
    margin: 0 0 2px;
    color: var(--accent-strong);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    font-weight: 850;
    letter-spacing: 0;
}

h1 {
    font-size: 1.35rem;
}

h2 {
    font-size: 1rem;
}

.home-hero,
.overview-grid article,
.settings-panel,
.characters-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 250, 241, 0.96);
}

.home-hero {
    display: grid;
    min-height: min(68vh, 620px);
    align-items: center;
    padding: clamp(24px, 7vw, 72px);
}

.home-hero h1 {
    max-width: 760px;
    font-size: clamp(2.4rem, 10vw, 6.4rem);
    line-height: 0.92;
}

.hero-copy {
    max-width: 650px;
    margin: 18px 0 0;
    color: #4b5661;
    font-size: 1.08rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.overview-grid {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.overview-grid article {
    padding: 18px;
}

.overview-grid p,
.settings-form p {
    margin: 8px 0 0;
    color: #65707c;
}

.settings-panel,
.characters-panel {
    padding: clamp(18px, 5vw, 34px);
}

.character-grid {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.character-card {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    text-align: left;
}

.character-card:hover,
.character-card:focus-visible {
    border-color: var(--accent-strong);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(45, 111, 105, 0.14);
}

.character-card img {
    display: block;
    width: 76px;
    height: 76px;
    border-radius: 8px;
    object-fit: cover;
    object-position: top center;
    background: rgba(255, 250, 241, 0.96);
}

.character-card strong,
.character-card span,
.character-card small {
    display: block;
}

.character-card strong {
    font-size: 1.05rem;
}

.character-card span {
    margin-top: 3px;
    color: #4f5b66;
    font-weight: 800;
}

.character-card small {
    margin-top: 5px;
    color: #65707c;
    line-height: 1.25;
}

.settings-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.setting-row {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.setting-row label {
    font-weight: 850;
}

.setting-range {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 52px;
    align-items: center;
    gap: 10px;
}

.setting-range strong {
    color: var(--accent-strong);
    font-weight: 900;
    text-align: right;
}

.settings-status {
    min-height: 24px;
    margin: 0;
    color: var(--accent-strong);
    font-weight: 800;
}

.auth-shell {
    display: grid;
    min-height: calc(100vh - 92px);
    place-items: center;
}

.auth-panel {
    width: min(100%, 460px);
    padding: clamp(18px, 5vw, 30px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 250, 241, 0.98);
}

.auth-panel h1 {
    margin-bottom: 16px;
}

.auth-form {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.auth-form label {
    display: grid;
    gap: 6px;
    font-weight: 850;
}

.auth-google-button {
    margin: 6px 0 4px;
}

.auth-note {
    margin: 12px 0;
    color: #65707c;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.auth-links a {
    color: var(--accent-strong);
    font-weight: 850;
}

.account-list {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.account-list div {
    display: grid;
    gap: 2px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.account-list dt {
    color: #65707c;
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

.account-list dd {
    margin: 0;
    font-weight: 800;
}

.combat-band {
    display: grid;
    grid-template-columns: 1fr 0.8fr;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
}

.status-block,
.intent-block,
.enemy-block {
    min-height: 64px;
    padding: 10px;
    border-radius: 8px;
    background: #ffffff;
}

.status-block span,
.intent-block span,
.enemy-block span {
    display: block;
    color: #65707c;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.status-block strong,
.intent-block strong,
.enemy-block strong {
    font-size: 1.18rem;
}

.enemy-block {
    grid-column: 1 / -1;
}

.forecast {
    margin-top: 10px;
    padding: 12px 14px;
    color: #35414d;
    font-weight: 720;
}

.play-layout {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.board-panel {
    padding: 10px;
}

.board-grid {
    position: relative;
    display: grid;
    gap: 5px;
    width: min(100%, 72vh);
    margin: 0 auto;
}

.board-cell {
    position: relative;
    z-index: 1;
    aspect-ratio: 1;
    min-width: 0;
    border: 1px solid #bfb4a5;
    border-radius: 8px;
    color: var(--ink);
    background: rgba(255,255,240,0.9);
    font-weight: 900;
    line-height: 1;
}

.board-cell.has-letter {
    background: var(--letter-tile-image) center / 100% 100% no-repeat;
    border-width: 0px;
    border-color: var(--accent-strong);
}

.board-cell.selected {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.board-cell.threatened {
    box-shadow: inset 0 0 0 3px rgba(185, 64, 64, 0.45);
}

.board-cell.preview-letter {
    border-style: dashed;
    color: var(--accent-strong);
}

.board-cell.word-telegraph-cell {
    z-index: 6;
    animation: word-wave-glow 0.86s ease-out both;
    animation-delay: calc(var(--wave-index, 0) * 90ms);
}

.board-cell.enemy-telegraph-cell {
    z-index: 7;
    animation: enemy-target-glow 0.78s ease-out both;
    animation-delay: calc(var(--wave-index, 0) * 70ms);
}

@keyframes word-wave-glow {
    0% {
        filter: brightness(1);
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 224, 117, 0);
    }

    42% {
        filter: brightness(1.42) saturate(1.35);
        transform: scale(1.08);
        box-shadow:
            0 0 0 3px rgba(255, 244, 184, 0.95),
            0 0 20px 9px rgba(255, 207, 83, 0.82),
            0 0 36px 16px rgba(80, 185, 255, 0.46);
    }

    100% {
        filter: brightness(1);
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 224, 117, 0);
    }
}

@keyframes enemy-target-glow {
    0% {
        filter: brightness(1);
        transform: scale(1);
        box-shadow: 0 0 0 rgba(185, 64, 64, 0);
    }

    46% {
        filter: brightness(1.28) saturate(1.45);
        transform: scale(1.05);
        box-shadow:
            inset 0 0 0 4px rgba(255, 236, 210, 0.95),
            0 0 22px 10px rgba(192, 54, 54, 0.74),
            0 0 40px 18px rgba(83, 22, 22, 0.52);
    }

    100% {
        filter: brightness(1);
        transform: scale(1);
        box-shadow: 0 0 0 rgba(185, 64, 64, 0);
    }
}

.word-lasso-layer {
    position: absolute;
    z-index: 4;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.word-lasso-path {
    fill: none;
    stroke: var(--lasso-support);
    stroke-width: 5px;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.68;
    filter: drop-shadow(0 0 2px currentColor);
    animation: lasso-pulse 2.8s ease-in-out infinite;
    vector-effect: non-scaling-stroke;
}

@keyframes lasso-pulse {
    0%,
    100% {
        opacity: 0.52;
        stroke-width: 4.5px;
        filter: drop-shadow(0 0 1px currentColor);
    }

    50% {
        opacity: 0.82;
        stroke-width: 5.7px;
        filter: drop-shadow(0 0 5px currentColor);
    }
}

@media (prefers-reduced-motion: reduce) {
    .word-lasso-path,
    .board-cell.word-telegraph-cell,
    .board-cell.enemy-telegraph-cell,
    .hud-enemy-sprite.enemy-sprite-telegraph,
    .action-telegraph.telegraph-in .action-telegraph-card,
    .action-telegraph.telegraph-out .action-telegraph-card {
        animation: none;
    }
}

.lasso-pulse-disabled .word-lasso-path {
    animation: none;
    opacity: 0.68;
    stroke-width: 5px;
    filter: drop-shadow(0 0 2px currentColor);
}

.word-lasso-offensive {
    stroke: var(--lasso-offensive);
}

.word-lasso-defensive {
    stroke: var(--lasso-defensive);
}

.word-lasso-support {
    stroke: var(--lasso-support);
}

.word-lasso-scaling {
    stroke: var(--lasso-scaling);
}

.word-lasso-suppressed {
    stroke-dasharray: 8 7;
    opacity: 0.38;
}

.board-cell.terrain-charged {
    background:
        linear-gradient(rgba(255, 243, 188, 0.72), rgba(255, 243, 188, 0.72)),
        #fff3bc;
}

.board-cell.terrain-cracked {
    background: #e3dbcf;
}

.board-cell.terrain-corrupted {
    color: #ffffff;
    background: var(--corrupted);
}

.board-cell.has-letter.terrain-charged {
    background:
        linear-gradient(rgba(255, 222, 103, 0.28), rgba(255, 222, 103, 0.28)),
        var(--letter-tile-image) center / 100% 100% no-repeat,
        #efd59b;
}

.board-cell.has-letter.terrain-corrupted {
    color: #ffffff;
    background:
        linear-gradient(rgba(114, 81, 140, 0.5), rgba(114, 81, 140, 0.5)),
        var(--letter-tile-image) center / 100% 100% no-repeat,
        var(--corrupted);
}

.cell-letter {
    position: relative;
    z-index: 3;
    display: block;
    font-family: var(--tile-letter-font);
    font-size: clamp(1rem, 7vw, 2rem);
    font-weight: 400;
}

.cell-terrain {
    position: absolute;
    z-index: 3;
    right: 4px;
    bottom: 3px;
    left: 4px;
    overflow: hidden;
    font-size: 0.48rem;
    font-weight: 800;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.tray-zone {
    position: relative;
    min-height: 142px;
    margin-top: 12px;
}

.tray {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.tray-tile {
    touch-action: none;
    user-select: none;
    aspect-ratio: 1;
    border: 0;
    border-radius: 8px;
    color: var(--ink);
    background:
        var(--letter-tile-image) center / 100% 100% no-repeat,
        var(--sun);
    font-family: var(--tile-letter-font);
    font-size: 2.15rem;
    font-weight: 400;
    text-shadow:
        0 2px 0 rgba(255, 245, 213, 0.7),
        0 3px 3px rgba(62, 43, 20, 0.38);
}

.tray-tile.selected {
    box-shadow: 0 5px 0 var(--accent-strong);
    transform: translateY(-3px);
}

.tray-tile.dragging-source {
    opacity: 0.55;
}

.tile-drag-ghost {
    position: fixed;
    z-index: 40;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 8px;
    color: var(--ink);
    background:
        var(--letter-tile-image) center / 100% 100% no-repeat,
        var(--sun);
    box-shadow: 0 14px 30px rgba(23, 33, 43, 0.24);
    font-size: 1.7rem;
    font-family: var(--tile-letter-font);
    font-weight: 400;
    line-height: 1;
    pointer-events: none;
    text-shadow:
        0 2px 0 rgba(255, 245, 213, 0.7),
        0 3px 3px rgba(62, 43, 20, 0.38);
    transform: translate(-50%, -50%);
}

.board-cell.drag-over {
    outline: 3px solid var(--sun);
    outline-offset: 2px;
}

.side-panel {
    display: grid;
    gap: 12px;
}

.side-panel > section {
    padding: 14px;
}

.detail-pane {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--accent-strong);
    border-radius: 8px;
    background: rgba(255, 250, 241, 0.98);
    box-shadow: 0 16px 38px rgba(23, 33, 43, 0.18);
}

.detail-pane pre {
    margin: 12px 0;
    overflow: auto;
    white-space: pre-wrap;
    font: inherit;
    color: #384551;
}

.preview-actions {
    display: grid;
    gap: 8px;
}

#reward-options,
#victory-upgrades,
#word-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.reward-option,
.victory-upgrade,
.word-card {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    text-align: left;
}

.reward-option span,
.victory-upgrade span,
.word-card span,
.word-card small,
.empty-note {
    color: #65707c;
}

.victory-upgrade {
    border-left: 5px solid #8b6f20;
}

.victory-upgrade.chosen {
    border-color: #24786f;
    background: rgba(255, 255, 255, 0.86);
}

.word-card > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.role-offensive {
    border-left: 5px solid #b94040;
}

.role-defensive {
    border-left: 5px solid #2f6db2;
}

.role-support {
    border-left: 5px solid #24786f;
}

.role-scaling {
    border-left: 5px solid #8b6f20;
}

#run-log {
    display: grid;
    gap: 6px;
    margin: 10px 0 0;
    padding-left: 18px;
    color: #384551;
    font-size: 1rem;
    line-height: 1.35;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(23, 33, 43, 0.46);
}

.overlay-panel {
    width: min(100%, 560px);
    max-height: min(82vh, 720px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 24px 70px rgba(23, 33, 43, 0.28);
    padding: 18px;
}

.action-telegraph {
    position: fixed;
    inset: 0;
    z-index: 18;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.action-telegraph-card {
    display: grid;
    justify-items: center;
    gap: 8px;
    color: #ffffff;
    text-align: center;
    text-shadow:
        0 3px 8px rgba(0, 0, 0, 0.75),
        0 0 22px rgba(0, 0, 0, 0.55);
}

.action-telegraph-icon {
    position: relative;
    display: block;
    width: min(58vw, 260px);
    height: min(58vw, 260px);
    border-radius: 999px;
    background: radial-gradient(circle, var(--telegraph-glow, rgba(242, 208, 107, 0.25)) 0 24%, transparent 68%);
}

.action-telegraph-icon img {
    position: absolute;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.action-telegraph-backdrop {
    inset: -18%;
    width: 136% !important;
    height: 136% !important;
    z-index: 0;
    filter: drop-shadow(0 0 30px var(--telegraph-glow, rgba(242, 208, 107, 0.75)));
    opacity: 0.36;
    transform: rotate(-8deg);
}

.action-telegraph-foreground {
    inset: 0;
    z-index: 1;
    filter: drop-shadow(0 0 18px var(--telegraph-glow, rgba(242, 208, 107, 0.75)));
}

.telegraph-damage .action-telegraph-foreground,
.telegraph-damage .action-telegraph-backdrop {
    filter:
        sepia(1) saturate(5) hue-rotate(318deg) brightness(0.78) contrast(1.22)
        drop-shadow(0 0 18px var(--telegraph-glow, rgba(185, 64, 64, 0.8)));
}

.telegraph-shield .action-telegraph-foreground,
.telegraph-shield .action-telegraph-backdrop {
    filter:
        sepia(1) saturate(3) hue-rotate(170deg) brightness(0.72) contrast(1.14)
        drop-shadow(0 0 18px var(--telegraph-glow, rgba(63, 93, 128, 0.78)));
}

.telegraph-poison .action-telegraph-foreground,
.telegraph-poison .action-telegraph-backdrop {
    filter:
        sepia(1) saturate(4) hue-rotate(52deg) brightness(0.7) contrast(1.18)
        drop-shadow(0 0 18px var(--telegraph-glow, rgba(91, 141, 55, 0.78)));
}

.telegraph-repair .action-telegraph-foreground,
.telegraph-repair .action-telegraph-backdrop {
    filter:
        sepia(1) saturate(3.8) hue-rotate(125deg) brightness(0.72) contrast(1.14)
        drop-shadow(0 0 18px var(--telegraph-glow, rgba(36, 120, 111, 0.78)));
}

.telegraph-cleanse .action-telegraph-foreground,
.telegraph-cleanse .action-telegraph-backdrop {
    filter:
        sepia(1) saturate(4.2) hue-rotate(6deg) brightness(0.92) contrast(1.08)
        drop-shadow(0 0 18px var(--telegraph-glow, rgba(217, 183, 71, 0.78)));
}

.telegraph-enemy_damage .action-telegraph-foreground,
.telegraph-enemy_damage .action-telegraph-backdrop {
    filter:
        sepia(1) saturate(5.4) hue-rotate(318deg) brightness(0.66) contrast(1.32)
        drop-shadow(0 0 20px var(--telegraph-glow, rgba(145, 34, 34, 0.86)));
}

.telegraph-corrupt .action-telegraph-foreground,
.telegraph-corrupt .action-telegraph-backdrop {
    filter:
        sepia(1) saturate(5) hue-rotate(62deg) brightness(0.58) contrast(1.24)
        drop-shadow(0 0 20px var(--telegraph-glow, rgba(77, 120, 43, 0.84)));
}

.telegraph-suppress .action-telegraph-foreground,
.telegraph-suppress .action-telegraph-backdrop {
    filter:
        sepia(1) saturate(3.6) hue-rotate(220deg) brightness(0.6) contrast(1.28)
        drop-shadow(0 0 20px var(--telegraph-glow, rgba(68, 54, 120, 0.84)));
}

.telegraph-crack .action-telegraph-foreground,
.telegraph-crack .action-telegraph-backdrop,
.telegraph-break .action-telegraph-foreground,
.telegraph-break .action-telegraph-backdrop {
    filter:
        sepia(1) saturate(4.8) hue-rotate(336deg) brightness(0.68) contrast(1.3)
        drop-shadow(0 0 20px var(--telegraph-glow, rgba(174, 68, 48, 0.84)));
}

.action-telegraph strong {
    font-size: clamp(4rem, 19vw, 9rem);
    font-weight: 950;
    line-height: 0.86;
}

.action-telegraph span:last-child {
    font-size: clamp(1.1rem, 5vw, 2rem);
    font-weight: 900;
    text-transform: uppercase;
}

.telegraph-damage {
    --telegraph-color: #b94040;
    --telegraph-backdrop-color: rgba(255, 180, 101, 0.42);
    --telegraph-glow: rgba(185, 64, 64, 0.8);
}

.telegraph-shield {
    --telegraph-color: #3f5d80;
    --telegraph-backdrop-color: rgba(150, 190, 230, 0.36);
    --telegraph-glow: rgba(63, 93, 128, 0.78);
}

.telegraph-poison {
    --telegraph-color: #5b8d37;
    --telegraph-backdrop-color: rgba(154, 205, 84, 0.36);
    --telegraph-glow: rgba(91, 141, 55, 0.78);
}

.telegraph-repair {
    --telegraph-color: #24786f;
    --telegraph-backdrop-color: rgba(111, 218, 202, 0.36);
    --telegraph-glow: rgba(36, 120, 111, 0.78);
}

.telegraph-cleanse {
    --telegraph-color: #d9b747;
    --telegraph-backdrop-color: rgba(255, 238, 148, 0.4);
    --telegraph-glow: rgba(217, 183, 71, 0.78);
}

.telegraph-enemy_damage {
    --telegraph-color: #912222;
    --telegraph-backdrop-color: rgba(255, 111, 83, 0.42);
    --telegraph-glow: rgba(145, 34, 34, 0.86);
}

.telegraph-corrupt {
    --telegraph-color: #4d782b;
    --telegraph-backdrop-color: rgba(122, 189, 69, 0.36);
    --telegraph-glow: rgba(77, 120, 43, 0.84);
}

.telegraph-suppress {
    --telegraph-color: #443678;
    --telegraph-backdrop-color: rgba(137, 116, 214, 0.34);
    --telegraph-glow: rgba(68, 54, 120, 0.84);
}

.telegraph-crack,
.telegraph-break {
    --telegraph-color: #ae4430;
    --telegraph-backdrop-color: rgba(230, 108, 69, 0.38);
    --telegraph-glow: rgba(174, 68, 48, 0.84);
}

.action-telegraph.telegraph-in .action-telegraph-card {
    animation: action-telegraph-in 0.72s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.action-telegraph.telegraph-out .action-telegraph-card {
    animation: action-telegraph-out 0.18s ease-in both;
}

@keyframes action-telegraph-in {
    0% {
        opacity: 0;
        transform: scale(0.38) rotate(-6deg);
    }

    58% {
        opacity: 1;
        transform: scale(1.08) rotate(1deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

@keyframes action-telegraph-out {
    to {
        opacity: 0;
        transform: scale(1.18);
    }
}

#full-run-log {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding-left: 20px;
    color: #384551;
    font-size: 1.02rem;
    line-height: 1.4;
}

@media (min-width: 760px) {
    .site-nav {
        padding-top: 18px;
    }

    .site-shell {
        padding-top: 24px;
    }

    .game-shell {
        width: min(100% - 28px, 1180px);
        padding-top: 24px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .combat-band {
        grid-template-columns: 0.7fr 0.55fr 1.6fr 0.55fr;
    }

    .enemy-block {
        grid-column: auto;
    }

    .play-layout {
        grid-template-columns: minmax(0, 1.2fr) minmax(330px, 0.8fr);
        align-items: start;
    }

    .board-panel,
    .side-panel > section {
        padding: 16px;
    }

    .board-grid {
        gap: 7px;
    }

    .tray-zone {
        min-height: 108px;
    }

    .tray {
        grid-template-columns: repeat(8, 1fr);
    }

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

    .setting-row {
        grid-template-columns: minmax(0, 1fr) minmax(220px, 0.55fr);
        align-items: center;
    }
}

.game-page {
    height: 100dvh;
    overflow: hidden;
}

.game-page .site-nav {
    display: none;
}

.game-page .game-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0;
    width: 100%;
    height: calc(100dvh - 58px);
    padding: 0;
}

.game-hud {
    position: relative;
    z-index: 8;
    overflow: visible;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    min-height: 148px;
    border-bottom: solid 1px #c4c6c9;
    box-shadow: 0px 0px 4px 4px rgba(0,0,0,0.3);
}

.game-hud h1 {
    font-size: 1rem;
    line-height: 1;
}

.game-hud .kicker {
    margin-bottom: 1px;
    font-size: 0.64rem;
}

.hud-enemy {
    position: relative;
    min-width: 0;
    overflow: visible;
    display: grid;
    justify-items: end;
    align-items: center;
    padding: 8px;
    border: 0;
    border-radius: 0;
    background:
        url("../images/levels/ancient_library.png") center / cover no-repeat,
        rgba(255, 250, 241, 0.96);
}

.hud-enemy-sprite {
    position: absolute;
    bottom: 0;
    left: clamp(32px, 9vw, 108px);
    z-index: 1;
    display: block;
    width: min(36vw, 190px);
    max-height: 138px;
    object-fit: contain;
    object-position: bottom center;
    pointer-events: none;
    transform-origin: bottom center;
    will-change: transform;
}

.hud-enemy-sprite.enemy-idle-sway {
    animation: enemy-idle-sway 4.8s ease-in-out infinite;
}

.hud-enemy-sprite.enemy-idle-breathe {
    animation: enemy-idle-breathe 3.8s ease-in-out infinite;
}

.hud-enemy-sprite.enemy-idle-tilt {
    animation: enemy-idle-tilt 5.2s ease-in-out infinite;
}

.hud-enemy-sprite.enemy-idle-bob {
    animation: enemy-idle-bob 3.4s ease-in-out infinite;
}

.hud-enemy-sprite.enemy-idle-none {
    animation: none;
}

.hud-enemy-sprite.enemy-sprite-telegraph {
    z-index: 9;
    animation: enemy-sprite-surge 0.58s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes enemy-idle-sway {
    0%,
    100% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(6px);
    }
}

@keyframes enemy-idle-breathe {
    0%,
    100% {
        transform: scale(0.985);
    }

    50% {
        transform: scale(1.035);
    }
}

@keyframes enemy-idle-tilt {
    0%,
    100% {
        transform: rotate(-2.5deg);
    }

    50% {
        transform: rotate(2.5deg);
    }
}

@keyframes enemy-idle-bob {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes enemy-sprite-surge {
    0% {
        filter: brightness(1) drop-shadow(0 0 0 rgba(255, 255, 255, 0));
        transform: scale(1);
    }

    36% {
        filter:
            brightness(2.25)
            saturate(1.8)
            drop-shadow(0 0 20px rgba(255, 236, 184, 0.92))
            drop-shadow(0 0 34px rgba(185, 64, 64, 0.66));
        transform: scale(2) translateY(54px);
    }

    68% {
        filter:
            brightness(0.78)
            saturate(1.3)
            drop-shadow(0 0 18px rgba(185, 64, 64, 0.76));
        transform: scale(1.42) translateY(32px);
    }

    100% {
        filter: brightness(1) drop-shadow(0 0 0 rgba(255, 255, 255, 0));
        transform: scale(1);
    }
}

.hud-enemy-copy {
    position: relative;
    z-index: 2;
    display: grid;
    align-content: center;
    width: min(50vw, 50%);
    min-width: 0;
    min-height: 128px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 250, 241, 0.8);
}

.hud-enemy span {
    color: #65707c;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.hud-enemy strong {
    display: block;
    overflow: hidden;
    font-size: 0.98rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hud-enemy small {
    display: block;
    overflow: hidden;
    color: #4f5b66;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hud-enemy .progress {
    height: 5px;
    margin-top: 4px;
}

.hud-enemy .forecast {
    min-height: 0;
    max-height: none;
    margin: 4px 0 0;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #35414d;
    font-size: 0.78rem;
    font-weight: 720;
    line-height: 1.18;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.icon-button span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 2px 0;
    border-radius: 999px;
    background: var(--ink);
}

.game-page .play-layout {
    background: url(../images/areas/ruins_background.png) no-repeat center center;
    background-size: cover;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
    margin: 0;
    padding: 0 6px;
}

.game-page .board-panel {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 148px;
    row-gap: 8px;
    min-height: 0;
    padding: 8px 8px 0 8px;
    border: 0;
    border-radius: 0;
    overflow: hidden;
}

.game-page .board-grid {
    align-self: center;
    justify-self: center;
    width: min(100%, 43dvh, calc(100vw - 28px), calc(100dvh - 348px));
    height: auto;
    max-width: 100%;
    max-height: 100%;
    gap: 5px;
}

.game-page .board-cell {
    border-radius: 6px;
}

.game-page .cell-letter {
    font-size: clamp(1rem, 6vw, 1.75rem);
}

.game-page .cell-terrain {
    font-size: 0.42rem;
}

.game-page .tray-zone {
    --tray-tile-size: 48px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 100px 34px;
    gap: 6px;
    min-height: 0;
    margin-top: 0;
    overflow: visible;
}

.game-page .tray {
    align-content: start;
    justify-content: center;
    grid-template-columns: repeat(3, var(--tray-tile-size));
    grid-auto-rows: var(--tray-tile-size);
    gap: 4px;
    min-height: 0;
    overflow: hidden;
}

.game-page .tray-tile {
    width: var(--tray-tile-size);
    height: var(--tray-tile-size);
    max-height: none;
    min-height: 0;
    aspect-ratio: 1 / 1;
    font-size: 1.15rem;
}

.player-panel {
    display: grid;
    order: -1;
    grid-template-columns: minmax(0, 1fr) 52px;
    align-content: center;
    align-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 0;
    padding: 6px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.player-panel:focus-visible {
    outline: 2px solid var(--sun);
    outline-offset: 2px;
}

.player-headshot {
    display: block;
    align-self: stretch;
    justify-self: stretch;
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: bottom left;
}

.player-stats {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0;
    min-width: 0;
}

.player-stat-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 52px;
    height: 48px;
    --player-stat-color: #9f3f32;
    --player-stat-icon: url("../icons/delapouite/heart-beats.svg");
}

.player-stat-icon img {
    display: none;
}

.player-stat-icon::before {
    position: absolute;
    inset: 0;
    background: var(--player-stat-color);
    content: "";
    mask: var(--player-stat-icon) center / contain no-repeat;
    -webkit-mask: var(--player-stat-icon) center / contain no-repeat;
}

.player-stat-icon strong {
    position: relative;
    z-index: 1;
    color: #ffffff;
    font-size: 1.60rem;
    font-weight: 950;
    line-height: 1;
    text-shadow:
        0 1px 2px rgba(23, 33, 43, 0.8),
        0 0 4px rgba(23, 33, 43, 0.65);
}

.player-stat-hp {
    padding-bottom:8px;
}
.player-stat-hp img {
    filter: none;
}

.player-stat-shield {
    width: 52px;
    height: 52px;
    --player-stat-color: #3f5d80;
    --player-stat-icon: url("../icons/willdabeast/round-shield.svg");
}

.boon-strip {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    overflow: hidden;
    padding: 3px;
    border: none;
    border-radius: 8px;
    background: url("../images/textures/paper.jpg") no-repeat center center;
    background-size: cover;
}

.boon-icon {
    display: grid;
    place-items: center;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border: 1px solid var(--accent-strong);
    border-radius: 999px;
    color: #ffffff;
    background: var(--accent);
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1;
    overflow: hidden;
    padding: 0;
}

.boon-icon img {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: contain;
    transform: translate(0.5px, 0.5px);
}

.boon-icon:hover,
.boon-icon:focus-visible {
    outline: 2px solid var(--sun);
    outline-offset: 2px;
}

.boon-passive {
    background: #8b6f20;
    border-color: #6c5516;
}

.boon-id-vowel_ward {
    background: #2f6db2;
    border-color: #214e80;
}

.boon-id-longshot {
    background: #9b4c26;
    border-color: #6f3418;
}

.boon-id-echo_poison {
    background: #6c3a8f;
    border-color: #4c2866;
}

.boon-id-cross_repair {
    background: #24786f;
    border-color: #155c55;
}

.boon-id-consonant_crash {
    background: #b94040;
    border-color: #842b2b;
}

.boon-id-corrupt_catalyst {
    background: #4f6f2b;
    border-color: #354d1d;
}

.boon-id-offensive {
    background: #9e2637;
    border-color: #701927;
}

.boon-id-defensive {
    background: #1f6f96;
    border-color: #164d68;
}

.boon-id-support {
    background: #8b6f20;
    border-color: #6c5516;
}

.boon-id-scaling {
    background: #5d4aa0;
    border-color: #40336f;
}

.boon-detail-body {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin-top: 16px;
}

.boon-detail-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 2px solid var(--accent-strong);
    border-radius: 999px;
    color: #ffffff;
    background: var(--accent);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

.boon-detail-icon img {
    display: block;
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.boon-detail-icon.boon-passive {
    border-color: #6c5516;
    background: #8b6f20;
}

.boon-detail-body strong {
    display: block;
    margin-bottom: 4px;
    color: #65707c;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.boon-detail-body p {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.35;
}

.player-detail-body {
    display: grid;
    grid-template-columns: minmax(130px, 0.68fr) minmax(0, 1fr);
    gap: 16px;
    align-items: end;
    margin-top: 16px;
}

.player-detail-fullbody {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    object-position: bottom center;
}

.player-detail-stats {
    display: grid;
    gap: 10px;
}

.player-detail-stats div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.player-detail-stats span {
    color: #65707c;
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

.player-detail-stats strong {
    color: var(--ink);
    font-size: 1.2rem;
    line-height: 1;
}

.player-detail-stats p {
    margin: 0;
    color: var(--ink);
    line-height: 1.35;
}

.character-detail-card {
    width: min(100%, 620px);
}

.character-detail-body {
    display: grid;
    grid-template-columns: minmax(120px, 0.62fr) minmax(0, 1fr);
    gap: 16px;
    align-items: end;
    margin-top: 16px;
}

#character-full-body {
    display: block;
    width: 100%;
    max-height: 380px;
    object-fit: contain;
    object-position: bottom center;
}

.character-detail-copy {
    display: grid;
    gap: 12px;
}

.character-stat-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.character-stat-list div {
    display: grid;
    gap: 3px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.74);
}

.character-stat-list span {
    color: #65707c;
    font-size: 0.68rem;
    font-weight: 850;
    text-transform: uppercase;
}

.character-stat-list strong {
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.1;
}

#character-mutations {
    margin: 0;
    color: #4f5b66;
    font-weight: 760;
    line-height: 1.35;
}

.boon-empty {
    align-self: center;
    color: #65707c;
    font-size: 0.78rem;
    font-weight: 800;
}

.game-page .side-panel {
    display: none;
}

.log-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 15;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 8px;
    align-items: center;
    min-height: 52px;
    padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 250, 241, 0.98);
    box-shadow: 0 -10px 30px rgba(23, 33, 43, 0.12);
}

.menu-toggle {
    background: var(--accent);
    border-color: var(--accent-strong);
}

.menu-toggle img {
    display: block;
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.log-dock p {
    margin: 0;
    overflow: hidden;
    color: #384551;
    font-size: 0.94rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-toggle span:first-child {
    transform: translateY(3px) rotate(45deg);
}

.log-toggle span:nth-child(2) {
    opacity: 0;
}

.log-toggle span:last-child {
    transform: translateY(-3px) rotate(-45deg);
}

.menu-links {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.menu-links a,
.menu-links button {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 850;
    text-align: left;
    text-decoration: none;
}

.menu-links a {
    color: var(--ink);
    background: #ffffff;
    border: 1px solid var(--line);
}

.failure-card,
.victory-card {
    width: min(100%, 460px);
}

.failure-copy,
.victory-copy,
.victory-login {
    margin: 8px 0 16px;
    color: #4f5b66;
    font-weight: 720;
}

.victory-login {
    padding: 10px 12px;
    border: 1px solid rgba(139, 111, 32, 0.34);
    border-radius: 8px;
    background: rgba(255, 248, 220, 0.78);
}

.victory-login a {
    color: var(--accent-strong);
    font-weight: 850;
}

.failure-summary {
    display: grid;
    gap: 10px;
    margin: 0 0 18px;
}

.failure-summary div {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.failure-summary dt {
    color: #65707c;
    font-size: 0.7rem;
    font-weight: 850;
    text-transform: uppercase;
}

.failure-summary dd {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 850;
    line-height: 1.25;
}

@media (min-width: 760px) {
    .game-page .game-shell {
        height: calc(100dvh - 60px);
    }

    .hud-enemy .forecast {
        font-size: 0.92rem;
    }

    .game-page .play-layout {
        grid-template-columns: minmax(0, 1fr) minmax(240px, 0.36fr);
        align-items: stretch;
    }

    .game-page .board-grid {
        width: min(100%, 50dvh, 640px, calc(100dvh - 346px));
        height: auto;
        gap: 7px;
    }

    .game-page .tray-zone {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: 100px 34px;
    }

    .game-page .tray {
        grid-template-columns: repeat(3, var(--tray-tile-size));
    }

    .game-page .tray-tile {
        font-size: 1.15rem;
    }

    .game-page .side-panel {
        display: grid;
        min-height: 0;
    }

    .game-page .words-card {
        min-height: 0;
        overflow: hidden;
    }

    .game-page #word-list {
        max-height: 100%;
        overflow: auto;
    }
}
