/* com_dc360mouse — "DC360 Mouse Training" front-end styling.
 *
 * Bright/rounded/playful by design (young-kids audience). Fruit/transport/
 * target items are rendered as emoji rather than image assets — crisp at
 * any size, colourful without needing art, no extra HTTP requests.
 */

.dcmouse {
    --dcmouse-primary: #6c5ce7;
    --dcmouse-primary-dark: #4834d4;
    --dcmouse-accent: #00cec9;
    --dcmouse-success: #2ecc71;
    --dcmouse-danger: #ff6b6b;
    --dcmouse-warning: #fdcb6e;
    --dcmouse-ink: #2d3436;
    --dcmouse-panel-bg: #ffffff;
    --dcmouse-page-bg: #f0f3ff;
    --dcmouse-radius: 18px;
    font-family: 'Comic Sans MS', 'Segoe UI', 'Trebuchet MS', sans-serif;
    color: var(--dcmouse-ink);
    background: linear-gradient(160deg, #f0f3ff 0%, #e6fffb 100%);
    padding: 10px 20px 20px;
    border-radius: var(--dcmouse-radius);
    max-width: 1100px;
    margin: 0 auto;
    box-sizing: border-box;
}

.dcmouse * {
    box-sizing: border-box;
}

.d-none {
    display: none !important;
}

.dcmouse-title {
    font-size: 1.7rem;
    color: var(--dcmouse-primary-dark);
    text-align: center;
    margin: 0 0 2px;
}

/* Tightened up (was 12px margin, 1.05rem) — this line and the title above
   it were taking up vertical space that pushed the Time/Best Time HUD
   rows below the fold on shorter screens. */
.dcmouse-task {
    text-align: center;
    font-size: 0.95rem;
    margin: 0 0 8px;
}

.dcmouse-guest-note {
    background: var(--dcmouse-warning);
    color: #6b4c00;
    border-radius: 999px;
    padding: 6px 18px;
    text-align: center;
    font-weight: bold;
    margin: 0 auto 10px;
    max-width: 480px;
}

.dcmouse-layout {
    display: flex;
    gap: 20px;
    /* Stretch (not flex-start) so the side column is always exactly as
       tall as the main column — combined with .dcmouse-helper-wrap's
       flex: 1 below, any leftover height automatically goes to the
       character box instead of leaving a gap under the HUD. */
    align-items: stretch;
    flex-wrap: wrap;
}

.dcmouse-side-col {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dcmouse-main-col {
    flex: 1 1 480px;
    min-width: 280px;
}

/* ---- Mouse diagram ---- */
.dcmouse-mouse-wrap {
    background: var(--dcmouse-panel-bg);
    border-radius: var(--dcmouse-radius);
    padding: 10px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.15);
}

/* Smaller than a first pass — this is just a "which button?" reference,
   not the focal point, and its height (stacked above the game on narrow
   screens) was pushing level-feedback text down out of view. */
.dcmouse-mouse-svg {
    width: 100%;
    max-width: 100px;
}

.dcmouse-mouse-body {
    fill: #dfe6e9;
    stroke: #b2bec3;
    stroke-width: 3;
}

.dcmouse-mouse-part {
    fill: #dfe6e9;
    stroke: #b2bec3;
    stroke-width: 2;
    transition: fill 0.2s ease, filter 0.2s ease;
}

.dcmouse-mouse-part.is-active {
    fill: var(--dcmouse-accent);
    filter: drop-shadow(0 0 6px rgba(0, 206, 201, 0.9));
    animation: dcmouse-pulse 1s ease-in-out infinite;
}

.dcmouse-mouse-wheel {
    fill: #636e72;
}

.dcmouse-mouse-wheel.is-active {
    fill: var(--dcmouse-accent);
}

.dcmouse-mouse-divider {
    stroke: #b2bec3;
    stroke-width: 2;
}

.dcmouse-mouse-x2 {
    font-size: 28px;
    font-weight: bold;
    fill: #fff;
    pointer-events: none;
    animation: dcmouse-pulse 1s ease-in-out infinite;
}

.dcmouse-mouse-hint {
    margin: 8px 0 0;
    font-weight: bold;
    color: var(--dcmouse-primary-dark);
    min-height: 1.4em;
}

@keyframes dcmouse-pulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(0, 206, 201, 0.7)); }
    50% { filter: drop-shadow(0 0 10px rgba(0, 206, 201, 1)); }
}

/* ---- HUD ---- */
.dcmouse-hud {
    background: var(--dcmouse-panel-bg);
    border-radius: var(--dcmouse-radius);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.15);
}

.dcmouse-hud-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.dcmouse-hud-value.is-penalty {
    color: var(--dcmouse-danger);
    animation: dcmouse-penalty-shake 0.5s ease;
}

