/* ============================================
   QUICK GAMES
   Shared components for the fast, low-text minigames in the Energy,
   Logistics, Military Service and Retail sets. These are built on the
   same MilGame scaffold as the branch games, so they inherit .mil-game
   and only add the pieces they need.

   The design rule for everything in here: one short line of instruction,
   large tap targets, and the state of the game readable at a glance.
   ============================================ */

/* Two extra themes for the sets that did not already have one. */
.mil-game.mil-joint {
    --mil-accent: #B8C29A;
    --mil-accent-dark: #4A5340;
    --mil-panel: rgba(24, 28, 22, 0.95);
    --mil-panel-soft: rgba(40, 46, 36, 0.9);
    --mil-line: rgba(184, 194, 154, 0.34);
}

.mil-game.mil-retail {
    --mil-accent: #FF8A3D;
    --mil-accent-dark: #A34A12;
    --mil-panel: rgba(30, 22, 16, 0.95);
    --mil-panel-soft: rgba(48, 36, 26, 0.9);
    --mil-line: rgba(255, 138, 61, 0.34);
}

/* ---------- service trade themes ---------- */

.mil-game.mil-elec {
    --mil-accent: #F2C230;
    --mil-accent-dark: #8A6A10;
    --mil-panel: rgba(24, 22, 16, 0.95);
    --mil-panel-soft: rgba(40, 36, 26, 0.9);
    --mil-line: rgba(242, 194, 48, 0.34);
}

.mil-game.mil-plumb {
    --mil-accent: #4FB0D6;
    --mil-accent-dark: #1D5F7C;
    --mil-panel: rgba(12, 24, 32, 0.95);
    --mil-panel-soft: rgba(20, 40, 52, 0.9);
    --mil-line: rgba(79, 176, 214, 0.32);
}

.mil-game.mil-weld {
    --mil-accent: #FF8A2B;
    --mil-accent-dark: #93440A;
    --mil-panel: rgba(22, 20, 19, 0.96);
    --mil-panel-soft: rgba(40, 34, 30, 0.92);
    --mil-line: rgba(255, 138, 43, 0.34);
}

.mil-game.mil-hvac {
    --mil-accent: #7FD8E8;
    --mil-accent-dark: #1F6B7C;
    --mil-panel: rgba(14, 24, 30, 0.95);
    --mil-panel-soft: rgba(24, 42, 52, 0.9);
    --mil-line: rgba(127, 216, 232, 0.32);
}


/* ---------- one-line brief ---------- */

.mil-game .qg-brief {
    width: 100%;
    text-align: center;
    font-size: 1.28rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--mil-accent);
    margin: 0;
}

.mil-game .qg-sub {
    width: 100%;
    text-align: center;
    font-size: 0.92rem;
    color: #A9C0D8;
    margin: -6px 0 0;
}

/* ---------- tap targets ---------- */

.mil-game .qg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
    gap: 10px;
    width: 100%;
}

.mil-game .qg-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.mil-game .qg-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.mil-game .qg-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.mil-game .qg-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }

.mil-game .qg-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.mil-game .qg-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 88px;
    padding: 12px 8px;
    border: 2px solid var(--mil-line);
    border-radius: 12px;
    background: var(--mil-panel-soft);
    color: #E9F1FA;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.12s ease, background 0.12s ease;
}

