/* Owner: package P8 (Classroom and exam (window, canvas banner, rules board), World Clocks, Calculator, App Store). Clockface Online rebrand overrides, linked last in the index.php head.
   Loads after style.css and cfo.css. Tokens only; every class here is scoped to a P8 surface or prefixed
   cfo-exam-, cfo-board-, cfo-cr- (Classroom), cfo-wc- (World Clocks), cfo-calc-, cfo-store- or cfo-p8-. */

/* =====================================================================
   SHARED: window header tile, empty states, danger ghost button
   ===================================================================== */

/* 32px tool tile in a window header: the tool colour at --tile-tint behind an ink icon (cfo-tool-icon draws the tint). */
.cfo-p8-wicon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
}
.cfo-p8-wicon i, .cfo-p8-wicon svg { font-size: 15px; }

.cfo-p8-empty {
    text-align: center;
    padding: var(--space-8) var(--space-3);
    color: var(--text-secondary);
}
.cfo-p8-empty > i, .cfo-p8-empty > svg {
    display: block;
    margin: 0 auto var(--space-3);
    font-size: 28px;
    color: var(--text-tertiary);
}
.cfo-p8-empty p { margin: 0; font-size: 13px; line-height: 20px; }

.cfo-btn.cfo-p8-danger-ghost { color: var(--danger); }
.cfo-btn.cfo-p8-danger-ghost:hover { background: var(--danger-tint); }

/* Window headers: titles never push the actions off a phone screen. */
.cfo-classroom .window-header > div:first-child,
.cfo-worldclocks .window-header > div:first-child,
.cfo-calculator .window-header > div:first-child,
.cfo-appstore .window-header > div:first-child { min-width: 0; }
.cfo-classroom .window-header > div:first-child > span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cfo-classroom .window-header > div:nth-child(2) { margin: 0 4px !important; }
@media (max-width: 420px) {
    /* Phones: Bell and Share keep their icons; the title gets the room. */
    .cfo-classroom .cfo-cr-head-btn { font-size: 0; gap: 0; padding: 0 var(--space-2); }
    .cfo-classroom .cfo-cr-head-btn > i, .cfo-classroom .cfo-cr-head-btn > svg { font-size: 15px; }
    .cfo-cr-seg { font-size: 12px; }
}

/* Dark mode: native pickers inside converted windows follow the theme. */
body.dark-mode .cfo-classroom input, body.dark-mode .cfo-classroom select,
body.dark-mode .cfo-worldclocks select, body.dark-mode .cfo-appstore input { color-scheme: dark; }

/* =====================================================================
   1. EXAM AND STUDY BANNER OVER THE CLOCK (glass pill)
   ===================================================================== */
#classroomExamBanner.cfo-exam-banner {
    padding: var(--space-1);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: var(--glass);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-float);
    color: var(--on-glass);
    font-family: var(--font-sans);
}
/* Pale canvas (body.cfo-canvas-light from the chrome package): glass-dim underneath keeps white text readable. */
body.cfo-canvas-light #classroomExamBanner.cfo-exam-banner,
body.cfo-canvas-light #classroomExamRulesBanner.cfo-exam-rules-banner {
    background: linear-gradient(var(--glass), var(--glass)), var(--glass-dim);
}

.cfo-exam-banner-row {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: nowrap;
}
.cfo-exam-banner-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    min-height: 44px;
    padding: 0 var(--space-3) 0 var(--space-1);
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}
.cfo-exam-banner-info:hover { background: var(--glass); }

/* Noise level pill. Used on the banner (#bannerProtocolBadge) and the rules board (#rulesBoardNoisePill).
   The word always names the level; the tone repeats it. Never white on a warning or primary fill. */
.cfo-exam-protocol {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    height: 32px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-pill);
    font-size: 13px;
    line-height: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.cfo-exam-protocol.is-silence {
    background: linear-gradient(var(--danger-tint), var(--danger-tint)), var(--surface);
    color: var(--danger);
    box-shadow: inset 0 0 0 1px var(--danger-line);
}
.cfo-exam-protocol.is-quiet { background: var(--warning); color: var(--on-primary); }
.cfo-exam-protocol.is-collab { background: var(--primary); color: var(--on-primary); }

