/* =========================================================
   Life Points Tracker — Duel Mode
   Phone placed flat between two players.
   Player 1 (top) is rotated 180° so the opponent can read.
   ========================================================= */

/* --- Arena container ------------------------------------- */
.lp {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
    /* In normal page mode, fill available space */
}

.lp__hero { flex-shrink: 0; }

/* --- Fullscreen mode ------------------------------------- */
.lp--fullscreen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Hide navbar, hero, footer in fullscreen */
.lp--fullscreen ~ footer,
body.lp-fullscreen .navbar,
body.lp-fullscreen .flash-container,
body.lp-fullscreen .lp__hero,
body.lp-fullscreen #cookieBanner { display: none !important; }
body.lp-fullscreen { overflow: hidden; }
body.lp-fullscreen main { padding: 0; margin: 0; }

/* --- Player halves --------------------------------------- */
.lp__half {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    position: relative;
    min-height: 0;
}

/* Player 1 is UPSIDE DOWN (rotated 180°) */
.lp__half--top {
    transform: rotate(180deg);
    background: linear-gradient(to bottom, var(--bg-primary), var(--bg-secondary));
}

.lp__half--bottom {
    background: linear-gradient(to top, var(--bg-primary), var(--bg-secondary));
}

/* Active turn glow on the side */
.lp__half--active {
    box-shadow: inset 0 0 40px rgba(232, 96, 90, .08);
}

/* --- Player name ----------------------------------------- */
.lp__name {
    font-family: var(--font-display);
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    text-align: center;
    outline: none;
    transition: border-color var(--transition), background var(--transition);
    width: 160px;
    max-width: 70%;
}

.lp__name:focus {
    border-color: var(--coral);
    background: var(--bg-card);
    color: var(--text-primary);
}

/* --- LP Display ------------------------------------------ */
.lp__lp-wrap {
    text-align: center;
    padding: 8px 0;
    flex-shrink: 0;
}

.lp__lp {
    font-family: var(--font-display);
    font-size: clamp(3rem, 12vw, 5.5rem);
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    display: inline-block;
    transition: color .3s ease, transform .15s ease;
    user-select: none;
    letter-spacing: .02em;
}

.lp__lp--down {
    color: var(--coral) !important;
    transform: scale(1.08);
}

.lp__lp--up {
    color: #4ecb71 !important;
    transform: scale(1.08);
}

.lp__lp--zero {
    color: var(--text-muted) !important;
}

/* --- Delta buttons --------------------------------------- */
.lp__btns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 420px;
    margin-top: 6px;
}

.lp__btn {
    font-family: var(--font-display);
    font-size: .72rem;
    font-weight: 700;
    padding: 10px 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s, transform .1s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.lp__btn--minus {
    background: rgba(232, 96, 90, .1);
    color: var(--coral-light);
    border-color: rgba(232, 96, 90, .2);
}
.lp__btn--minus:active {
    background: rgba(232, 96, 90, .3);
    transform: scale(.93);
}

.lp__btn--plus {
    background: rgba(78, 203, 113, .1);
    color: #4ecb71;
    border-color: rgba(78, 203, 113, .2);
}
.lp__btn--plus:active {
    background: rgba(78, 203, 113, .3);
    transform: scale(.93);
}

/* --- Manual input row ------------------------------------ */
.lp__manual {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    width: 100%;
    max-width: 260px;
}

.lp__manual-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: .85rem;
    padding: 7px 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition);
    -moz-appearance: textfield;
    min-width: 0;
}
.lp__manual-input::-webkit-inner-spin-button,
.lp__manual-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.lp__manual-input:focus { border-color: var(--coral); }

