/* Hamed's World v2 · games in the new look (round 11, builder A). Linked on /play, /play/g1 and /messages under `window`, after
   tokens.css, site.css and compat.css; the engine's own play.css (classic) is loaded before and is re-skinned here.
   Her rules: Cairo, her colours and buttons; the night window frames the play, ivory surfaces carry every word; no door chrome.
   Motion: CSS only, transform/opacity, nothing new under reduced motion. Mobile first at 390; RTL first (logical properties). */

/* ================= /play: the games page ================= */
.page-head--play { background: var(--c-night); color: var(--c-ivory); }
.page-head--play .h-page { color: var(--c-ivory); }
.page-head--play .lead { color: #DCE1E8; margin: 0; }
.gm2-sec { padding-block-start: clamp(28px, 4vw, 48px); }
.gm2-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .gm2-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .gm2-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
.gm2 { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end; min-height: 400px;
  border-radius: var(--radius-card); overflow: hidden; background: var(--c-night); color: var(--c-ivory); box-shadow: var(--shadow); }
@media (min-width: 1100px) { .gm2 { min-height: 0; aspect-ratio: 4 / 5; } }
/* pass 2 (CD): the tree teaser's walls were salmon next to the game's pale watercolour */
.gm2--tree .gm2-img { filter: saturate(.62) brightness(.97); }
.gm2-pic { position: absolute; inset: 0; z-index: -2; }
.gm2-img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.gm2--soon .gm2-img { filter: saturate(.75); }
/* the fallback while a teaser picture is not on disk: the night sky with the game's line mark, never an empty box */
.gm2-fallback { position: absolute; inset: 0; display: grid; place-items: start center; padding-block-start: 56px; color: var(--c-silver);
  background: radial-gradient(120% 70% at 50% 0%, #243B5A 0%, var(--c-night) 70%); }
.gm2-fallback svg { width: 104px; height: 104px; opacity: .9; }
/* the veil: text sits on a dark ground at least 4.5:1 whatever the picture does above it */
.gm2-veil { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to top, rgba(16, 28, 48, .96) 0%, rgba(16, 28, 48, .9) 34%, rgba(16, 28, 48, .45) 62%, rgba(16, 28, 48, 0) 82%); }
.gm2-body { padding: 22px 22px 24px; display: grid; gap: 8px; justify-items: start; }
.gm2-t { color: var(--c-ivory); margin: 0; }
.gm2-l { color: #DCE1E8; margin: 0 0 6px; font-size: var(--fs-body); }
.gm2-go { min-width: 160px; }
/* fix round (CD fix 10): «قريبًا» = a small muted label in the text column (no pill, never on the picture) */
.gm2-soon { margin: 0; }
.gm2-soon-l { display: inline-flex; align-items: center; gap: 8px; font: 600 var(--fs-small)/1.5 var(--font); color: var(--c-silver); }
.gm2-soon-l::before { content: ""; inline-size: 18px; block-size: 1px; background: currentColor; opacity: .7; }
.gm2--on .gm2-go::after { content: ""; position: absolute; inset: 0; }   /* the whole card is the link target */
.gm2--on .gm2-go:focus-visible { outline-color: var(--c-ivory); }
.gm2--on { transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out); }
.gm2--on:active { transform: scale(.99); }
@media (hover: hover) and (pointer: fine) {
  .gm2--on:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
  .gm2--on:hover .gm2-go { background: var(--c-sand); }
}

/* pass 2 (CD): at phone width the picture sits whole above the words (the lost cane and lunch box were under the veil) */
@media (max-width: 719.98px) {
  .gm2 { min-height: 0; justify-content: flex-start; }
  .gm2-pic { position: relative; inset: auto; z-index: 0; aspect-ratio: 4 / 3; }
  .gm2-pic::after { content: ""; position: absolute; inset: auto 0 0; height: 28%; background: linear-gradient(to top, var(--c-night), rgba(16, 28, 48, 0)); }
  .gm2-img { object-position: 50% 50%; }
  .gm2-veil { display: none; }
  .gm2-body { padding-block-start: 6px; }
}

/* ================= /play/g1: the game in the shell ================= */
/* the site header scrolls away (the game bar is the sticky one); while playing, header and footer step aside (the stage is full screen) */
html[data-page="discover:play-g1"] .top { position: relative; }
html.pg-playing .top, html.pg-playing .foot, html.pg-playing .inst, html.pg-playing .skip { display: none; }
.v2-play .pg { min-height: 0; }
html.v2:not(.pg-playing) .v2-play .pg-col { min-height: calc(100svh - var(--top-h)); }
.v2-play .pg-col { background: var(--c-ivory); }

/* the bar: the night window */
.v2-play .pg-bar { background: var(--c-night); border-block-end: 0; box-shadow: 0 1px 0 rgba(198, 204, 212, .18); }
.v2-play .pg-bar-t { font: 700 22px/1.35 var(--font); color: var(--c-ivory); }
.v2-play .pg-compass svg { filter: none; }   /* pass 2 (CD): navy compass with its small gold ring; no cream medallion */
/* pass 2 (CD): sound = the scene page's secondary control: white, 1px line, 12 px radius, 48 px, icon only at 390 */
.v2-play .pg-mute { width: 48px; height: 48px; border-radius: var(--radius-btn); background: #FFFFFF; color: var(--c-navy);
  border: 1px solid var(--c-line); box-shadow: none; }
.v2-play .pg-mute.is-off { background: #FFFFFF; color: var(--c-muted); }
.v2-play .pg-mute:focus-visible { outline: 3px solid var(--c-ivory); outline-offset: 2px; }
.v2-play .pg-slot { background: rgba(250, 247, 240, .08); border-color: rgba(198, 204, 212, .4); border-radius: 12px; }
.v2-play .pg-slot.is-held { border-color: var(--c-ivory); }
.v2-play .pg-slot.is-back { background: var(--c-ivory); border-color: var(--c-gold); box-shadow: none; }

/* the start screen: who walks the path + name, on ivory */
.v2-play .pg-start { padding-block-start: 28px; }
.v2-play .pg-h { font: 700 var(--fs-section)/1.35 var(--font); color: var(--c-navy); }
.v2-play .pg-look-arch { border-radius: var(--radius-card); background: var(--c-sand); border: 2px solid var(--c-line); }
.v2-play .pg-look-name { font: 600 var(--fs-small)/1.4 var(--font); color: var(--c-navy); }
.v2-play .pg-look input:checked + .pg-look-arch { border: 3px solid var(--c-navy); box-shadow: var(--shadow); background: #FFFFFF; }
.v2-play .pg-look input:focus-visible + .pg-look-arch { outline: 3px solid var(--c-hover); outline-offset: 3px; }
.v2-play .pg-field label { font: 600 var(--fs-kid)/1.5 var(--font); color: var(--c-navy); }
.v2-play .pg-field input { background: #FFFFFF; border: 2px solid var(--c-line); border-radius: var(--radius-btn); color: var(--c-navy); font: 400 20px/1.4 var(--font); }
.v2-play .pg-field input:focus-visible { outline: 3px solid var(--c-hover); outline-offset: 2px; border-color: var(--c-navy); }
.v2-play .pg-note { color: var(--c-muted); font: 400 var(--fs-small)/1.7 var(--font); }
.v2-play .pg-go { min-height: 60px; min-width: 240px; border-radius: var(--radius-btn); font: 600 var(--fs-kid)/1.3 var(--font); }
.v2-play .pg-grown { color: var(--c-muted); }
.v2-play .pg-grown summary { text-decoration-color: var(--c-line); }
.v2-play .pg-switch { background: #FFFFFF; border-color: var(--c-line); border-radius: var(--radius-btn); }
.v2-play .pg-switch b { color: var(--c-navy); font-family: var(--font); }
.v2-play .pg-switch small { color: var(--c-muted); font-family: var(--font); }
.v2-play .pg-switch[aria-checked=true] .track { background: var(--c-navy); }
.v2-play .pg-keys { background: #FFFFFF; border-color: var(--c-line); border-radius: var(--radius-card); }
.v2-play .pg-keys-h { color: var(--c-navy); }
.v2-play .pg-keys kbd { background: var(--c-ivory); border-color: var(--c-line); box-shadow: 0 2px 0 var(--c-line); color: var(--c-navy); }
.v2-play .pg-back { color: var(--c-muted); }

/* the play screen: speech on white, captions on the night */
.v2-play .pg-say-t { background: #FFFFFF; color: var(--c-navy); font-family: var(--font); box-shadow: 0 12px 24px -14px rgba(16, 28, 48, .5), inset 0 0 0 1.5px var(--c-line); }
.v2-play .pg-say-t .nm { color: var(--c-hover); }
.v2-play .pg-say-tail { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 30' preserveAspectRatio='none'%3E%3Cpath d='M0 0L9.6 28.6Q11 31 12.4 28.6L22 0' fill='%23FFFFFF' stroke='%23E4DCCD' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E"); }
.v2-play .pg-cap-t { background: rgba(16, 28, 48, .9); color: var(--c-ivory); font-family: var(--font); }
.v2-play .pg-bub { background: #FFFFFF; box-shadow: 0 6px 14px -8px rgba(16, 28, 48, .45), inset 0 0 0 1.5px var(--c-line); }
.v2-play .pg-bub::after { background: #FFFFFF; box-shadow: 0 0 0 1.5px var(--c-line), 6px 10px 0 -2px #FFFFFF; }

/* the end: the thank-you card, the passport, keep/share */
.v2-play .pg-end { gap: 14px; padding-block-start: 32px; }
.v2-play .pg-end-h { font: 700 var(--fs-page)/1.35 var(--font); color: var(--c-navy); }
.v2-play .pg-end-line { font: 400 var(--fs-lead)/1.7 var(--font); color: var(--c-body); margin: 0; }
.v2-play .pg-card { background: #FFFFFF; border-radius: var(--radius-card); padding: 12px 12px 10px; box-shadow: var(--shadow), inset 0 0 0 1px var(--c-line); }
.v2-play .pg-card img { border-radius: var(--radius-img); }
.v2-play .pg-card-to { color: var(--c-navy); font-family: var(--font); }
.v2-play .pg-card-k { font: 700 18px/1.3 var(--font); color: var(--c-muted); }
/* pass 2 (CD): the passport is one navy booklet with a gold star (no chest), sitting on the ivory without a box behind it */
.v2-play .pg-box { border-radius: 12px; background: transparent; box-shadow: none; }
.v2-play .pg-box .pg-booklet { filter: drop-shadow(0 4px 6px rgba(16, 28, 48, .25)); }
.v2-play .pg-saved { color: var(--c-body); margin: 0; }
.v2-play .pg-end-acts .btn { border-radius: var(--radius-btn); }

/* the visitor message form (r3.css engine): a white card on her line, navy focus, no dashed gold */
.v2-play .vm { background: #FFFFFF; border: 1px solid var(--c-line); border-radius: var(--radius-card); width: 100%; max-width: 440px; }
/* fix round (CD fix 9): «إلى حامد / إلى عالم حامد» = the scene page's segmented control: one white container (1px line, 12 px radius),
   two equal halves, navy fill on the chosen side. The container is the fieldset's own ::after on the second grid row (legend above). */
.v2-play .vm-to { display: grid; grid-template-columns: 1fr 1fr; gap: 0; position: relative; isolation: isolate; margin-block-end: 12px; }
.v2-play .vm-to legend { float: inline-start; grid-column: 1 / -1; grid-row: 1; margin: 0 0 8px; color: var(--c-navy); font: 600 var(--fs-ui)/1.4 var(--font); }
.v2-play .vm-to::after { content: ""; grid-column: 1 / -1; grid-row: 2; z-index: -1; background: #FFFFFF; border: 1px solid var(--c-line); border-radius: var(--radius-btn, 12px); }
.v2-play .vm-to label { grid-row: 2; display: flex; margin: 4px; }
.v2-play .vm-to label:first-of-type { grid-column: 1; }
.v2-play .vm-to label:last-of-type { grid-column: 2; }
.v2-play .vm-to span { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 8px 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--c-navy); font: 600 var(--fs-ui)/1.3 var(--font); }
.v2-play .vm-to input:checked + span { border: 0; background: var(--c-navy); color: var(--c-ivory); font-weight: 700; }
.v2-play .vm-to input:focus-visible + span { outline-offset: 2px; }
.v2-play .vm-to input:focus-visible + span,.v2-play .vm textarea:focus-visible, .v2-play .vm input[name=name]:focus-visible { outline: 3px solid var(--c-hover); }
.v2-play .vm textarea, .v2-play .vm input[name=name] { border-color: var(--c-line); color: var(--c-navy); font-size: max(16px, 1rem); }
.v2-play .vm-send { border-radius: var(--radius-btn); }

/* keep your card: three child-sized buttons, icon above a word */
.pg-x { width: 100%; max-width: 440px; background: #FFFFFF; border: 1px solid var(--c-line); border-radius: var(--radius-card); padding: 16px; text-align: center; }
.pg-x-h { font: 600 var(--fs-kid)/1.4 var(--font); color: var(--c-navy); margin: 0 auto 12px; }
.pg-x-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pg-x-btn { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 84px; padding: 10px 6px; border-radius: var(--radius-btn);
  border: 2px solid var(--c-line); background: var(--c-ivory); color: var(--c-navy); font: 600 var(--fs-ui)/1.2 var(--font); cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out, transform 80ms ease-out; }
.pg-x-btn svg { width: 30px; height: 30px; }
.pg-x-btn:active { transform: translateY(1px); background: var(--c-sand); }
.pg-x-btn:focus-visible { outline: var(--focus); outline-offset: 3px; }
.pg-x-btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.pg-x-note { font-size: var(--fs-small); color: var(--c-muted); margin: 12px auto 0; }
.pg-x-st { font-size: var(--fs-small); color: var(--c-navy); font-weight: var(--w-ui); margin: 6px auto 0; min-height: 1.5em; }
.pg-x-st:empty { display: none; }
@media (hover: hover) and (pointer: fine) {
  .pg-x-btn:hover { border-color: var(--c-navy); background: #FFFFFF; }
  .v2-play .pg-look:hover .pg-look-arch { border-color: var(--c-navy); }
  .v2-play .pg-mute:hover { background: var(--c-sand); }
}

/* desktop: the night window around a phone-width stage; the story and the keys sit on the night in ivory type */
@media (min-width: 1024px) {
  .v2-play .pg { background: var(--c-night); }
  .v2-play .pg-info, .v2-play .pg-side { color: var(--c-ivory); }
  .v2-play .pg-info .kicker { color: var(--c-silver); }
  .v2-play .pg-info-h { color: var(--c-ivory); font: 700 var(--fs-hero)/1.3 var(--font); }
  .v2-play .pg-info p { color: #DCE1E8; }
  .v2-play .pg-side .pg-keys { background: rgba(250, 247, 240, .06); border-color: rgba(198, 204, 212, .3); }
  .v2-play .pg-side .pg-keys-h, .v2-play .pg-side .pg-keys dd { color: var(--c-ivory); }
  .v2-play .pg-side .pg-keys p { color: #DCE1E8; }
  .v2-play .pg-col { border-inline: 0; box-shadow: 0 0 0 1px rgba(198, 204, 212, .2); }
}
@media (prefers-reduced-motion: reduce) {
  .gm2--on, .pg-x-btn { transition: none; }
  .gm2--on:hover, .gm2--on:active { transform: none; }
}