.cfo-exam-centre {
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: var(--glass);
    color: var(--on-glass);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.cfo-exam-banner-title {
    min-width: 0;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--on-glass);
    font-size: 17px;
    line-height: 24px;
    font-weight: 700;
}
.cfo-exam-banner-divider {
    flex-shrink: 0;
    width: 1px;
    height: 20px;
    background: var(--glass-border);
}
.cfo-exam-banner-time {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    color: var(--on-glass);
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.cfo-exam-banner-time > i, .cfo-exam-banner-time > svg { font-size: 15px; }
.cfo-exam-banner-remaining { font-weight: 700; }

.cfo-exam-banner-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.cfo-exam-banner-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--on-glass);
    font: inherit;
    font-size: 16px;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}
.cfo-exam-banner-btn:hover { background: var(--glass); }

/* Invigilator rules strip under the banner. */
#classroomExamRulesBanner.cfo-exam-rules-banner {
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    padding: 6px var(--space-3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    background: var(--glass);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-float);
}
.cfo-exam-rules-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: var(--glass);
    color: var(--on-glass);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
}

@media (max-width: 600px) {
    #classroomExamBanner.cfo-exam-banner { border-radius: var(--radius-xl); }
    .cfo-exam-banner-info { flex-wrap: wrap; row-gap: var(--space-1); padding: var(--space-1) var(--space-2); }
    .cfo-exam-banner-title { max-width: 60vw; font-size: 15px; }
    .cfo-exam-banner-time { font-size: 14px; }
    .cfo-exam-banner-divider { display: none; }
}

/* =====================================================================
   2. FULL-SCREEN INVIGILATOR RULES BOARD (stays a dark island: tokens resolve dark inside the content)
   ===================================================================== */
#invigilatorRulesBoardModal {
    background: var(--scrim);
    -webkit-backdrop-filter: blur(25px);
    backdrop-filter: blur(25px);
}
/* Radius is not !important: the fullscreen fallback writes border-radius 0 inline and must win. */
#invigilatorRulesBoardModal .cfo-board {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    color: var(--text-primary);
    font-family: var(--font-sans);
}
.cfo-board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-shrink: 0;
    padding: var(--space-2) var(--space-3) var(--space-2) var(--space-6);
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
}
.cfo-board-header-icon { font-size: 16px; color: var(--accent-ink); }
.cfo-board-body { padding: var(--space-6) 30px; }
.cfo-board-hero { border-bottom: 1px solid var(--border); }

.cfo-board-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    line-height: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.cfo-board-centre {
    background: var(--surface-subtle);
    box-shadow: inset 0 0 0 1px var(--border-control);
    color: var(--text-primary);
}
.cfo-board-title {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Times row and section label (markup outside this package's lines): clamp weights and move colours to tokens. */
#invigilatorRulesBoardModal [style*="font-weight: 800"],
#invigilatorRulesBoardModal [style*="font-weight: 900"] { font-weight: 700 !important; }
#invigilatorRulesBoardModal .cfo-board-hero > div[style*="color: #cebfaf"] { color: var(--text-secondary) !important; }
#invigilatorRulesBoardModal [style*="color: #888"] { color: var(--text-secondary) !important; }
#invigilatorRulesBoardModal [style*="color: rgba(255,255,255,0.25)"] { color: var(--border-control) !important; }
#rulesBoardStartTime, #rulesBoardEndTime { color: var(--ink) !important; font-variant-numeric: tabular-nums; }
#rulesBoardRemainingTime { color: var(--accent-ink) !important; font-variant-numeric: tabular-nums; }
#invigilatorRulesBoardModal [style*="color: #f4e861"] { color: var(--accent-ink) !important; }
/* Rule cards drop to one column on phones instead of overflowing. */
#rulesBoardGrid { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)) !important; }

.cfo-board-rule {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    min-height: 90px;
    padding: 22px 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-subtle);
}
.cfo-board-rule-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 54px;
    height: 54px;
    min-width: 54px;
    border-radius: var(--radius-lg);
    background: var(--accent-tile);
    color: var(--accent-ink);
    font-size: 26px;
}
.cfo-board-rule-title { color: var(--ink); font-size: 19px; line-height: 1.3; font-weight: 700; }
.cfo-board-rule-desc { margin-top: 4px; color: var(--text-secondary); font-size: 14px; line-height: 1.4; }
.cfo-board-empty { padding: 50px var(--space-5); text-align: center; color: var(--text-secondary); font-size: 16px; }