.mil-game .qg-tile:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--mil-accent); }
.mil-game .qg-tile:disabled { cursor: default; }
.mil-game .qg-tile.on { border-color: var(--mil-accent); background: rgba(255, 255, 255, 0.1); }
.mil-game .qg-tile.hit { border-color: #4ADE80; background: rgba(74, 222, 128, 0.22); }
.mil-game .qg-tile.miss { border-color: #FF7B72; background: rgba(255, 123, 114, 0.22); }
.mil-game .qg-tile.alarm {
    border-color: #FF5252;
    background: rgba(255, 82, 82, 0.28);
    animation: qg-flash 0.5s infinite alternate;
}
.mil-game .qg-tile.dim { opacity: 0.4; }

@keyframes qg-flash {
    from { box-shadow: 0 0 0 rgba(255, 82, 82, 0); }
    to   { box-shadow: 0 0 22px rgba(255, 82, 82, 0.85); }
}

.mil-game .qg-tile-sub { font-size: 0.76rem; font-weight: 600; color: #A9C0D8; }
.mil-game .qg-tile-big { font-size: 1.9rem; line-height: 1; }

/* ---------- a single big thing to read ---------- */

.mil-game .qg-big {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 110px;
    border: 2px solid var(--mil-accent);
    border-radius: 14px;
    background: var(--mil-panel-soft);
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--mil-accent);
}

.mil-game .qg-big.small { font-size: 2.0rem; min-height: 86px; }

/* ---------- horizontal gauge with a target band ---------- */

.mil-game .qg-gauge {
    position: relative;
    width: 100%;
    height: 54px;
    border: 1px solid var(--mil-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

/* The band marks the target, so it has to stay visible when a bar fill
   or a needle passes over it — hence the z-index and the transparency. */
.mil-game .qg-band {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
    background: rgba(74, 222, 128, 0.20);
    border-left: 2px solid rgba(74, 222, 128, 0.85);
    border-right: 2px solid rgba(74, 222, 128, 0.85);
}

.mil-game .qg-needle { z-index: 3; }

/* A row of small step buttons either side of a bar: the bar is the thing
   being read, so it takes the space and the buttons stay thumb-sized. */
.mil-game .qg-row .mil-btn.qg-go {
    flex: 0 0 auto;
    min-width: 54px;
    padding: 10px 14px;
}

.mil-game .qg-needle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    margin-left: -2px;
    border-radius: 2px;
    background: var(--mil-accent);
    box-shadow: 0 0 10px var(--mil-accent);
}

.mil-game .qg-readout {
    width: 100%;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 1.15rem;
    font-weight: 700;
    color: #A9C0D8;
}

.mil-game .qg-readout .good { color: #4ADE80; }
.mil-game .qg-readout .bad { color: #FF7B72; }

/* ---------- stacked bars ---------- */

.mil-game .qg-bars { width: 100%; display: flex; flex-direction: column; gap: 8px; }

.mil-game .qg-bar {
    position: relative;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.mil-game .qg-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--mil-accent-dark), var(--mil-accent));
    transition: width 0.18s ease;
}

.mil-game .qg-bar-fill.over { background: linear-gradient(90deg, #8C1D2C, #E8534A); }
.mil-game .qg-bar-fill.ok { background: linear-gradient(90deg, #26703F, #4ADE80); }

.mil-game .qg-bar-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #F2F7FB;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}

/* ---------- rotating dial (two needles to line up) ---------- */

.mil-game .qg-dial {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 3px solid var(--mil-line);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.25));
}

.mil-game .qg-dial-hand {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 84px;
    margin-left: -2px;
    transform-origin: 50% 100%;
    border-radius: 2px;
}

.mil-game .qg-dial-hand.a { background: var(--mil-accent); }
.mil-game .qg-dial-hand.b { background: #FF7B72; }

.mil-game .qg-dial-hub {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    background: var(--mil-accent);
}

/* ---------- moving belt ---------- */

.mil-game .qg-belt {
    position: relative;
    width: 100%;
    height: 78px;
    border: 1px solid var(--mil-line);
    border-radius: 10px;
    background: repeating-linear-gradient(90deg,
        rgba(255, 255, 255, 0.05) 0 18px, rgba(255, 255, 255, 0.02) 18px 36px);
    overflow: hidden;
}

.mil-game .qg-belt-item {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--mil-accent);
    color: #12181F;
    font-weight: 800;
    font-size: 1.0rem;
    white-space: nowrap;
}

/* ---------- vertical drop target ---------- */

.mil-game .qg-chutes {
    display: grid;
    grid-auto-flow: column;
    gap: 10px;
    width: 100%;
}

/* ---------- wire pairing ---------- */

.mil-game .qg-wires {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 40px;
    width: 100%;
    max-width: 460px;
}

.mil-game .qg-wire {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid var(--mil-line);
    border-radius: 10px;
    background: var(--mil-panel-soft);
    color: #E9F1FA;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.mil-game .qg-wire.on { border-color: var(--mil-accent); }
.mil-game .qg-wire.hit { border-color: #4ADE80; background: rgba(74, 222, 128, 0.2); }
.mil-game .qg-wire.miss { border-color: #FF7B72; background: rgba(255, 123, 114, 0.2); }
.mil-game .qg-wire:disabled { opacity: 0.5; cursor: default; }

.mil-game .qg-swatch {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    flex: 0 0 22px;
}

/* ---------- big single action button ---------- */

.mil-game .qg-go {
    padding: 20px 46px;
    font-size: 1.3rem;
    letter-spacing: 0.06em;
}

/* ---------- shelf ---------- */

.mil-game .qg-shelf {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 5px solid var(--mil-accent-dark);
}

.mil-game .qg-slot {
    height: 62px;
    border-radius: 6px;
    border: 2px dashed rgba(255, 255, 255, 0.18);
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
}

.mil-game .qg-slot.full {
    border-style: solid;
    border-color: transparent;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
    cursor: default;
}

.mil-game .qg-slot.filled { border-color: #4ADE80; background: rgba(74, 222, 128, 0.18); }

@media (max-width: 560px) {
    .mil-game .qg-brief { font-size: 1.1rem; }
    .mil-game .qg-big { font-size: 2.4rem; min-height: 92px; }
    .mil-game .qg-dial { width: 170px; height: 170px; }
    .mil-game .qg-dial-hand { height: 70px; }
    .mil-game .qg-wires { gap: 10px 18px; }
    .mil-game .qg-shelf { grid-template-columns: repeat(4, 1fr); }
}