.lp__manual-action {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 800;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.lp__manual-action--minus {
    background: rgba(232, 96, 90, .12);
    color: var(--coral-light);
    border-color: rgba(232, 96, 90, .25);
}
.lp__manual-action--minus:active {
    background: rgba(232, 96, 90, .3);
    transform: scale(.9);
}
.lp__manual-action--plus {
    background: rgba(78, 203, 113, .12);
    color: #4ecb71;
    border-color: rgba(78, 203, 113, .25);
}
.lp__manual-action--plus:active {
    background: rgba(78, 203, 113, .3);
    transform: scale(.9);
}

/* --- Center bar ------------------------------------------ */
.lp__center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.lp__center-row {
    display: flex;
    gap: 6px;
}

/* Small control buttons */
.lp__ctrl {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s;
    -webkit-tap-highlight-color: transparent;
}
.lp__ctrl:active:not(:disabled) { background: var(--bg-elevated); transform: scale(.9); }
.lp__ctrl:disabled { opacity: .3; cursor: default; }
.lp__ctrl--active { color: var(--coral); border-color: rgba(232,96,90,.3); }

/* --- Timer ----------------------------------------------- */
.lp__timer-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lp__timer {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: .05em;
    min-width: 52px;
    text-align: center;
}

.lp__timer-toggle {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: all .15s;
    -webkit-tap-highlight-color: transparent;
}
.lp__timer-toggle:active { transform: scale(.85); }
.lp__timer-toggle--running { color: var(--coral); border-color: rgba(232,96,90,.4); }

/* --- Turn button (center) -------------------------------- */
.lp__turn-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--coral);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    position: relative;
    box-shadow: 0 0 16px rgba(232, 96, 90, .3);
    -webkit-tap-highlight-color: transparent;
}
.lp__turn-btn:active { transform: scale(.9); }

.lp__turn-label {
    font-family: var(--font-display);
    font-size: .7rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.lp__turn-arrow {
    font-size: .65rem;
    color: rgba(255,255,255,.7);
    line-height: 1;
}

.lp__turn-arrow--up  { margin-bottom: -1px; }
.lp__turn-arrow--down { margin-top: -1px; }

/* Highlight which arrow points to active player */
.lp__turn-arrow--active { color: #fff; }

/* --- Log Drawer ------------------------------------------ */
.lp__drawer {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.lp__drawer--open { opacity: 1; pointer-events: auto; }

.lp__drawer-inner {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 60vh;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
}
.lp__drawer--open .lp__drawer-inner { transform: translateY(0); }

.lp__drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    font-family: var(--font-display);
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.lp__drawer-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: inherit;
}
.lp__drawer-actions { display: flex; gap: 6px; }

/* --- Log list -------------------------------------------- */
.lp__log-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.lp__log-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: .8rem;
    color: var(--text-secondary);
    animation: lpLogIn .2s ease;
}
.lp__log-item:last-child { border-bottom: none; }

@keyframes lpLogIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lp__log-player { font-weight: 600; color: var(--text-primary); min-width: 60px; }
.lp__log-delta--minus { color: var(--coral-light); font-weight: 600; }
.lp__log-delta--plus  { color: #4ecb71; font-weight: 600; }
.lp__log-delta--set   { color: var(--coral); font-weight: 600; }
.lp__log-turn { margin-left: auto; font-size: .7rem; color: var(--text-muted); white-space: nowrap; }

.lp__log-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-size: .85rem;
}

/* --- Reset Modal ----------------------------------------- */
.lp__modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.lp__modal-overlay--active { opacity: 1; pointer-events: auto; }

.lp__modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    max-width: 340px;
    width: 88%;
    text-align: center;
    transform: scale(.92);
    transition: transform .25s;
}
.lp__modal-overlay--active .lp__modal { transform: scale(1); }

.lp__modal-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.lp__modal-text {
    font-size: .85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.lp__modal-actions { display: flex; gap: 10px; justify-content: center; }

/* =========================================================
   Responsive
   ========================================================= */

/* Desktop: keep reasonable max-width, center */
@media (min-width: 769px) {
    .lp {
        max-width: 480px;
        margin: 0 auto;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        min-height: calc(100vh - 80px);
    }
    .lp--fullscreen {
        max-width: 100%;
        border: none;
    }
    .lp__lp { font-size: 5rem; }
    .lp__btn { padding: 12px 4px; font-size: .8rem; }
}

/* Small phones */
@media (max-width: 380px) {
    .lp__btns { grid-template-columns: repeat(4, 1fr); }
    .lp__lp { font-size: 2.6rem; }
    .lp__center { gap: 6px; padding: 6px 8px; }
    .lp__ctrl { width: 32px; height: 32px; font-size: .75rem; }
    .lp__turn-btn { width: 44px; height: 44px; }
    .lp__timer { font-size: .85rem; }
}