@media (max-width: 600px) {
    .cfo-board-header { padding-left: var(--space-4); }
    .cfo-board-body { padding: var(--space-4); }
    .cfo-board-title { font-size: 24px; }
    .cfo-board-rule { padding: var(--space-4); gap: var(--space-3); }
}

/* =====================================================================
   3. CLASSROOM & EXAM HUB WINDOW (#classroomModal.cfo-paper)
   ===================================================================== */
.cfo-cr-tabbar {
    flex-shrink: 0;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.cfo-classroom .cfo-tabs { grid-auto-columns: minmax(0, 1fr); }
.cfo-classroom .cfo-tab { padding: 0 6px; font-size: 13px; gap: 6px; }
.cfo-classroom .classroom-tab-btn.active { background: var(--accent); color: var(--on-primary); font-weight: 600; box-shadow: var(--shadow-sm); }
@media (max-width: 420px) {
    .cfo-classroom .cfo-tab > i, .cfo-classroom .cfo-tab > svg { display: none; }
}

.cfo-cr-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text-primary);
}
.cfo-cr-well {
    border-radius: var(--radius-lg);
    background: var(--surface-subtle);
    color: var(--text-primary);
}
.cfo-classroom .cfo-overline > i, .cfo-classroom .cfo-overline > svg,
.cfo-worldclocks .cfo-overline > i, .cfo-worldclocks .cfo-overline > svg { margin-right: 4px; }
.cfo-cr-field-label { color: var(--text-secondary); font-size: 12px; line-height: 16px; font-weight: 500; }
.cfo-cr-subhead {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.cfo-cr-hint { color: var(--text-tertiary); font-size: 12px; line-height: 16px; font-weight: 400; }
.cfo-classroom .cfo-input { font-size: 14px; }
.cfo-classroom textarea.cfo-input { min-height: 88px; padding: var(--space-3); }

.cfo-cr-board-btn { font-weight: 700; }
/* Small buttons inside the converted windows read at 13px so they sit under the card labels. */
.cfo-classroom .cfo-btn-sm, .cfo-worldclocks .cfo-btn-sm, .cfo-calculator .cfo-btn-sm, .cfo-appstore .cfo-btn-sm { font-size: 13px; }

/* Header text buttons (Bell, Share). */
.cfo-cr-head-btn { padding: 0 10px; gap: 6px; font-size: 13px; }

/* Six-up duration and preset pickers, and the group-size buttons. */
.cfo-cr-seg-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-1); }
.cfo-cr-seg-grid.cfo-cr-seg-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cfo-cr-seg {
    position: relative;
    min-width: 0;
    height: 36px;
    padding: 0 var(--space-1);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    line-height: 20px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.cfo-cr-seg::after { content: ""; position: absolute; inset: -4px 0; }
.cfo-cr-seg:hover { background: var(--surface-hover); }
.cfo-cr-seg.active, .cfo-cr-seg[aria-pressed="true"] {
    background: var(--accent);
    color: var(--on-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.cfo-cr-seg-grid-4 .cfo-cr-seg { font-size: 12px; }

/* Exam status and progress. */
.cfo-cr-status-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); font-size: 12px; line-height: 16px; }
.cfo-cr-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-ink);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
}
.cfo-cr-countdown { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.cfo-cr-progress {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--border);
    overflow: hidden;
}
.cfo-cr-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width var(--dur-base) var(--ease);
}

