/* لعبة «صلحها بإيدك» — نفس ستايل اشرحلي (ورق مربعات، حبر، أحمر) */
.g { padding-top: 22px; padding-bottom: 10px; }
.g h1 { font-size: 40px; line-height: 1.25; margin: 4px 0 8px; }
.g button { font-family: inherit; }

/* القايمة */
.g-hero { max-width: 760px; }
.g-how { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 14px 0 22px; }
.g-how li { background: var(--card); border: 2px solid var(--ink); border-radius: 99px; padding: 2px 14px 2px 10px; font-weight: 700; font-size: 15px; display: flex; gap: 6px; align-items: center; }
.g-how li + li::before { content: "←"; color: var(--red); margin-left: 4px; }
.g-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.g-card { position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); padding: 10px 10px 12px; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform .15s, box-shadow .15s; }
.g-card:hover { transform: translateY(-3px); box-shadow: 5px 5px 0 var(--ink); }
.g-card svg.mini { width: 100%; max-width: 170px; height: auto; aspect-ratio: 400/460; }
.g-card b { font-size: 17px; }
.g-prog { font-size: 14px; color: var(--try); font-weight: 700; }
.g-card.lock svg { opacity: .35; filter: grayscale(1); }
.g-card.lock .g-prog { color: var(--mute); }
.g-free { position: absolute; top: 8px; left: 8px; background: var(--diy); color: #fff; font-style: normal; font-weight: 700; font-size: 13px; padding: 1px 10px; border-radius: 99px; border: 2px solid var(--ink); }

.g-unlock { margin: 30px 0 10px; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); padding: 6px 22px 20px; box-shadow: 6px 6px 0 var(--ink); }
.g-unlock h2 { margin-top: 18px; }
.g-unlock.flash { animation: flash .9s; }
@keyframes flash { 30% { box-shadow: 0 0 0 6px var(--red); } }
.g-offers { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g-offer { border: 2px solid var(--ink); border-radius: 12px; padding: 12px 16px 16px; background: var(--paper); }
.g-offer.best { background: #F3F7EC; }
.g-offer > b { display: block; font-size: 30px; color: var(--red); line-height: 1.3; }
.g-offer p { margin: 4px 0 12px; font-size: 16px; }
.g-offer .more { display: block; margin-top: 10px; font-weight: 700; font-size: 15px; }
.g-code { margin-top: 18px; }
.g-code label { font-weight: 700; display: block; }
.g-code > div { display: flex; gap: 8px; margin-top: 4px; }
.g-code input { font: 600 20px 'IBM Plex Sans Arabic', monospace; letter-spacing: 2px; padding: 6px 12px; border: 2px solid var(--ink); border-radius: 10px; width: 190px; background: #fff; text-transform: uppercase; }
.g-err { color: var(--red); font-weight: 600; margin: 6px 0 0; min-height: 1em; }
.g-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 22px; border-radius: 99px; font-weight: 700; z-index: 50; transition: opacity .4s; }
.g-toast.out { opacity: 0; }

/* اللعب */
.g-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.g-bar b { font-size: 19px; text-align: center; } .g-bar small { color: var(--mute); font-weight: 600; }
.g-back { font-weight: 700; text-decoration: none; white-space: nowrap; }
.g-hearts { font-size: 18px; letter-spacing: 1px; white-space: nowrap; }
.g-steps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 10px 0 12px; overflow-x: auto; }
.g-steps li { flex: 1; text-align: center; font-size: 13px; font-weight: 700; padding: 3px 6px; border-radius: 99px; background: var(--alt); color: var(--mute); white-space: nowrap; border: 2px solid transparent; }
.g-steps li.on { background: var(--red); color: #fff; border-color: var(--ink); }
.g-steps li.done { background: var(--ink); color: var(--paper); }
.g-main { display: grid; grid-template-columns: 1.05fr 1fr; gap: 18px; align-items: start; }
.g-stagewrap { position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: 5px 5px 0 var(--ink); }
.g-stagewrap.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
svg.stage { display: block; width: 100%; height: auto; max-height: 72vh; touch-action: none; user-select: none; -webkit-user-select: none; }
.g-state { position: absolute; top: 8px; right: 8px; font-size: 13px; font-weight: 700; }
.g-state span { padding: 2px 10px; border-radius: 99px; border: 2px solid var(--ink); background: #fff; }
.g-state .off { background: #E3EEDB; } .g-state .on { background: #FBE9D2; }
.g-bubble { position: absolute; transform: translate(-50%, calc(-100% - 22px)); background: var(--ink); color: var(--paper); padding: 6px 12px; border-radius: 10px; font-size: 15px; line-height: 1.5;
  pointer-events: none; max-width: 230px; width: max-content; text-align: center; z-index: 3; }
.g-bubble::after { content: ""; position: absolute; bottom: -7px; left: 50%; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: var(--ink); }
.g-bubble small { display: block; color: #d9d3c7; font-size: 13px; } .g-bubble em { display: block; font-style: normal; color: #ffb4a3; font-weight: 700; font-size: 13px; }
.g-bubble.pop { animation: pop .25s; }

.g-msg { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 14px; font-size: 17px; min-height: 56px; }
.g-msg.bad { background: var(--redbg); border-color: var(--red); }
.g-msg.good { background: #EAF2E1; border-color: var(--diy); }
.g-msg .muted { font-size: 15px; }
.g-panel { margin-top: 12px; }
.g-q { font-weight: 700; margin: 6px 0; }
.g-say { background: var(--card); border: 2px solid var(--ink); border-radius: 14px 14px 14px 2px; padding: 8px 14px; }
.g-say .who { font-size: 14px; font-weight: 700; color: var(--mute); } .g-say p { margin: 2px 0; font-size: 19px; font-weight: 600; }
.g-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.g-choices .btn, .g-btns .btn, .g-try { cursor: pointer; font-size: 17px; }
.g-hint { background: var(--card); border: 2px dashed var(--ink); border-radius: 12px; padding: 8px 14px; } .g-hint p { margin: 2px 0; }

.g-slide { margin-top: 4px; }
.g-slide .trk { position: relative; height: 62px; border: 2px solid var(--ink); border-radius: 99px; background: repeating-linear-gradient(45deg, #fff, #fff 10px, #f4f1ea 10px, #f4f1ea 20px); overflow: hidden; }
.g-slide .lbl { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 16px; color: var(--ink); pointer-events: none; padding: 0 64px; text-align: center; line-height: 1.3; }
.g-slide .knob { position: absolute; top: 3px; width: 52px; height: 52px; border-radius: 50%; background: var(--red); border: 2px solid var(--ink); display: grid; place-items: center; font-size: 26px;
  cursor: grab; touch-action: none; transition: transform .25s; box-shadow: 2px 2px 0 var(--ink); }
.g-slide.off .knob { right: 3px; } .g-slide.on .knob { left: 3px; }
.g-slide .knob.drag { transition: none; cursor: grabbing; }
.g-slide .trk.ok { background: #EAF2E1; }
.g-slide .trk.ok .knob { background: var(--diy); }

.g-tray, .g-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.g-chip, .g-tool { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 6px 10px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--ink); }
.g-chip svg { width: 44px; height: 44px; }
.g-chip.next { border-color: var(--red); box-shadow: 0 0 0 3px var(--redbg); animation: nudge 1.2s infinite; }
.g-chip.dim { opacity: .45; }
.g-tool span { font-size: 26px; }
.g-tool.sel { background: var(--redbg); border-color: var(--red); }
.g-ghost { position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, -50%) scale(1.08); box-shadow: 4px 4px 0 var(--ink); opacity: .95; }

.g-res { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); padding: 12px 18px 16px; box-shadow: 5px 5px 0 var(--ink); }
.g-res h3 { margin: 0 0 6px; font-size: 24px; }
.g-res p { margin: 6px 0; font-size: 16px; }
.g-res .cost b { color: var(--red); }
.g-stars { font-size: 34px; color: var(--try); letter-spacing: 4px; line-height: 1.2; } .g-stars span { color: #d8d2c5; }
.g-cheat { border-right: 4px solid var(--red); background: var(--redbg); padding: 6px 12px; border-radius: 8px; margin: 10px 0; } .g-cheat p { margin: 2px 0; }
.g-btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.g-book { display: block; font-weight: 700; font-size: 15px; text-decoration: none; border-top: 2px dashed var(--line); padding-top: 10px; }

/* رسومات الأجهزة */
.g svg .k { fill: #F8F7F3; stroke: #2E2A25; stroke-width: 3; stroke-linejoin: round; }
.g svg .g { fill: #E6E2D9; stroke: #2E2A25; stroke-width: 2.5; }
.g svg .m { fill: #CFCAC0; stroke: #2E2A25; stroke-width: 2.5; }
.g svg .w { fill: #fff; stroke: #2E2A25; stroke-width: 2.5; }
.g svg .d { fill: #2E2A25; }
.g svg .r { fill: #B8442E; stroke: #2E2A25; stroke-width: 2; }
.g svg .b { fill: #C9E0EC; stroke: #2E2A25; stroke-width: 2; }
.g svg .y { fill: #EFE5C4; stroke: #2E2A25; stroke-width: 2; }
.g svg .o { fill: #E9A23B; stroke: #2E2A25; stroke-width: 2; }
.g svg .gr { fill: #8FB06A; stroke: #2E2A25; stroke-width: 2; }
.g svg .cu { fill: #D9956A; stroke: #2E2A25; stroke-width: 2.5; }
.g svg .bn { fill: #7A5A3A; opacity: .85; }
.g svg .fl { fill: #5B8FD6; }
.g svg .ln { fill: none; stroke: #2E2A25; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.g svg .lt { fill: none; stroke: #2E2A25; stroke-width: 2; stroke-linecap: round; }
.g svg .pipe { fill: none; stroke: #8E8A82; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.g svg .hose { fill: none; stroke: #2E2A25; stroke-width: 10; stroke-linecap: round; }
.g svg .handle { fill: none; stroke: #2E2A25; stroke-width: 14; stroke-linecap: round; }
.g svg .heat { fill: none; stroke: #E07A3A; stroke-width: 5; stroke-linecap: round; }
.g svg .gk { fill: none; stroke: #4a453d; stroke-width: 12; }
.g svg .grid { fill: none; stroke: #2E2A25; stroke-width: 3; }
.g svg .xr { fill: rgba(184, 68, 46, .07); stroke: #B8442E; stroke-width: 2.5; stroke-dasharray: 7 5; }
.g svg .dash { fill: none; stroke: #8a8378; stroke-width: 2; stroke-dasharray: 7 6; }
.g svg .tx { fill: #6c665c; font: 600 15px 'IBM Plex Sans Arabic', sans-serif; text-anchor: middle; }
.g svg .tx.big { font-size: 60px; fill: #B8442E; }
.g svg .hit { fill: transparent; }
svg.stage .pt { cursor: pointer; transition: opacity .25s; }
svg.stage .pt.cv { cursor: grab; }
svg.stage .pt.next { animation: nudge 1.1s infinite; }
svg.stage .pt.next > :first-child { stroke: #B8442E; }
svg.stage .pt.drag { animation: none; transition: none; cursor: grabbing; }
svg.stage .pt.gone { opacity: 0; }
svg.stage .pt.hide { display: none; }
svg.stage .pt.ghost { opacity: .8; animation: nudge 1.1s infinite; }
svg.stage .pt.ghost > :not(.hit) { fill-opacity: .12; stroke: #B8442E; stroke-dasharray: 7 6; }
svg.stage .pt.back { animation: pop .35s; }
svg.stage .pt.clean > :not(.hit) { opacity: 0; transition: opacity 1.2s; }
svg.stage .pt.fixed { filter: drop-shadow(0 0 5px #8FB06A); }
svg.stage .pt { transform-box: fill-box; transform-origin: center; }
@keyframes nudge { 50% { transform: translateY(-4px); } }
@keyframes pop { 0% { transform: scale(.85); opacity: .3; } 100% { transform: none; opacity: 1; } }

/* المؤثرات */
.clue text, .f-fixed text, .f-ok text { font-size: 22px; text-anchor: middle; }
.clue circle { fill: rgba(255, 255, 255, .85); stroke: #B8442E; stroke-width: 2.5; transform-box: fill-box; transform-origin: center; }
.clue .r2 { fill: none; animation: ring 1.6s infinite; } .clue .r1 { animation: none; }
@keyframes ring { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
.clue { pointer-events: none; }
.fx { pointer-events: none; }
.f-found circle { fill: none; stroke: #B8442E; stroke-width: 4; stroke-dasharray: 8 6; animation: spin 3s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.f-fixed circle { fill: #5E7D3A; stroke: #2E2A25; stroke-width: 2.5; } .f-fixed text { fill: #fff; font-weight: 700; }
.f-ok circle { fill: #5E7D3A; stroke: #2E2A25; stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: pop .4s; } .f-ok text { fill: #fff; font-size: 48px; font-weight: 700; }
svg.stage.works { animation: glow 1s; }
@keyframes glow { 50% { filter: drop-shadow(0 0 12px #8FB06A); } }

@media (max-width: 900px) {
  .g-grid { grid-template-columns: repeat(3, 1fr); }
  .g-main { grid-template-columns: 1fr; gap: 12px; }
  svg.stage { max-height: 46vh; }
  .g-side { display: flex; flex-direction: column; }
}
@media (max-width: 600px) {
  .g h1 { font-size: 32px; }
  .g-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .g-offers { grid-template-columns: 1fr; }
  .g-unlock { padding: 4px 14px 16px; }
  .g-bar b { font-size: 16px; } .g-bar small { display: block; font-size: 13px; }
  .g-msg { font-size: 16px; padding: 8px 12px; min-height: 0; }
  .g-steps li { font-size: 12px; padding: 2px 4px; }
}
