/* felina.css - Dark Fantasy Styling for Felina: Downfall of the Villa */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #050408;
    color: #e0e0e0;
}

#canvas-container {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99;
    opacity: 0;
    transition: opacity 0.15s ease-out;
}

#dim-alert {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    font-size: 2.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #fff;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
}

/* BOSS HEALTH BANNER */
.boss-banner {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    max-width: 90%;
    background: rgba(15, 10, 25, 0.9);
    border: 2px solid #e74c3c;
    border-radius: 12px;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 15;
    box-shadow: 0 0 30px rgba(231, 76, 60, 0.6);
}

.boss-name {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: #ff6b6b;
    text-transform: uppercase;
}

.boss-hp-container {
    width: 100%;
    height: 14px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.boss-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.9);
    transition: width 0.15s ease-out;
}

/* BOSS POSTURE (Stagger) BAR — fills on parries, empties on stagger */
.boss-posture-container {
    width: 78%;
    height: 7px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 215, 0, 0.28);
}

.boss-posture-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #b8860b, #ffd700);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.85);
    transition: width 0.12s ease-out;
}

/* CONTROLS TABLE (instruction modal) — keyboard and controller side by side */
.ctrl-table {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 14px;
}

.ctrl-head,
.ctrl-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1.15fr;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
}

.ctrl-head {
    font-size: 0.72rem;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 4px;
}

.ctrl-sub {
    margin-top: 10px;
    padding: 4px 12px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #a29bfe;
}

.ctrl-row {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.ctrl-row.highlight {
    background: rgba(162, 155, 254, 0.09);
    border-left: 2px solid #a29bfe;
}

.ctrl-name {
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.9);
}

.ctrl-table .key-badge,
.ctrl-table .pad-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctrl-table .key-badge {
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.82);
}

.ctrl-table .pad-badge {
    background: rgba(0, 210, 211, 0.13);
    border: 1px solid rgba(0, 210, 211, 0.38);
    color: #7fe9e6;
}

.ctrl-note {
    margin: 0 0 14px;
    padding: 9px 12px;
    font-size: 0.8rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.62);
    background: rgba(0, 210, 211, 0.06);
    border-left: 2px solid rgba(0, 210, 211, 0.4);
    border-radius: 5px;
}

.ctrl-note strong { color: #7fe9e6; }

@media (max-width: 640px) {
    .ctrl-head { display: none; }
    .ctrl-row { grid-template-columns: 1fr; gap: 4px; }
    .ctrl-name { font-weight: 700; }
}

/* TELEGRAPH LEGEND (instruction modal) */
.tg-heading {
    margin: 22px 0 6px;
    font-size: 1.02rem;
    letter-spacing: 2px;
    color: #ffd98a;
    text-transform: uppercase;
}

.tg-intro {
    margin: 0 0 12px;
    font-size: 0.86rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.72);
}

.telegraph-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.tg-row {
    display: grid;
    grid-template-columns: 18px 168px 1fr;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    border-left: 3px solid transparent;
}

.tg-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.tg-name {
    font-weight: 800;
    font-size: 0.82rem;
    letter-spacing: 1.2px;
}

.tg-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.66);
}