/* Noise level choices: tone tints with matching text and an icon. */
.cfo-cr-protocol {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 44px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.cfo-cr-protocol:hover { background: var(--surface-hover); }
.cfo-cr-protocol.is-silence > i, .cfo-cr-protocol.is-silence > svg { color: var(--danger); }
.cfo-cr-protocol.is-quiet > i, .cfo-cr-protocol.is-quiet > svg { color: var(--gold-ink); }
.cfo-cr-protocol.is-collab > i, .cfo-cr-protocol.is-collab > svg { color: var(--primary-ink); }
.cfo-cr-protocol.active { font-weight: 600; }
.cfo-cr-protocol.is-silence.active { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.cfo-cr-protocol.is-quiet.active { background: var(--warning-line); border-color: var(--gold-ink); color: var(--text-primary); }
.cfo-cr-protocol.is-collab.active { background: var(--primary-tint); border-color: var(--primary-ink); color: var(--primary-ink); }
@media (max-width: 420px) {
    .cfo-cr-protocol { flex-direction: column; gap: 2px; padding: var(--space-1); font-size: 12px; }
}

/* Checkbox rows (Show on screen, No-repeat mode). */
.cfo-cr-check {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 16px;
    cursor: pointer;
    user-select: none;
}
.cfo-cr-check input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }

/* Invigilator rule chips. */
.cfo-cr-rule-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cfo-cr-rule {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 36px;
    border: 1px solid var(--border-control);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.cfo-cr-rule.is-on { background: var(--accent); border-color: var(--accent); }
.cfo-cr-rule-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.cfo-cr-rule-toggle::after { content: ""; position: absolute; inset: -4px 0; }
.cfo-cr-rule-toggle > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfo-cr-rule-toggle > i, .cfo-cr-rule-toggle > svg { flex-shrink: 0; font-size: 11px; }
.cfo-cr-rule-toggle .cfo-cr-rule-state { font-size: 10px; }
.cfo-cr-rule:not(.is-on) .cfo-cr-rule-toggle:hover { color: var(--text-primary); }
.cfo-cr-rule.is-on .cfo-cr-rule-toggle { color: var(--on-primary); font-weight: 600; }
.cfo-cr-rule-remove {
    position: relative;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 32px;
    height: 36px;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--border);
    background: transparent;
    color: var(--danger);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}
.cfo-cr-rule-remove::after { content: ""; position: absolute; inset: -4px 0; }
.cfo-cr-rule.is-on .cfo-cr-rule-remove { color: var(--on-primary); border-left-color: var(--accent-half); }

/* Study timer. */
.cfo-cr-timer {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 14px;
    text-align: center;
}
#studyStatusBadge { font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; }
.cfo-cr-status.is-running { color: var(--info); }
.cfo-cr-status.is-paused { color: var(--text-secondary); }
.cfo-cr-status.is-done { color: var(--primary-ink); }
.cfo-cr-digits {
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 44px;
    line-height: 52px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}
.cfo-cr-preset-label { color: var(--accent-ink); font-size: 12px; line-height: 16px; font-weight: 600; }
.cfo-btn.cfo-cr-play.is-running { background: var(--warning); color: var(--on-primary); }

/* Student picker. */
.cfo-cr-picked {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 95px;
    padding: 18px 14px;
    text-align: center;
}
.cfo-cr-picked-name {
    color: var(--ink);
    font-size: 24px;
    line-height: 32px;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.cfo-cr-picked-name.is-error { color: var(--danger); font-size: 16px; line-height: 24px; }
.cfo-cr-picked-name.is-done { color: var(--primary-ink); }
.cfo-cr-picked-name.is-rolling { color: var(--accent-ink); }
.cfo-cr-picked-name.is-rolling-alt { color: var(--primary-ink); }
.cfo-cr-picked-name.is-winner { color: var(--ink); }
.cfo-cr-queue-row { display: flex; justify-content: space-between; gap: var(--space-2); color: var(--text-secondary); font-size: 12px; line-height: 16px; }
.cfo-cr-queue-status { color: var(--primary-ink); font-weight: 600; }
.cfo-cr-queue-status.is-empty { color: var(--accent-ink); }
.cfo-cr-picked-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--primary-tint);
    color: var(--primary-ink);
    font-size: 11px;
    line-height: 16px;
    font-weight: 600;
}
.cfo-cr-picked-chip > i, .cfo-cr-picked-chip > svg { font-size: 10px; }
.cfo-cr-group { padding: var(--space-2) 10px; border-radius: var(--radius-md); background: var(--surface-subtle); }
.cfo-cr-group-title { margin-bottom: 2px; color: var(--accent-ink); font-size: 12px; line-height: 16px; font-weight: 600; }
.cfo-cr-group-names { color: var(--text-primary); font-size: 12px; line-height: 1.4; }
.cfo-cr-roster-title { display: block; min-width: 0; color: var(--text-primary); font-size: 13px; line-height: 20px; font-weight: 600; }
.cfo-cr-roster-title > i, .cfo-cr-roster-title > svg { margin-right: 6px; }
.cfo-cr-chevron { display: inline-grid; place-items: center; width: 20px; color: var(--text-tertiary); font-size: 12px; }

/* Bells. */
.cfo-cr-chime {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 72px;
    padding: 14px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-subtle);
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}
.cfo-cr-chime:hover { background: var(--surface-hover); }
.cfo-cr-chime > i, .cfo-cr-chime > svg { font-size: 20px; color: var(--accent-ink); }

