/*
 * Coding Ireland proprietary interactive activity
 * Copyright (c) 2017-2026 Coding Ireland. All rights reserved.
 *
 * Part of the Coding Ireland online learning platform. Licensed for use only
 * as delivered on the platform. Copying, redistributing, or adapting this
 * file, in whole or in part, for use in any other product or service is not
 * permitted. Ref: CI-maths-phone-battery
 */
/*
 * phone-battery — slider + phone visual showing the same value as
 * percentage, fraction, decimal, and words. Teaches fraction-decimal-
 * percentage equivalence.
 */

.maths-activity .pb-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 1.5rem;
    align-items: start;
}

.maths-activity .pb-phone-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.maths-activity .pb-phone {
    width: 220px;
    height: 420px;
    background: #1c1e24;
    border-radius: 32px;
    padding: 14px 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25), inset 0 0 0 2px #2d3140;
    position: relative;
}

.maths-activity .pb-phone-notch {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 18px;
    background: #0e1016;
    border-radius: 12px;
    z-index: 2;
}

.maths-activity .pb-phone-screen {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #e8f4ff 0%, #f4f9ff 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.maths-activity .pb-battery-frame {
    width: 120px;
    height: 240px;
    border: 4px solid #333a45;
    border-radius: 16px;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.maths-activity .pb-battery-cap {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 10px;
    background: #333a45;
    border-radius: 4px 4px 0 0;
}

.maths-activity .pb-battery-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, #4caf50 0%, #2e7d32 100%);
    transition: height 120ms ease-out, background 220ms ease-out;
}

.maths-activity .pb-battery-fill.low {
    background: linear-gradient(180deg, #ffa726 0%, #ef6c00 100%);
}

.maths-activity .pb-battery-fill.critical {
    background: linear-gradient(180deg, #ef5350 0%, #c62828 100%);
}

.maths-activity .pb-battery-readout {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    font-weight: 800;
    color: #1b2735;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
    z-index: 1;
}

.maths-activity .pb-slider-wrap {
    width: 100%;
    max-width: 320px;
}

.maths-activity .pb-slider {
    width: 100%;
    height: 8px;
    accent-color: var(--maths-primary, #2E7D32);
    cursor: pointer;
}

.maths-activity .pb-slider-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--maths-text-muted, #6b7280);
    font-weight: 600;
}

.maths-activity .pb-readouts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
    align-content: start;
}

.maths-activity .pb-readout {
    background: #fff;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 14px;
    padding: 1rem 1.125rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: 0 2px 8px rgba(20, 40, 80, 0.04);
}

.maths-activity .pb-readout-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--maths-text-muted, #6b7280);
}

.maths-activity .pb-readout-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--maths-primary-dark, #1b5e20);
    line-height: 1.1;
}

.maths-activity .pb-readout-value sup,
.maths-activity .pb-readout-value sub {
    font-size: 0.6em;
    font-weight: 700;
}

.maths-activity .pb-readout-value sup { vertical-align: 0.6em; }
.maths-activity .pb-readout-value sub { vertical-align: -0.35em; }

.maths-activity .pb-readout-words .pb-readout-value {
    font-size: 1.3rem;
    font-style: italic;
    color: var(--maths-text, #1f2937);
}

.maths-activity .pb-target-label {
    font-weight: 800;
    color: #8d4e0b;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.maths-activity .pb-target-prompt {
    flex: 1;
    font-weight: 700;
    color: #1f2937;
}

.maths-activity .pb-mode-chip {
    display: inline-block;
    background: var(--maths-primary-soft, #e8f5e9);
    color: var(--maths-primary-dark, #1b5e20);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 0.5rem;
}


.maths-activity .pb-your-turn {
    margin-top: 1rem;
    background: #f3f7fb;
    border: 1px dashed var(--maths-border, #bac6d4);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.maths-activity .pb-your-turn-label {
    font-weight: 800;
    color: var(--maths-primary-dark, #1b5e20);
    margin-bottom: 0.5rem;
}

.maths-activity .pb-your-turn-list {
    margin: 0;
    padding-left: 1.25rem;
}

@media (max-width: 720px) {
    .maths-activity .pb-layout {
        grid-template-columns: 1fr;
    }
    .maths-activity .pb-readouts {
        grid-template-columns: repeat(2, 1fr);
    }
}

/*
 * Display mode — read-only content primitive. Phone visual on the left,
 * the four readouts (percentage / fraction / decimal / words) on the
 * right as a 2×2 grid of cards. The slider, target panel and result
 * callout are all out of scope; the visual + readouts are the whole
 * explanation. Your-turn prompts stay — those are display-only
 * discussion prompts, not interactive scoring.
 */
body.display-mode .pb-slider-wrap,
body.display-mode .pb-target-panel,
body.display-mode .pb-callout,
body.display-mode #challengeRunner {
    display: none !important;
}

body.display-mode .pb-layout {
    grid-template-columns: minmax(220px, 260px) 1fr;
    gap: 1.25rem;
    align-items: center;
}

body.display-mode .pb-phone {
    width: 200px;
    height: 340px;
    padding: 12px 10px;
}

body.display-mode .pb-battery-frame {
    width: 110px;
    height: 200px;
}

body.display-mode .pb-battery-readout {
    font-size: 1.4rem;
}

body.display-mode .pb-readout {
    padding: 0.7rem 0.9rem;
}

body.display-mode .pb-readout-value {
    font-size: 1.5rem;
}

body.display-mode .pb-readout-words .pb-readout-value {
    font-size: 1.1rem;
}
