/* ============================================
   GLHF Game - Sand Heroes v2
   ============================================ */

.game-page--heroes {
    --game-accent: #ff9800;
    --game-accent-rgb: 255, 152, 0;
}

/* --- Hero Card --- */
.heroes-card {
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-xl);
    padding: 1.75rem 2rem;
    position: relative;
    overflow: hidden;
}
.heroes-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--game-accent), transparent);
}

/* --- Sand Heroes Widget (mirrors cabinet) --- */
.sand-heroes-body {
    display: flex;
    gap: 1rem;
}
.sand-heroes-left {
    flex: 0 0 150px;
    text-align: center;
}
.sand-hero-name-level {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 0.1rem;
}
.sand-hero-name-level .sand-hero-name {
    color: #fff;
}
.sand-hero-health-wrap {
    margin-bottom: 4px;
    width: 150px;
}
.sand-hero-health-bar {
    height: 20px;
    background: var(--glhf-bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--glhf-border);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sand-hero-health-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, #c0392b 0%, #d35400 25%, #f1c40f 50%, #27ae60 100%);
    border-radius: 0;
    transition: width 0.5s ease;
}
.sand-hero-health-center {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 2px rgba(0,0,0,0.8), 0 1px 2px rgba(0,0,0,0.8);
}
.sand-hero-image {
    width: 150px;
    height: 330px;
    border-radius: var(--glhf-radius-md);
    overflow: hidden;
    border: 1px solid var(--glhf-border);
    background: var(--glhf-bg-tertiary);
}
.sand-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sand-heroes-right {
    flex: 1;
    min-width: 0;
}
.sand-hero-stats-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin: 0 0 1rem 0;
    font-size: 0.95rem;
    align-items: baseline;
    max-width: 220px;
}
.sand-hero-stats-list dt {
    margin: 0;
    font-weight: 600;
    color: var(--glhf-text-secondary);
    white-space: nowrap;
}
.sand-hero-stats-list dd {
    margin: 0;
    text-align: left;
}
.sand-hero-battle-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.sand-hero-battle-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.sand-hero-battle-label {
    color: var(--glhf-text-muted);
}
.sand-hero-battle-value {
    color: var(--glhf-text-primary);
}
.result-win { color: var(--glhf-success) !important; }
.result-loss { color: var(--glhf-danger) !important; }
/* --- Lobby Layout (two columns) --- */
.heroes-lobby-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}
.heroes-lobby-left {
    flex: 1;
    min-width: 0;
}
.heroes-lobby-right {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* --- Action Buttons --- */
.heroes-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.heroes-action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.25rem;
    font-family: var(--glhf-font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: var(--glhf-radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    border: 1px solid;
}
.heroes-action-btn-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}
.heroes-action-btn--fight {
    border-color: var(--game-accent);
    background: rgba(var(--game-accent-rgb), 0.1);
    color: var(--game-accent);
}
.heroes-action-btn--fight:hover:not(:disabled) {
    background: var(--game-accent);
    color: var(--glhf-bg-primary);
    box-shadow: 0 0 25px rgba(var(--game-accent-rgb), 0.3);
}
.heroes-action-btn--fight:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.heroes-action-btn--rating {
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.05);
    color: #ffd700;
}
.heroes-action-btn--rating:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: #ffd700;
}
.heroes-action-btn--help {
    border-color: var(--glhf-border);
    background: var(--glhf-bg-tertiary);
    color: var(--glhf-text-secondary);
}
.heroes-action-btn--help:hover {
    border-color: var(--glhf-text-muted);
    color: var(--glhf-text-primary);
}

/* --- Info Bar --- */
.heroes-lobby-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glhf-border);
    font-size: 0.85rem;
    color: var(--glhf-text-muted);
    text-align: center;
}
.heroes-warning {
    color: var(--glhf-danger);
    font-size: 0.85rem;
    text-align: center;
    padding: 0.5rem 1rem;
    background: rgba(239,68,68,0.1);
    border-radius: var(--glhf-radius-md);
    margin-top: 0.75rem;
}

