:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --accent: #38bdf8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    height: 100dvh;
    /* Mobile viewport fix */
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    /* Mobile viewport fix */
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-dark);
    padding-top: 0;
    /* Override global style */
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    /* Smaller padding */
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    /* Never shrink header */
}

/* ... existing styles ... */

.home-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: bold;
}

.status-toggles {
    display: flex;
    gap: 0.5rem;
}

.status-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 36px;
    /* Slightly smaller */
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    border-color: var(--accent);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Life Section */
.life-section {
    flex: 0 1 auto;
    /* Allow shrinking */
    min-height: 25%;
    /* Reduced from fixed 45% */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0.5rem 0;
}

.life-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 1rem;
    flex: 1;
}

.life-tap {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    font-size: 2.5rem;
    width: 20%;
    height: 80%;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.life-tap:active {
    background: rgba(255, 255, 255, 0.1);
}

.life-display {
    font-size: 6rem;
    /* Dynamic sizing might be better but 6rem is safer than 8 */
    font-weight: 900;
    font-family: 'Roboto Mono', monospace;
    line-height: 1;
    text-align: center;
    flex-grow: 1;
    cursor: pointer;
    /* Indicate clickable */
}

.life-display.danger {
    color: var(--danger);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.life-display.poisoned,
.poisoned {
    color: #4ade80;
    /* Bright Green */
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

/* Quick Counters */
.quick-counters {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.counter-pill {
    background: var(--bg-panel);
    border-radius: 20px;
    padding: 0.4rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ... labels/values ... */
.label {
    text-transform: uppercase;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: bold;
    letter-spacing: 1px;
}

.value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.2rem;
    min-width: 1.5rem;
    text-align: center;
}

.mini-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Tabs */
.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--bg-panel);
    margin: 0;
    /* Remove margin */
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Tab Content */
.tab-content {
    display: none;
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    /* Scrollable area */
    background: rgba(0, 0, 0, 0.1);
}

/* ... rest ... */

.tab-content.active {
    display: block;
}

/* Counters Grid */
.counters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-bottom: 2rem;
    /* Adding padding for bottom of scroll */
}

.counter-card {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.counter-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.counter-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Opponents List */
.opponents-list {
    padding-bottom: 2rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 300;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #2a2a2a;
    padding: 1.5rem;
    border-radius: 16px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.life-input-row {
    margin: 1.5rem 0;
}

#manual-life-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--accent);
    color: white;
    font-size: 3rem;
    font-family: 'Roboto Mono', monospace;
    width: 100%;
    text-align: center;
    outline: none;
}

.life-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.btn-life-action {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    flex: 1;
}

.btn-life-action:active {
    background: var(--accent);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}

/* Rest of existing styles... */
.add-opponent-row {

    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#new-opp-name {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
}

#new-opp-color {
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
}

.action-btn {
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    padding: 0 1rem;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.opponent-row {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 5px solid transparent;
    /* Colored border */
}

.opp-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.opp-damage-ctrl {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.damage-val {
    font-size: 1.5rem;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.damage-val.danger {
    color: var(--danger);
}

.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-left: 0.5rem;
    cursor: pointer;
}



/* Help Modal Specifics */
.help-modal-content {
    text-align: left;
    max-width: 400px;
}

.help-modal-content h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--accent);
}

.help-scroll-area {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1.5rem;
}

.help-section {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
}

.help-section:last-child {
    border-bottom: none;
}

.help-section h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: white;
}

.help-section ul {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-muted);
}

.help-section p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.4;
}

.help-modal-content .btn-close-modal {
    width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
}

.help-modal-content .btn-close-modal:active {
    background: var(--accent);
}