.tg-parry { border-left-color: #ffcc33; }
.tg-parry .tg-swatch { background: #ffcc33; box-shadow: 0 0 10px rgba(255, 204, 51, 0.9); }
.tg-parry .tg-name { color: #ffcc33; }

.tg-dodge { border-left-color: #ff3344; }
.tg-dodge .tg-swatch { background: #ff3344; box-shadow: 0 0 10px rgba(255, 51, 68, 0.9); }
.tg-dodge .tg-name { color: #ff5566; }

.tg-counter { border-left-color: #33ccff; }
.tg-counter .tg-swatch { background: #33ccff; box-shadow: 0 0 10px rgba(51, 204, 255, 0.9); }
.tg-counter .tg-name { color: #33ccff; }

@media (max-width: 620px) {
    .tg-row { grid-template-columns: 16px 1fr; }
    .tg-desc { grid-column: 1 / -1; }
}

/* INTERACT BANNER */
.interact-banner {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 16, 35, 0.92);
    border: 2px solid #ffd700;
    border-radius: 30px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 20;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.5);
    animation: bounceBanner 1.5s infinite ease-in-out;
}

.key-hint {
    background: #ffd700;
    color: #000;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

#interact-text {
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
    letter-spacing: 1px;
}

@keyframes bounceBanner {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -8px); }
}

/* --- HUD OVERLAY --- */
#hud-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    pointer-events: none;
}

.hud-top-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
}

.hud-header {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(15, 12, 25, 0.85);
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid rgba(138, 43, 226, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.cat-avatar {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

.bars-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 230px;
}

.bar-container {
    width: 100%;
    height: 16px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stamina-container {
    height: 12px;
}

.posture-container {
    height: 10px;
}

.bar-fill {
    height: 100%;
    transition: width 0.15s ease-out;
}

.hp-fill {
    background: linear-gradient(90deg, #e74c3c, #ff6b6b);
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.8);
}

.stamina-fill {
    background: linear-gradient(90deg, #f1c40f, #f39c12);
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.8);
}

.posture-fill {
    background: linear-gradient(90deg, #3498db, #2ecc71);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.8);
}

/*
 * Ein verweigerter Angriff muss antworten, sonst wirkt der Knopf kaputt.
 * Das Aufblitzen sitzt bewusst auf DER Leiste, die den Angriff verhindert
 * hat — der Blick soll dorthin gehen, wo die Ursache liegt.
 */
.bar-exhausted {
    animation: stamina-refused 0.35s ease-out;
}

@keyframes stamina-refused {
    0%   { filter: brightness(2.6) saturate(0.2); transform: translateX(0); }
    25%  { transform: translateX(-3px); }
    55%  { transform: translateX(3px); }
    100% { filter: brightness(1) saturate(1); transform: translateX(0); }
}

.bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.62rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    letter-spacing: 1px;
}

.hud-subinfo {
    display: flex;
    gap: 12px;
    align-items: center;
}

.badge {
    background: rgba(44, 62, 80, 0.8);
    color: #ecf0f1;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/*
 * Der Raum steht direkt neben der Region und ist ihr optisch untergeordnet:
 * die Region sagt WO im Spiel, der Raum sagt WO GENAU. Gleiches Gewicht für
 * beide würde die Orientierung eher erschweren als erleichtern.
 */
.badge-room {
    background: rgba(44, 62, 80, 0.5);
    color: #b8c6d1;
    font-weight: 500;
}

.currency-counter {
    font-weight: 700;
    color: #ffd700;
    font-size: 0.9rem;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.scratch-level-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: #a29bfe;
}

.hud-top-right {
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.btn-icon {
    background: rgba(20, 15, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.3rem;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(138, 43, 226, 0.6);
    transform: scale(1.05);
}

/* METROIDVANIA MAP STYLES */
.map-box {
    max-width: 800px;
}

.map-grid-container {
    background: rgba(10, 8, 20, 0.9);
    border: 2px solid rgba(138, 43, 226, 0.4);
    border-radius: 14px;
    padding: 24px;
    margin: 10px 0;
}

.map-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.map-room {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.room-icon {
    font-size: 1.8rem;
}

.room-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #aaa;
}

.active-room {
    background: rgba(138, 43, 226, 0.25) !important;
    border: 2px solid #a29bfe !important;
    box-shadow: 0 0 20px rgba(162, 155, 254, 0.6) !important;
    transform: scale(1.05);
}

.active-room .room-label {
    color: #ffd700 !important;
}

.map-legend {
    font-size: 0.85rem;
    color: #bbb;
}

/* --- OVERLAY SCREENS & MODALS --- */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 3, 10, 0.88);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-hidden {
    display: none !important;
    opacity: 0;
}

.menu-box, .modal-box {
    background: linear-gradient(145deg, rgba(20, 16, 35, 0.95), rgba(10, 8, 20, 0.98));
    border: 2px solid rgba(138, 43, 226, 0.4);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(138, 43, 226, 0.2);
    border-radius: 20px;
    padding: 40px 50px;
    width: 90%;
    max-width: 650px;
    /* A modal must never grow past the window. Anything longer scrolls
       INSIDE the box, so the close button always stays reachable. */
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Content-heavy modals go wide instead of tall. Stacked in one 650 px column
   the controls sheet ran well past 1400 px and scrolled off a normal screen. */
.wide-box {
    max-width: 1180px;
    padding: 34px 40px;
}

.modal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 34px;
    align-items: start;
    text-align: left;
}

.modal-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.modal-col .tg-heading:first-child { margin-top: 0; }

/* Live map beside the chapter list rather than above it. */
.map-columns {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 20px;
    align-items: start;
}

.map-columns .map-grid {
    grid-template-columns: 1fr;
    gap: 10px;
}

.map-columns .map-room { padding: 10px 14px; }
.map-columns .room-icon { font-size: 1.3rem; }

@media (max-width: 1000px) {
    .modal-columns,
    .map-columns { grid-template-columns: 1fr; }
    .wide-box { max-width: 720px; }
    .map-columns .map-grid { grid-template-columns: repeat(3, 1fr); }
}

.game-title {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 6px;
    background: linear-gradient(180deg, #ffffff, #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(162, 155, 254, 0.5);
}

.game-subtitle {
    font-size: 1.4rem;
    color: #e0dcfd;
    letter-spacing: 3px;
    margin-top: -15px;
}

.game-tagline {
    font-size: 0.95rem;
    color: #888;
    font-style: italic;
}

.menu-buttons, .modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.vertical-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* BUTTON STYLES */
button {
    font-size: 1.05rem;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #6c5ce7, #8e44ad);
    color: #fff;
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7d6df8, #9b59b6);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #dcdde1;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    transform: translateY(-2px);
}

/* PROGRESSION OVERVIEW PANEL */
.progression-card {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 14px;
    padding: 18px 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    margin-top: 10px;
}

.progression-card h3 {
    font-size: 1.05rem;
    color: #ffd700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.prog-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
}

.prog-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
}

.stat-label {
    color: #aaa;
}

.stat-val {
    font-weight: 700;
    color: #a29bfe;
}

.version-tag {
    font-size: 0.75rem;
    color: #555;
    margin-top: 10px;
}

/* SHOP & UPGRADE MODAL */
.shop-box {
    max-width: 750px;
}

.upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 5px;
}

.upgrade-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 18px;
    text-align: left;
    transition: all 0.2s;
}

.upgrade-card:hover {
    background: rgba(138, 43, 226, 0.15);
    border-color: rgba(138, 43, 226, 0.4);
}

.upg-icon {
    font-size: 2rem;
}

.upg-info {
    flex-grow: 1;
}

.upg-info h4 {
    font-size: 1.05rem;
    color: #fff;
}

.upg-info p {
    font-size: 0.82rem;
    color: #aaa;
    margin: 2px 0 6px 0;
}

.upg-cost {
    font-size: 0.8rem;
    color: #ffd700;
    font-weight: 600;
}

.btn-buy {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-buy:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

/* INSTRUCTIONS GRID */
.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    padding: 8px 14px;
    border-radius: 8px;
}

.key-badge {
    background: rgba(138, 43, 226, 0.3);
    border: 1px solid rgba(138, 43, 226, 0.5);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
}

.ctrl-desc {
    font-size: 0.9rem;
    color: #ddd;
}

/* SETTINGS GROUP */
.settings-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    padding: 14px 20px;
    border-radius: 10px;
}

.settings-group label {
    font-size: 1rem;
    font-weight: 600;
}

.settings-group input[type="range"] {
    width: 180px;
    accent-color: #8e44ad;
}

/* GAME OVER BOX */
.gameover-box {
    border-color: rgba(231, 76, 60, 0.5);
}

.death-title {
    font-size: 3rem;
    color: #e74c3c;
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
}

/* CONTROLLER UI FOCUS STYLING */
.gp-focus {
    outline: 3px solid #00d2d3 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 20px #00d2d3 !important;
    transform: scale(1.04) !important;
}

/* ======================================================================
 * TOUCH SETTINGS (settings modal) — only shown on a touch device
 * ==================================================================== */
.settings-block {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 14px;
    margin-top: 6px;
    text-align: left;
}

.settings-heading {
    font-size: 1.0rem;
    letter-spacing: 2px;
    color: #7fe9e6;
    text-transform: uppercase;
    margin: 0 0 6px;
}

.settings-note {
    margin: 0 0 12px;
    font-size: 0.8rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.62);
}

.settings-note strong { color: #a8ffd0; }

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.settings-row label { margin: 0; }

.settings-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: #a29bfe;
}

.settings-row select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 0.85rem;
}