/* --- Help Modal --- */
.heroes-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.heroes-help-modal {
    background: var(--glhf-bg-card, #1a1a2e);
    border: 1px solid var(--glhf-border, #333);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}
.heroes-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--glhf-border, #333);
    font-weight: 700;
    font-size: 1rem;
}
.heroes-help-close {
    background: none;
    border: none;
    color: var(--glhf-text-muted, #888);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
}
.heroes-help-close:hover { color: var(--glhf-text-primary, #fff); }
.heroes-help-body {
    padding: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--glhf-text-secondary, #ccc);
}
.heroes-help-body p { margin: 0.5rem 0; }
.heroes-help-body ul { margin: 0.25rem 0 0.75rem 1.5rem; padding: 0; }
.heroes-help-body li { margin-bottom: 0.25rem; }
.heroes-help-body strong { color: var(--glhf-text-primary, #fff); }

/* --- Rating Modal --- */
.heroes-rating-body { padding: 1rem 1.25rem; }
.heroes-rating-section { margin-bottom: 1.25rem; }
.heroes-rating-section:last-child { margin-bottom: 0; }
.heroes-rating-section-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--glhf-border, #333);
    color: var(--glhf-text-primary, #fff);
}
.heroes-rating-row {
    display: grid;
    grid-template-columns: 2rem 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.heroes-rating-medal { text-align: center; font-size: 1.1rem; }
.heroes-rating-name { font-weight: 600; color: var(--glhf-text-primary, #fff); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heroes-rating-stat { font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.heroes-rating-detail { font-size: 0.78rem; color: var(--glhf-text-muted, #888); white-space: nowrap; }

/* --- Buttons --- */
.heroes-btn {
    font-family: var(--glhf-font-heading);
    font-weight: 700; font-size: 0.9rem;
    padding: 0.6rem 1.5rem;
    border-radius: var(--glhf-radius-md);
    cursor: pointer; border: 1px solid;
    transition: all 0.2s ease;
}
.heroes-btn--heal {
    border-color: #22c55e;
    background: rgba(34,197,94,0.1);
    color: #22c55e;
}
.heroes-btn--heal:hover { background: #22c55e; color: var(--glhf-bg-primary); }
.heroes-btn--cancel {
    border-color: var(--glhf-danger);
    background: rgba(239,68,68,0.1);
    color: var(--glhf-danger);
    margin-top: 1rem;
}
.heroes-btn--cancel:hover { background: var(--glhf-danger); color: white; }

/* --- Search Screen --- */
.heroes-search-box {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-xl);
}
.heroes-search-spinner {
    width: 50px; height: 50px;
    border: 3px solid var(--glhf-border);
    border-top-color: var(--game-accent);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.heroes-search-text {
    font-family: var(--glhf-font-heading);
    font-weight: 700; font-size: 1.2rem;
    color: var(--glhf-text-primary);
    margin-bottom: 0.5rem;
}
.heroes-search-timer {
    font-size: 0.9rem; color: var(--glhf-text-muted);
}

/* --- Battle Screen --- */
.heroes-battle-header {
    display: flex; align-items: center; justify-content: center; gap: 1.5rem;
    padding: 1.5rem;
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-lg);
    margin-bottom: 1rem;
}
.heroes-fighter { text-align: center; flex: 1; }
.heroes-fighter-name {
    font-family: var(--glhf-font-heading); font-weight: 700;
    font-size: 0.95rem; color: var(--glhf-text-primary);
    margin-bottom: 0.5rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.heroes-fighter-hp { display: flex; align-items: center; gap: 0.5rem; }
.heroes-fighter-hp-bar {
    flex: 1; height: 14px;
    background: rgba(239,68,68,0.15);
    border-radius: var(--glhf-radius-full);
    overflow: hidden;
}
.heroes-fighter-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #22c55e);
    border-radius: var(--glhf-radius-full);
    transition: width 0.4s ease;
}
.heroes-fighter-hp span {
    font-family: var(--glhf-font-heading); font-weight: 600;
    font-size: 0.8rem; color: var(--glhf-text-muted);
    white-space: nowrap;
}
.heroes-battle-vs {
    font-family: var(--glhf-font-heading); font-weight: 900;
    font-size: 1.5rem; color: var(--game-accent);
    text-shadow: 0 0 20px rgba(var(--game-accent-rgb),0.4);
    letter-spacing: 3px;
    flex-shrink: 0;
}

/* --- Turn Controls --- */
.heroes-turn-controls {
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.heroes-turn-label {
    font-family: var(--glhf-font-heading); font-weight: 700;
    font-size: 0.9rem; color: var(--glhf-text-primary);
    margin-bottom: 1rem;
    text-align: center;
}
.heroes-turn-timer {
    color: var(--game-accent); margin-left: 0.5rem;
}
.heroes-turn-selects {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
    margin-bottom: 1rem;
}
.heroes-select-group label {
    font-size: 0.8rem; font-weight: 600;
    color: var(--glhf-text-muted); display: block;
    margin-bottom: 0.5rem;
}
.heroes-zone-btns, .heroes-block-btns {
    display: flex; flex-direction: column; gap: 0.4rem;
}
.heroes-zone-btn, .heroes-block-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-md);
    background: var(--glhf-bg-tertiary);
    color: var(--glhf-text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}
.heroes-zone-btn:hover, .heroes-block-btn:hover {
    border-color: var(--game-accent);
    color: var(--glhf-text-primary);
}
.heroes-zone-btn.active {
    border-color: var(--game-accent);
    background: rgba(var(--game-accent-rgb),0.15);
    color: var(--game-accent);
    font-weight: 600;
}
.heroes-block-btn.active {
    border-color: #3b82f6;
    background: rgba(59,130,246,0.15);
    color: #3b82f6;
    font-weight: 600;
}
.heroes-confirm-btn { width: 100%; }
.heroes-confirm-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.heroes-waiting-opponent {
    text-align: center; padding: 0.75rem;
    font-size: 0.9rem; color: var(--glhf-text-muted);
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Battle Log --- */
.heroes-battle-log {
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-lg);
    overflow: hidden;
}
.heroes-battle-log-header {
    padding: 0.75rem 1.25rem;
    font-family: var(--glhf-font-heading); font-weight: 700;
    font-size: 0.85rem; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--glhf-text-primary);
    background: var(--glhf-bg-tertiary);
    border-bottom: 1px solid var(--glhf-border);
}
.heroes-battle-log-content {
    padding: 0.75rem 1.25rem;
    max-height: 300px; overflow-y: auto;
}
.heroes-log-entry {
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 0.85rem;
    animation: logFade 0.3s ease;
}
@keyframes logFade {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}
.heroes-log-round-header {
    font-family: var(--glhf-font-heading); font-weight: 700;
    font-size: 0.8rem; color: var(--game-accent);
    padding: 0.5rem 0 0.2rem;
}
.heroes-log-blocked { color: #3b82f6; }
.heroes-log-dodged { color: var(--glhf-text-muted); font-style: italic; }
.heroes-log-crit { color: var(--glhf-funcoin); font-weight: 700; }
.heroes-log-normal { color: var(--glhf-text-secondary); }
.heroes-log-crit-blocked { color: #a855f7; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .heroes-lobby-layout { flex-direction: column; gap: 1.25rem; }
    .heroes-lobby-right { flex: none; width: 100%; }
    .heroes-action-buttons { flex-direction: row; flex-wrap: wrap; }
    .heroes-action-btn { flex: 1; min-width: 140px; padding: 0.75rem 1rem; font-size: 0.85rem; }
    .sand-heroes-left { flex: 0 0 100px; }
    .sand-hero-image { width: 100px; height: 220px; }
    .sand-hero-health-wrap { width: 100px; }
    .sand-hero-name-level { font-size: 12px; }
    .sand-hero-health-center { font-size: 11px; }
    .sand-hero-health-bar { height: 16px; }
    .sand-heroes-body { gap: 0.75rem; }
    .sand-hero-stats-list { font-size: 0.8rem; gap: 0.15rem 0.5rem; margin-bottom: 0.5rem; max-width: 100%; }
    .sand-hero-stats-list dt { white-space: normal; }
    .sand-hero-battle-stats { gap: 0.3rem 0.5rem; }
    .sand-hero-battle-row { font-size: 0.78rem; }
    .heroes-turn-selects { grid-template-columns: 1fr; }
    .heroes-battle-header { flex-direction: column; gap: 0.5rem; }
    .heroes-card { padding: 1.25rem 1rem; }
}
