/* Learn & Play - game engine styles. Colours/font/radii match isathi's own theme
   (wp-content/themes/isathi-theme-3/assets/css/style.css :root block and .btn-custom-*),
   scoped under .games-scope so nothing here can bleed into the rest of isathi.com. */
.games-scope, .games-scope * { box-sizing: border-box; }
.games-scope {
  --ink: #233b78; --dark: #172754; --muted: #666666; --card: #ffffff;
  --tile: #eef4ff; --line: #e2e8f0; --accent: #f5bf24; --accent-light: #fff9e8;
  font-family: 'Poppins', sans-serif; color: var(--ink);
}
.games-scope .card {
  width: 100%; max-width: 480px; text-align: center; margin: 0 auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px;
  box-shadow: 0 12px 30px -14px rgba(35, 59, 120, 0.15);
}
.games-scope h1 { margin: 8px 0 4px; font-weight: 800; color: var(--ink); font-size: 1.5rem; }
.games-scope .sub { color: var(--muted); margin-bottom: 16px; }
.games-scope .hud { display: flex; justify-content: space-between; align-items: center; font-weight: 700; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.games-scope .timebar { height: 7px; border-radius: 999px; background: var(--tile); overflow: hidden; margin-bottom: 14px; }
.games-scope .timebar-fill { height: 100%; width: 100%; background: var(--ink); border-radius: 999px; transition: width .1s linear, background .2s; }
.games-scope .timebar-fill.danger { background: #ef4444; }
.games-scope .qcount { font-size: 13px; font-weight: 700; color: var(--muted); text-align: left; margin: 0 0 2px; }
.games-scope .swatch {
  height: 180px; border-radius: 16px; margin-bottom: 20px; display: flex; align-items: center;
  justify-content: center; font-size: 42px; font-weight: 800; border: 1px solid var(--line); color: var(--ink);
  background: var(--tile); transition: transform .15s; flex-wrap: wrap; text-align: center;
}
.games-scope .swatch.shake { animation: laf-shake .3s; }
@keyframes laf-shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.games-scope .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.games-scope .btn {
  padding: 14px; font-size: 18px; font-weight: 700; border-radius: 8px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; transition: all .15s;
}
.games-scope .btn:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-2px); }
.games-scope .btn:disabled { cursor: default; }
.games-scope .btn.ok { background: #d1fae5; border-color: #22c55e; color: #14532d; }
.games-scope .btn.bad { background: #ffe4e6; border-color: #f43f5e; color: #7f1d1d; }
.games-scope .btn.tile { display: flex; align-items: center; justify-content: center; min-height: 84px; padding: 8px; }
.games-scope .primary {
  background: var(--ink); color: #fff; border: 2px solid var(--ink); font-weight: 700; padding: 0.55rem 1.75rem; margin-top: 8px;
  box-shadow: 0 4px 12px rgba(35, 59, 120, 0.2); transition: all .18s;
}
.games-scope .primary:hover:not(:disabled) { background: var(--dark); border-color: var(--dark); transform: translateY(-2px); }
.games-scope .primary:disabled { opacity: .55; }
.games-scope .btn.small { font-size: 14px; padding: 8px 14px; margin-top: 16px; border-radius: 8px; }
.games-scope .hint { color: var(--muted); font-size: 14px; margin-bottom: 12px; text-align: left; }
.games-scope a.back { display: inline-block; color: var(--muted); margin-bottom: 8px; text-decoration: none; }

.games-scope .lvgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; margin: 6px 0 0; }
.games-scope .lvsection { margin-top: 14px; text-align: left; }
.games-scope .lvhead { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 700; }
.games-scope .lv {
  padding: 12px 0; border-radius: 8px; border: 1px solid var(--line);
  background: var(--tile); color: #93a4c7; font-weight: 700; cursor: not-allowed;
}
.games-scope .lv.open { border-color: transparent; cursor: pointer; }
.games-scope .lv.open.easy { background: #d1fae5; color: #14532d; }
.games-scope .lv.open.medium { background: #fef3c7; color: #78350f; }
.games-scope .lv.open.hard { background: #ffe4e6; color: #881337; }
.games-scope .lv.open:hover { transform: translateY(-3px) scale(1.05); }
.games-scope .tier { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; margin-right: 6px; }
.games-scope .tier.easy { background: #dcfce7; color: #166534; }
.games-scope .tier.medium { background: #fef3c7; color: #92400e; }
.games-scope .tier.hard { background: #ffe4e6; color: #9f1239; }

.games-scope .notice { background: var(--accent-light); border: 2px dashed var(--accent); border-radius: 12px; padding: 14px; margin: 16px 0; }
.games-scope .notice p { color: var(--muted); margin: 6px 0 12px; }

.games-scope .rate { margin-top: 22px; padding: 18px 16px; border-radius: 12px; text-align: center; background: var(--tile); border: 1px solid var(--line); }
.games-scope .rate.done { font-weight: 700; background: #dcfce7; border-color: #86efac; color: #166534; }
.games-scope .rate-title { margin: 0 0 8px; font-weight: 800; }
.games-scope .rate-stars { display: flex; justify-content: center; gap: 4px; }
.games-scope .rate-stars button { background: none; border: 0; cursor: pointer; font-size: 38px; line-height: 1; color: #c7d2e8; padding: 0 2px; }
.games-scope .rate-stars button.on { color: var(--accent); }

.games-scope .laf-modal-back { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(23, 39, 84, .45); overflow-y: auto; }
.games-scope .laf-modal { width: 100%; max-width: 440px; text-align: center; padding: 26px 20px; border-radius: 20px; background: #fff; border: 1px solid var(--line); position: relative; }
.games-scope .laf-modal h2 { margin: 0 0 6px; font-size: 24px; color: var(--ink); }
.games-scope .try-again { margin: 4px 6px 8px; padding: 8px 12px; border-radius: 14px; background: #ffe4e6; color: #9f1239; font-size: 14px; font-weight: 600; }
.games-scope .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.games-scope .stats div { background: rgba(255,255,255,.85); border: 1px solid var(--line); border-radius: 14px; padding: 8px 2px; }
.games-scope .stats b { display: block; font-size: 17px; }
.games-scope .stats small { color: var(--muted); font-size: 11px; }
.games-scope .laf-modal-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.games-scope .laf-modal-actions .primary { width: 100%; }
.games-scope .laf-modal-x { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(255,255,255,.8); }

.games-scope .gloader { padding: 18px 4px 6px; text-align: center; }
.games-scope .gloader-row { font-size: 38px; margin-bottom: 6px; }
.games-scope .laf-empty { text-align: center; color: var(--muted); padding: 2rem; }

/* category grid (/learn-play/) and the games-within-a-class grid (?class_id=N): bright,
   bouncy tiles rather than a flat corporate card - this is a kids' game catalog, not a
   careers listing. Each tile gets its own colour via the --c custom property (set inline
   per tile in is_learn_play.php), used for the icon ring, the "Play" pill and a chunky
   3D drop-shadow edge. */
.games-scope .card.wide { max-width: 1020px; }
.games-scope .laf-fungrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.games-scope .laf-fungrid-cat { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

.games-scope .laf-funtile {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: 20px 14px 18px; border-radius: 24px; text-decoration: none;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, white) 0%, color-mix(in srgb, var(--c) 6%, white) 100%);
  border: 2px solid color-mix(in srgb, var(--c) 32%, white);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 45%, white), 0 14px 22px -14px rgba(35, 59, 120, .35);
  animation: laf-pop .45s cubic-bezier(.34, 1.56, .64, 1) backwards;
  animation-delay: calc(var(--d, 0) * 45ms);
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
}
@keyframes laf-pop { from { opacity: 0; transform: translateY(14px) scale(.85); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .games-scope .laf-funtile { animation: none; } }
.games-scope .laf-funtile:hover {
  transform: translateY(-5px) scale(1.04) rotate(-1deg);
  box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 45%, white), 0 18px 28px -14px rgba(35, 59, 120, .4);
}
.games-scope .laf-funtile-ico {
  width: 62px; height: 62px; display: grid; place-items: center; font-size: 32px; border-radius: 50%;
  background: #fff; box-shadow: 0 4px 10px -2px rgba(35, 59, 120, .25), inset 0 0 0 3px color-mix(in srgb, var(--c) 55%, white);
  transition: transform .25s;
}
.games-scope .laf-funtile:hover .laf-funtile-ico { transform: scale(1.12) rotate(-8deg); }
.games-scope .laf-funtile-name { font-weight: 800; font-size: 15px; color: var(--ink); line-height: 1.25; }
.games-scope .laf-funtile-desc { font-size: 12px; color: var(--muted); line-height: 1.3; min-height: 28px; }
.games-scope .laf-funtile-play, .games-scope .laf-funtile-badge {
  margin-top: 4px; padding: 7px 18px; border-radius: 999px; background: var(--c); color: #fff;
  font-weight: 800; font-size: 13px; letter-spacing: .2px; white-space: nowrap;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 70%, black);
  transition: transform .15s;
}
.games-scope .laf-funtile:hover .laf-funtile-play, .games-scope .laf-funtile:hover .laf-funtile-badge { transform: scale(1.06); }

.games-scope .ghead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.games-scope .ghead-left { text-align: left; min-width: 0; }
.games-scope .ghead-left .back { margin-bottom: 2px; }
.games-scope .ghead-left h1 { margin: 0 0 2px; font-size: 26px; text-align: left; }
.games-scope .ghead-left .sub { margin: 0; }
.games-scope .ghead-right { flex-shrink: 0; }
.games-scope .ghead-right .btn.small { margin-top: 0; white-space: nowrap; }
/* phones: title on the left, button on the right (same row), description full width below */
@media (max-width: 600px) {
  .games-scope .ghead { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
  .games-scope .ghead-left { display: contents; }
  .games-scope .ghead-left .back { grid-column: 1 / -1; grid-row: 1; }
  .games-scope .ghead-left h1 { grid-column: 1; grid-row: 2; }
  .games-scope .ghead-right { grid-column: 2; grid-row: 2; }
  .games-scope .ghead-left .sub { grid-column: 1 / -1; grid-row: 3; margin-top: 8px; }
}
@media (max-width: 420px) {
  .games-scope .ghead-left h1 { font-size: 21px; }
  .games-scope .ghead-right .btn.small { font-size: 12px; padding: 7px 10px; }
}

/* right-hand sidebar: .term_content/.course_ent are isathi's own shared sidebar classes
   (wp-content/themes/isathi-theme-3/style.css), reused as-is - only the sticky positioning
   on this page is ours, scoped here rather than in the shared stylesheet. */
.col-lg-3 .term_content { position: sticky; top: 20px; }
@media (max-width: 991px) { .col-lg-3 .term_content { position: static; } }

/* ---- Learn & Play report (is_learn_play_report.php) ---- */
.games-scope .laf-rep-stats { margin-bottom: 8px; grid-template-columns: repeat(4, minmax(0, 190px)); justify-content: center; }
@media (max-width: 767px) { .games-scope .laf-rep-stats { grid-template-columns: repeat(2, minmax(0, 190px)); } }
.games-scope .laf-rep-stat { cursor: default; }
.games-scope .laf-rep-h { font-size: 17px; font-weight: 800; color: var(--ink); margin: 22px 0 10px; text-align: left; }
.games-scope .laf-rep-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.games-scope .laf-rep-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
.games-scope .laf-rep-table th { background: var(--tile); color: var(--ink); font-weight: 800; padding: 10px 12px; white-space: nowrap; }
.games-scope .laf-rep-table td { padding: 10px 12px; border-top: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.games-scope .laf-rep-table td strong { color: var(--ink); }
.games-scope .laf-rep-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.games-scope .laf-rep-badge.ok { background: #d1fae5; color: #14532d; }
.games-scope .laf-rep-badge.retry { background: #ffe4e6; color: #881337; }

/* links under an in-game card (play.js navLinks) */
.games-scope .laf-navlinks { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; max-width: 480px; margin: 14px auto 0; }
.games-scope .laf-navlinks .btn.small { margin-top: 0; text-decoration: none; }
.games-scope .laf-modal-actions .btn.small { text-decoration: none; }
.games-scope .hint.qprompt { font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.35; margin-bottom: 14px; }
@media (max-width: 480px) { .games-scope .hint.qprompt { font-size: 18px; } }
