/* WAHAJ prototype — Green the Desert: pipes, valves, crops, locks and labels on the Build screen (docs/DECISIONS.md V6G-19).
   Status colours: green where water flows, pink where it does not (never red), grey where a valve is shut. */
:root { --pipe-flow: #19E66B; --pipe-dry: #FF4FA3; --pipe-off: #8E8E93; --pipe-main: #1F7FD8; --pipe-drip: #2C2C2E }
[data-theme="light"] { --pipe-flow: #0A9B45; --pipe-dry: #C2185B; --pipe-off: #8E8E93; --pipe-main: #1A6FC2; --pipe-drip: #1D1D1F }

/* the inventory: a segmented control over the tab's own row */
.fg-hotbar.fg-inv2 { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 12px 12px; flex: 1 1 auto; min-width: 0; max-width: 1180px}
.fg-invh { display: flex; align-items: center; gap: 12px; min-width: 0}
.fg-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); flex: none}
.fg-seg button { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: #c7c7cc; transition: background .2s ease, color .2s ease}
.fg-seg button:hover { color: #fff}
.fg-seg button.on { color: #0a0a0b; background: #f5f5f7}
.fg-cnt { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font: normal 700 11px/18px inherit; text-align: center; color: #0a0a0b; background: var(--pipe-flow)}
.fg-cnt.warn { color: #fff; background: var(--pipe-dry)}
.fg-invnote { margin-inline-start: auto; font-size: 13px; color: #a1a1a6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis}
.fg-invnote em { font-style: normal; font-weight: 700}
.fg-invnote em.warn { color: var(--pipe-dry)}
.fg-invb { display: flex; align-items: stretch; gap: 12px; height: 132px; min-width: 0}
/* Leave room inside the scrollport for raised cards and their outer focus/guide rings. */
.fg-inv2 .fg-slots { flex: 0 1 auto; padding: 10px 6px 6px; margin: -10px -6px -6px; scroll-padding-inline: 6px}
.fg-inv2 .fg-slot { height: 126px; padding-top: 6px}
.fg-inv2 .fg-th { width: 54px; height: 54px}
.fg-inv2 .fg-slot.on { transform: translateY(-4px)}
.fg-inv2 .fg-sets { flex: 1; width: auto}
.fg-inv2 .fg-sets > div { grid-template-columns: repeat(3, minmax(0, 1fr))}
.fg-inv2 .fg-set { height: 44px}

/* the two pipes in the inventory, drawn as pipes */
.fg-pipeart svg { width: 54px; height: 54px}
.fg-pipeart .pa-body { fill: var(--pipe-main)}
.fg-pipeart.drip .pa-body { fill: var(--pipe-drip); stroke: rgba(255, 255, 255, 0.35); stroke-width: 1}
.fg-pipeart .pa-ring { fill: #0f4f8f}
.fg-pipeart .pa-valve { fill: var(--pipe-flow)}
.fg-pipeart .pa-drop { fill: #38BDF8}
.fg-pipeslot { width: 104px}

/* every pipe, with its valve switch */
.fg-plist { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 44px; align-content: start; gap: 6px; overflow-y: auto; padding-inline-end: 2px}
.fg-pnone { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: auto 0; font-size: 13.5px; color: #c7c7cc}
.fg-prow { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 6px 0 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07)}
.fg-prow.sel { border-color: rgba(255, 255, 255, 0.5)}
.fg-pname { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 4px; text-align: start; color: inherit}
.fg-pname span { min-width: 0; display: grid}
.fg-pname b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis}
.fg-pname small { font-size: 11px; color: #a1a1a6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis}
.fg-pdot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--pipe-flow)}
.fg-prow.flow .fg-pdot { animation: fgPulse 1.6s ease-in-out infinite}
.fg-prow.dry .fg-pdot { background: var(--pipe-dry)}
.fg-prow.dry small { color: var(--pipe-dry)}
.fg-prow.off .fg-pdot { background: var(--pipe-off)}
@keyframes fgPulse { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }
/* the valve: an on/off switch */
.fg-sw { position: relative; width: 40px; height: 24px; flex: none; border-radius: 999px; background: rgba(255, 255, 255, 0.18); transition: background .2s ease}
.fg-sw i { position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s ease}
.fg-sw.on { background: var(--pipe-flow)}
.fg-sw.on i { transform: translateX(16px)}
[dir="rtl"] .fg-sw.on i { transform: translateX(-16px)}
.fg-pdel { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; color: #a1a1a6}
.fg-pdel:hover { color: #fff; background: rgba(255, 255, 255, 0.08)}

/* the crops: one card per plot, its colour, its plants, its days */
.fg-cards { display: flex; gap: 10px; overflow-x: auto; min-width: 0; flex: 1; padding-bottom: 2px}
.fg-ccard { flex: none; width: 300px; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07)}
.fg-cch { display: flex; align-items: center; gap: 8px; min-width: 0}
.fg-cch b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis}
.fg-cch small { margin-inline-start: auto; font-size: 12px; color: #a1a1a6; white-space: nowrap}
.fg-cdot { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 50%; vertical-align: -1px; margin-inline-end: 5px}
.fg-cdot.big { width: 14px; height: 14px; margin: 0}
.fg-cdays { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #c7c7cc}
.fg-crops { display: inline-flex; flex-wrap: nowrap; gap: 4px}
.fg-crops button { display: inline-flex; align-items: center; height: 28px; padding: 0 9px 0 7px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #e5e5ea; background: rgba(255, 255, 255, 0.06); border: 1px solid transparent; white-space: nowrap}
.fg-crops button.on { color: #fff; border-color: rgba(255, 255, 255, 0.75); background: rgba(255, 255, 255, 0.12)}

/* the picked part's toolbar: water, crop, lock */
.fg-wtag { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap}
.fg-wtag.ok { color: var(--pipe-flow); background: rgba(25, 230, 107, 0.1)}
.fg-wtag.dry { color: #fff; background: var(--pipe-dry)}
.fg-cb.lockb.on { color: #0a0a0b; background: #f5f5f7}
.fg-ctx.locked { border-color: rgba(255, 255, 255, 0.35)}
.fg-lk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: #c7c7cc}

/* labels on the 3D farm */
.s3d-label.fgl { padding: 4px 10px 5px; border-radius: 10px; font-size: 12px; background: rgba(10, 10, 12, 0.72); border-color: rgba(255, 255, 255, 0.14)}
.s3d-label.fgl b { display: inline-flex; align-items: center; gap: 4px}
.s3d-label.fgl span { display: inline-flex; align-items: center; color: #e5e5ea; font-size: 11px}
.s3d-label.fgl .fg-cdot { width: 8px; height: 8px; margin-inline-end: 4px}
.s3d-label.fgl.dry { border-color: var(--pipe-dry)}
.s3d-label.fgl.dry span { color: #FF8CC6; font-weight: 700}
.s3d-label.fgl.dry::after { background: var(--pipe-dry)}
.s3d-label.fgl.src { border-color: rgba(56, 189, 248, 0.8)}
.s3d-label.fgl.src span { color: #7DD3FC}
.s3d-label.fgl.from { border-color: var(--pipe-flow); animation: fgFrom 1.2s ease-in-out infinite}
.s3d-label.fgl.from span { color: var(--pipe-flow)}
@keyframes fgFrom { 0%, 100% { outline: 0 solid rgba(25, 230, 107, 0.5) } 50% { outline: 4px solid rgba(25, 230, 107, 0.18) } }
.fg-chipb.on { color: #0a0a0b; background: #f5f5f7; border-color: #f5f5f7}
.fg.piping .s3d canvas { cursor: crosshair !important}

/* the plan and the minimap draw the pipes along their paths */
.g-pipe .g-phit { fill: none; stroke: transparent; stroke-width: 12; vector-effect: non-scaling-stroke}
.g-pipe .g-pl { fill: none; stroke: var(--pipe-main); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke}
.g-pipe.drip .g-pl { stroke: #3a3a3c; stroke-width: 2}
.g-pipe .g-ps { fill: none; stroke: var(--pipe-flow); stroke-width: 1.4; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; animation: fgDash 1s linear infinite}
.g-pipe.dry .g-ps { stroke: var(--pipe-dry); animation: none; stroke-dasharray: 2 3}
.g-pipe.off .g-ps { stroke: var(--pipe-off); animation: none}
@keyframes fgDash { to { stroke-dashoffset: -8 } }

/* light theme */
[data-theme="light"] .fg-seg { background: rgba(0, 0, 0, 0.06)}
[data-theme="light"] .fg-seg button { color: #3a3a3c}
[data-theme="light"] .fg-seg button.on { color: #fff; background: #1d1d1f}
[data-theme="light"] .fg-invnote, [data-theme="light"] .fg-pname small, [data-theme="light"] .fg-cch small { color: #6e6e73}
[data-theme="light"] .fg-prow, [data-theme="light"] .fg-ccard { background: rgba(0, 0, 0, 0.035); border-color: rgba(0, 0, 0, 0.08)}
[data-theme="light"] .fg-prow.sel { border-color: rgba(0, 0, 0, 0.45)}
[data-theme="light"] .fg-pnone, [data-theme="light"] .fg-cdays, [data-theme="light"] .fg-lk { color: #3a3a3c}
[data-theme="light"] .fg-sw { background: rgba(0, 0, 0, 0.16)}
[data-theme="light"] .fg-pdel { color: #6e6e73}
[data-theme="light"] .fg-pdel:hover { color: #1d1d1f; background: rgba(0, 0, 0, 0.06)}
[data-theme="light"] .fg-crops button { color: #1d1d1f; background: rgba(0, 0, 0, 0.05)}
[data-theme="light"] .fg-crops button.on { border-color: #1d1d1f; background: #fff}
[data-theme="light"] .fg-wtag.ok { background: rgba(10, 155, 69, 0.1)}
[data-theme="light"] .fg-cb.lockb.on, [data-theme="light"] .fg-chipb.on { color: #fff; background: #1d1d1f; border-color: #1d1d1f}
[data-theme="light"] .fg-pipeart.drip .pa-body { stroke: none}
[data-theme="light"] .g-pipe.drip .g-pl { stroke: #1d1d1f}

/* the hint sits above the taller inventory */
.fg-hint { bottom: 290px}
/* the crop cards fit their four crops */
.fg-ccard { width: 348px}
.fg-crops button { padding: 0 8px 0 6px; font-size: 11.5px}
.fg-ccard { width: 376px}
/* while laying a pipe in the Top view, the design checks step aside so the well and every part can be tapped */
.fg.piping .g2d-rules { display: none}
[data-theme="light"] .fg-sw.on { background: var(--pipe-flow)}

/* V6G-23: the goal card and the map end above the budget card and the inventory (the map was under the budget card) */
.fg-lcol { bottom: 286px}
.fg-lcol > .fg-quest { flex: 0 1 auto; min-height: 0; max-height: none; overflow-y: auto; scrollbar-width: none}
.fg-lcol > .fg-mini { flex: none}
.fg-lcol > .fg-mini .fg-mapin { height: 104px}
.fg-st { min-height: 32px}
/* the mentor chat sits above the inventory, never on it; while it is open the cards at the bottom make room */
#stage:has(.fg[data-route="f-build"]) .mch { height: 700px}
#stage:has(#mchat:not([hidden])) .fg-hint { display: none}
#stage:has(#mchat:not([hidden])) .fg-tbottom { left: 332px; transform: none; width: 696px}
#stage:has(#mchat:not([hidden])) .fg-pbottom { inset-inline-end: 424px}
[dir="rtl"] #stage:has(#mchat:not([hidden])) .fg-tbottom, #stage[dir="rtl"]:has(#mchat:not([hidden])) .fg-tbottom { left: auto; right: 332px}

/* V6G-25: power cables and power chips (yellow where power flows) */
:root { --power-on: #FFD60A } [data-theme="light"] { --power-on: #B88600 }
.fg-pipeart .pa-wire { fill: none; stroke: #4a4d52; stroke-width: 5; stroke-linecap: round}
.fg-pipeart .pa-plug { fill: #2c2c2e; stroke: rgba(255, 255, 255, 0.35)}
.fg-pipeart .pa-zap { fill: var(--power-on)}
.fg-prow.cable.flow .fg-pdot { background: var(--power-on)}
.fg-wtag.pw.ok { color: var(--power-on); background: rgba(255, 214, 10, 0.1)}
.s3d-label.fgl.power { border-color: rgba(255, 214, 10, 0.8)}
.s3d-label.fgl.power span { color: #FFE066}

/* V6G-26: while a link is laid, where it can start pulses, and the hint can take the camera there */
.s3d-label.fgl.next { border-color: var(--pipe-flow); animation: fgFrom 1.2s ease-in-out infinite}
.s3d-label.fgl.power.next { border-color: var(--power-on)}
.fg-hint .fg-find { display: inline-flex; align-items: center; gap: 5px; height: 26px; margin-inline-start: 4px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: #0a0a0b; background: #f5f5f7}
[data-theme="light"] .fg-hint .fg-find { color: #fff; background: #1d1d1f}