/* Theme tiles: their colours and fonts are previews (content). Only the shape, size and hover ring are ours. */
#classroomPane-tools button[onclick^="applyClassroomPreset"] {
    min-height: 44px;
    padding: 10px 12px !important;
    border-radius: var(--radius-lg) !important;
    font-family: var(--font-sans);
    font-size: 12px !important;
    text-align: left;
    gap: var(--space-2);
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
#classroomPane-tools button[onclick^="applyClassroomPreset"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm);
}
#classroomPane-tools button[onclick^="applyClassroomPreset"] span[style*="font-size: 9px"] { font-size: 10px !important; }

/* =====================================================================
   4. WORLD CLOCKS WINDOW (#worldClocksModal.cfo-paper)
   ===================================================================== */
.cfo-wc-well { padding: var(--space-3) 14px; border-radius: var(--radius-lg); background: var(--surface-subtle); }
.cfo-wc-label { color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 600; }
#worldClockTimeSlider { accent-color: var(--accent); }
.cfo-wc-scale {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
    color: var(--text-tertiary);
    font-size: 11px;
    line-height: 16px;
    font-variant-numeric: tabular-nums;
}
.cfo-wc-scale-live { color: var(--ink); font-weight: 600; }

#worldClocksModal .world-clock-card {
    padding: var(--space-3) var(--space-1) var(--space-3) 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: background-color var(--dur-fast) var(--ease);
}
#worldClocksModal .world-clock-card:hover { background: var(--surface-subtle); border-color: var(--border); transform: none; }
.cfo-wc-flag { flex-shrink: 0; font-size: 24px; line-height: 1; }
.cfo-wc-city { color: var(--ink); font-size: 15px; line-height: 22px; font-weight: 600; }
.cfo-wc-meta { margin-top: 2px; color: var(--text-tertiary); font-size: 12px; line-height: 16px; }
.cfo-wc-time {
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 18px;
    line-height: 26px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
#worldClocksModal .world-clock-day.cfo-badge { border: 0; background: var(--gold-tint); color: var(--gold-ink); box-shadow: none; }
#worldClocksModal .world-clock-night.cfo-badge { border: 0; background: var(--info-tint); color: var(--info); box-shadow: none; }
.cfo-icon-btn.cfo-wc-remove { color: var(--text-tertiary); }
.cfo-icon-btn.cfo-wc-remove:hover { background: var(--danger-tint); color: var(--danger); }

/* =====================================================================
   5. CALCULATOR WINDOW (#calculatorModal.cfo-paper)
   ===================================================================== */
.cfo-calc-screen {
    padding: var(--space-3) 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-subtle);
}
.cfo-calc-expression {
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 16px;
    font-variant-numeric: tabular-nums;
}
.cfo-calc-display {
    color: var(--ink);
    font-family: var(--font-sans);
    line-height: 40px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

#calculatorModal .calc-btn {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    box-shadow: none;
    font-family: inherit;
    transition: background-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
#calculatorModal .calc-btn:active { transform: scale(0.97); }
#calculatorModal .calc-btn-num { background: var(--surface-subtle); border-color: transparent; color: var(--text-primary); }
#calculatorModal .calc-btn-num:hover { background: var(--surface-hover); border-color: transparent; }
#calculatorModal .calc-btn-op { background: var(--accent); border-color: transparent; color: var(--on-primary); font-size: 20px; }
#calculatorModal .calc-btn-op:hover { background: var(--accent); color: var(--on-primary); box-shadow: var(--shadow-sm); }
#calculatorModal .calc-btn-action { background: var(--danger-tint); border-color: transparent; color: var(--danger); }
#calculatorModal .calc-btn-action:hover { background: var(--danger-tint); border-color: currentColor; }
#calculatorModal .calc-btn-action > i, #calculatorModal .calc-btn-action > svg { font-size: 16px; }
#calculatorModal .calc-btn-equals { background: var(--primary); border-color: transparent; color: var(--on-primary); box-shadow: none; font-size: 22px; font-weight: 700; }
#calculatorModal .calc-btn-equals:hover { background: var(--primary); box-shadow: var(--shadow-sm); }
#calculatorModal .calc-btn-sci {
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}
#calculatorModal .calc-btn-sci:hover { background: var(--surface-hover); border-color: var(--border); color: var(--text-primary); }