.dcmouse-penalty-badge {
    position: absolute;
    right: 0;
    top: -6px;
    color: var(--dcmouse-danger);
    font-weight: bold;
    font-size: 0.85rem;
    pointer-events: none;
    animation: dcmouse-penalty-float 0.9s ease forwards;
}

@keyframes dcmouse-penalty-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes dcmouse-penalty-float {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-22px); }
}

.dcmouse-hud-label {
    color: #636e72;
}

.dcmouse-hud-value {
    font-weight: bold;
    color: var(--dcmouse-primary-dark);
}

.dcmouse-save-status {
    /* Explicit margin: 0 is required — this is a <p>, and without it the
       site template's default paragraph margin (16px top + bottom) was
       silently eating ~32px at the bottom of the side column, which is
       what was actually throwing off the HUD-to-main-column alignment
       (not the flex sizing itself, which was already exact). */
    margin: 0;
    text-align: center;
    font-size: 0.85rem;
    color: #636e72;
    min-height: 1.2em;
}

/* ---- Panels / buttons ---- */
.dcmouse-panel {
    background: var(--dcmouse-panel-bg);
    border-radius: var(--dcmouse-radius);
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.15);
}

.dcmouse-btn {
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 999px;
    padding: 12px 26px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.dcmouse-btn:hover {
    transform: translateY(-2px);
}

.dcmouse-btn:active {
    transform: translateY(0);
}

.dcmouse-btn-primary {
    background: var(--dcmouse-primary);
    color: #fff;
    box-shadow: 0 4px 0 var(--dcmouse-primary-dark);
}

.dcmouse-btn-secondary {
    background: #dfe6e9;
    color: var(--dcmouse-ink);
    box-shadow: 0 4px 0 #b2bec3;
}

.dcmouse-btn-large {
    font-size: 1.3rem;
    padding: 18px 40px;
}

.dcmouse-choice-buttons {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.dcmouse-result-title {
    color: var(--dcmouse-primary-dark);
    margin-top: 0;
}

.dcmouse-result-text {
    font-size: 1.05rem;
    margin: 0 0 10px;
}

.dcmouse-choice-prompt {
    font-size: 1rem;
    margin: 0 0 16px;
}

.dcmouse-link-btn {
    background: none;
    border: none;
    color: var(--dcmouse-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px;
}

.dcmouse-change-helper-row {
    margin: 14px 0 0;
}

/* ---- Helper character (picker + persistent avatar/bubble) ---- */
.dcmouse-character-options {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.dcmouse-character-option {
    background: #f8f9ff;
    border: 3px solid transparent;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.dcmouse-character-option:hover {
    border-color: var(--dcmouse-primary);
    transform: translateY(-3px);
}

.dcmouse-character-option img {
    height: 110px;
    width: auto;
}

.dcmouse-helper-wrap {
    background: var(--dcmouse-panel-bg);
    border-radius: var(--dcmouse-radius);
    padding: 10px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.15);
    /* The one flexible box in the side column — it's the one that grows
       to soak up whatever height .dcmouse-layout's stretch leaves spare,
       so the HUD below it always ends flush with the main column.
       align-items: center (not flexbox's own default of stretch) is
       required here — without it, the character image (a flex item with
       only a fixed height and auto width) gets its width stretched to
       fill the column, distorting it. Only the bubble below should
       actually stretch full-width, via its own align-self override. */
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.dcmouse-helper-img {
    height: 64px;
    width: auto;
    flex-shrink: 0;
}

.dcmouse-helper-bubble {
    align-self: stretch;
    margin-top: 6px;
    background: #f0f3ff;
    border-radius: 12px;
    padding: 6px 8px;
    font-size: 0.8rem;
    line-height: 1.3;
    font-weight: bold;
    color: var(--dcmouse-primary-dark);
    flex: 1;
    min-height: 2.4em;
    overflow-y: auto;
    /* Thin, arrow-less scrollbar (only shown on the rare message that
       still doesn't fit) instead of the default chunky one with up/down
       buttons. */
    scrollbar-width: thin;
}

.dcmouse-helper-bubble::-webkit-scrollbar {
    width: 5px;
}

.dcmouse-helper-bubble::-webkit-scrollbar-button {
    display: none;
}

.dcmouse-helper-bubble::-webkit-scrollbar-thumb {
    background: #c8ceee;
    border-radius: 3px;
}

.dcmouse-helper-bubble::-webkit-scrollbar-track {
    background: transparent;
}

/* ---- Level stage ---- */
.dcmouse-stage {
    background: var(--dcmouse-panel-bg);
    border-radius: var(--dcmouse-radius);
    padding: 20px;
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.15);
}

.dcmouse-level-title {
    margin: 0 0 4px;
    color: var(--dcmouse-primary-dark);
    text-align: center;
}

.dcmouse-level-instructions {
    text-align: center;
    margin: 0 0 10px;
    font-size: 1rem;
}

.dcmouse-level-feedback {
    margin: 0;
    text-align: center;
    min-height: 1.4em;
    font-weight: bold;
    color: var(--dcmouse-primary-dark);
}

.dcmouse-level-field {
    position: relative;
}

/* Generic play arena used by levels 1, 2, 3, 5, 8 */
.dcmouse-arena {
    position: relative;
    width: 100%;
    height: 380px;
    background: repeating-linear-gradient(45deg, #f8f9ff, #f8f9ff 20px, #f0f3ff 20px, #f0f3ff 40px);
    border-radius: 14px;
    overflow: hidden;
}

/* Level 1: move-the-pointer box */
.dcmouse-move-box {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 16px;
    background: var(--dcmouse-accent);
    box-shadow: 0 0 0 4px #fff, 0 0 16px rgba(0, 206, 201, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    /* Glow-only pulse, deliberately no transform/position movement — this
       is the first, gentlest level, so the target must stay perfectly
       still for a beginner (or a screen-reader/switch user) to reliably
       land on and hold. */
    animation: dcmouse-glow 1.4s ease-in-out infinite;
}

.dcmouse-move-box.is-hit {
    animation: dcmouse-pop 0.3s ease forwards;
}

@keyframes dcmouse-glow {
    0%, 100% { box-shadow: 0 0 0 4px #fff, 0 0 10px rgba(0, 206, 201, 0.5); }
    50% { box-shadow: 0 0 0 4px #fff, 0 0 20px rgba(0, 206, 201, 0.9); }
}

@keyframes dcmouse-pop {
    to { transform: scale(1.6); opacity: 0; }
}

/* Levels 2/3: click / double-click targets */
.dcmouse-click-target {
    position: absolute;
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 50%;
    background: var(--dcmouse-warning);
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 0 #d68910;
}

.dcmouse-click-target.is-hit {
    animation: dcmouse-pop 0.3s ease forwards;
}

.is-shake {
    animation: dcmouse-shake 0.4s ease;
}

@keyframes dcmouse-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* Level 4: drag and drop */
.dcmouse-drag-arena {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px 0;
}

.dcmouse-drag-tray, .dcmouse-drop-tray {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 100px;
}

.dcmouse-drag-shape {
    width: 70px;
    height: 70px;
    border-radius: 14px;
    cursor: grab;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    touch-action: none;
}

.dcmouse-drag-shape.is-dragging {
    position: fixed;
    z-index: 200;
    cursor: grabbing;
    pointer-events: none;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.dcmouse-drop-hole {
    width: 74px;
    height: 74px;
    border-radius: 14px;
    border: 4px dashed #b2bec3;
    background: rgba(255, 255, 255, 0.5);
}

.dcmouse-drop-hole.is-target-hover {
    border-color: var(--dcmouse-primary);
    background: rgba(108, 92, 231, 0.15);
}

.dcmouse-drop-hole.is-filled {
    border-style: solid;
}

.dcmouse-color-red { background: #ff6b6b; border-color: #ff6b6b; }
.dcmouse-color-blue { background: #4dabf7; border-color: #4dabf7; }
.dcmouse-color-green { background: #51cf66; border-color: #51cf66; }
.dcmouse-color-yellow { background: #ffd43b; border-color: #ffd43b; }
.dcmouse-color-purple { background: #cc5de8; border-color: #cc5de8; }

/* Levels 5/6/7: item grids for right-click actions */
.dcmouse-item-grid {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 0;
}

.dcmouse-rc-item {
    width: 76px;
    height: 76px;
    border-radius: 14px;
    background: #fff;
    border: 3px solid #dfe6e9;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: context-menu;
    user-select: none;
}

.dcmouse-rc-item.is-marked {
    border-color: var(--dcmouse-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.3);
}

.dcmouse-rc-item.is-marked-cut {
    opacity: 0.45;
    border-style: dashed;
}

.dcmouse-rc-item.is-gone {
    animation: dcmouse-pop 0.3s ease forwards;
}

/* Level 7 (Copy): the original stays in the tray once successfully
   copied, faded to show it's already been used, but still there — unlike
   Cut, which removes the original entirely (see .dcmouse-rc-item-landed
   below, applied to the item itself for Cut vs. to a duplicate for Copy). */
.dcmouse-rc-item.is-copy-done {
    opacity: 0.5;
    cursor: default;
}

/* Levels 6/7: sort trays + target boxes */
.dcmouse-sort-tray {
    background: #f8f9ff;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}

.dcmouse-sort-targets {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.dcmouse-sort-target {
    flex: 1;
    min-height: 100px;
    border-radius: 14px;
    border: 3px dashed #b2bec3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    font-weight: bold;
    cursor: context-menu;
}

.dcmouse-sort-target.is-target-hover {
    border-color: var(--dcmouse-primary);
    background: rgba(108, 92, 231, 0.08);
}

.dcmouse-sort-collected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    min-height: 34px;
}

/* Once an item lands in a target box it shrinks from a full drag/click
   target down to a small placed chip, so several can visibly collect
   side by side as proof of where each paste went. */
.dcmouse-rc-item-landed {
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
    cursor: default;
    animation: dcmouse-pop-in 0.25s ease;
}

@keyframes dcmouse-pop-in {
    from { transform: scale(0.4); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Level 8: scroll + basket */
.dcmouse-scroll-panel {
    position: relative;
    height: 320px;
    overflow-y: auto;
    background: #f8f9ff;
    border-radius: 14px;
    border: 3px solid #dfe6e9;
}

.dcmouse-scroll-inner {
    position: relative;
    width: 100%;
}

.dcmouse-scroll-item {
    position: absolute;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
}

.dcmouse-basket {
    margin-top: 12px;
    min-height: 90px;
    border-radius: 14px;
    border: 4px dashed var(--dcmouse-warning);
    background: rgba(253, 203, 110, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    font-weight: bold;
    padding: 10px;
}

.dcmouse-basket.is-target-hover {
    border-color: var(--dcmouse-primary);
}

.dcmouse-basket-icon {
    font-size: 2rem;
}

.dcmouse-basket-collected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

/* Landed fruit shrinks to a small chip inside the basket, same idea as
   .dcmouse-rc-item-landed for levels 6/7, so collected items are visibly
   proof of progress rather than just vanishing. */
.dcmouse-basket-item-landed {
    position: static !important;
    width: 30px !important;
    height: 30px !important;
    font-size: 1rem;
    cursor: default;
    animation: dcmouse-pop-in 0.25s ease;
}

/* A decoy toy dropped in the basket bounces straight back out rather than
   landing — a quick up-then-settle motion reads as "rejected". */
.dcmouse-scroll-item.is-jump-out {
    animation: dcmouse-jump-out 0.4s ease;
}

@keyframes dcmouse-jump-out {
    0% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-24px) scale(1.15); }
    100% { transform: translateY(0) scale(1); }
}

/* ---- Custom context menu ---- */
.dcmouse-contextmenu {
    position: fixed;
    z-index: 500;
    list-style: none;
    margin: 0;
    padding: 6px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    min-width: 140px;
}

.dcmouse-contextmenu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.dcmouse-contextmenu button:hover {
    background: #f0f3ff;
}

/* ---- Report ---- */
.dcmouse-report-list {
    list-style: none;
    padding: 0;
    margin: 14px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    text-align: left;
}

.dcmouse-report-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9ff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.dcmouse-band-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #b2bec3;
}

/* Red/Amber/Green, relative to the player's own cross-mechanic average —
   see scoreBand() in mouse.js. */
.dcmouse-report-list li.dcmouse-band-green { background: #eafff2; }
.dcmouse-report-list li.dcmouse-band-green .dcmouse-band-dot { background: #2ecc71; }
.dcmouse-report-list li.dcmouse-band-amber { background: #fffbe8; }
.dcmouse-report-list li.dcmouse-band-amber .dcmouse-band-dot { background: #f1c40f; }
.dcmouse-report-list li.dcmouse-band-red { background: #fff0f0; }
.dcmouse-report-list li.dcmouse-band-red .dcmouse-band-dot { background: #e74c3c; }

.dcmouse-report-list li.is-weakest {
    font-weight: bold;
    color: #c0392b;
    box-shadow: 0 0 0 2px #e74c3c inset;
}

.dcmouse-report-weakest {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--dcmouse-primary-dark);
}

.dcmouse-report-tip {
    margin: 0;
    font-size: 1rem;
    background: #f0f3ff;
    border-radius: 10px;
    padding: 10px 16px;
    display: inline-block;
}

/* ---- Results tables (teacher + admin) ---- */
.dcmouse-results {
    text-align: left;
}

.dcmouse-results-table-wrap {
    overflow-x: auto;
}

.dcmouse-results-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--dcmouse-panel-bg);
    border-radius: var(--dcmouse-radius);
    overflow: hidden;
}

.dcmouse-results-table th, .dcmouse-results-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #f0f3ff;
}

.dcmouse-results-table th {
    background: var(--dcmouse-primary);
    color: #fff;
}

@media (max-width: 700px) {
    .dcmouse-layout {
        flex-direction: column;
    }

    .dcmouse-side-col {
        flex: 1 1 auto;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .dcmouse-mouse-wrap, .dcmouse-helper-wrap, .dcmouse-hud {
        flex: 1 1 200px;
    }

    .dcmouse-helper-bubble {
        flex: 0 0 auto;
        max-height: 4.5em;
    }
}