#calcHistoryPanel.cfo-calc-history { background: var(--surface); color: var(--text-primary); }
.cfo-calc-history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
    color: var(--accent-ink);
}
.cfo-calc-history-title { color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 600; }
#calculatorModal .calc-history-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    width: 100%;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}
#calculatorModal .calc-history-item:hover { background: var(--surface-hover); border-color: transparent; }
.cfo-calc-history-expr { color: var(--text-tertiary); font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; }
.cfo-calc-history-result { color: var(--primary-ink); font-size: 15px; line-height: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* =====================================================================
   6. APP STORE WINDOW (#appStoreModal.cfo-paper)
   ===================================================================== */
.cfo-store-search > i, .cfo-store-search > svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 13px;
    pointer-events: none;
}
#appStoreSearchInput { padding-left: 38px; }

#appStoreCategoryTabs .app-store-filter-tab {
    height: 36px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border-control);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: none;
    font-size: 13px;
    font-weight: 500;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
#appStoreCategoryTabs .app-store-filter-tab > i, #appStoreCategoryTabs .app-store-filter-tab > svg { font-size: 12px; color: inherit; }
#appStoreCategoryTabs .app-store-filter-tab:hover { background: var(--surface-hover); color: var(--text-primary); }
#appStoreCategoryTabs .app-store-filter-tab.active,
#appStoreCategoryTabs .app-store-filter-tab[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-primary);
    font-weight: 600;
    box-shadow: none;
}

#appStoreModal .cfo-store-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-3);
    position: relative;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text-primary);
    transition: box-shadow var(--dur-fast) var(--ease);
}
#appStoreModal .cfo-store-card:hover { box-shadow: var(--shadow-sm); }
#appStoreModal .cfo-store-card.is-featured { border-color: var(--accent); }
.cfo-store-card-main { display: flex; gap: var(--space-3); align-items: flex-start; }
.cfo-store-card-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-1); }
#appStoreModal .cfo-store-card-title {
    margin: 0 0 var(--space-1);
    color: var(--ink);
    font-size: 15px;
    line-height: 22px;
    font-weight: 600;
    word-break: break-word;
}
.cfo-store-card-desc {
    margin: 0 0 var(--space-2);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cfo-store-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* Social proof (kept: a revenue surface). */
#appStoreModal .app-store-downloads-badge { background: var(--surface-subtle); border: 1px solid var(--border); }
#appStoreModal .app-store-avatar-bubble { border: 1.5px solid var(--surface); box-shadow: none; color: var(--on-primary); font-size: 10px; }
.cfo-store-proof-label { color: var(--text-secondary); font-size: 11px; line-height: 16px; font-weight: 600; }

/* Section headings. */
.cfo-store-section-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    color: var(--accent-ink);
}
.cfo-store-section-head > i, .cfo-store-section-head > svg,
.cfo-store-section-head > div > i, .cfo-store-section-head > div > svg { font-size: 13px; }
#appStoreModal h4.cfo-overline, body.dark-mode #appStoreModal h4.cfo-overline { margin: 0; color: var(--text-secondary) !important; }
.cfo-store-section-count { color: var(--text-tertiary); font-size: 11px; line-height: 16px; font-weight: 600; }

/* Sponsored card and the coming-soon note (markup outside this package's lines): paper colours only, sizes unchanged. */
#appStoreModal .ad-slot.ad-slot-appcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
#appStoreModal .ad-slot-appcard-icon { background: var(--accent-tile); border: 0; border-radius: var(--radius-md); color: var(--ink); }
#appStoreModal .ad-slot-appcard-badge {
    background: var(--surface-subtle);
    color: var(--text-secondary);
    font-size: 10px;
    border-radius: var(--radius-sm);
}
#appStoreModal .ad-slot .ad-dismiss { color: var(--text-tertiary); opacity: 1; }
#appStoreModal .ad-slot .ad-upgrade-cta,
#appStoreModal .ad-slot .ad-upgrade-cta:hover {
    background: var(--gold-tint);
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-md);
    color: var(--gold-ink);
    font-size: 11px;
}
#appStoreSections + div {
    background: var(--surface-subtle) !important;
    border: 1px dashed var(--border-control) !important;
    border-radius: var(--radius-lg) !important;
}
#appStoreSections + div span { color: var(--text-secondary) !important; }

/* =====================================================================
   Reduced motion: hover lifts and key presses stay still.
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
    #classroomPane-tools button[onclick^="applyClassroomPreset"]:hover,
    #calculatorModal .calc-btn:active { transform: none; }
    .cfo-cr-progress-fill { transition: none; }
}
