/* ============================================================
   Edupotion showcase — game box + collapsible info sidebar.
   Top bar holds the Landscape/Portrait + Info(sidebar) toggles.
   Fills the viewport, no page scroll.
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:#49a832; --green-deep:#438831; --green-dark:#3f8c2e;
  --ink:#21331d; --ink-soft:#52704c; --card:#ffffff;
  --font:"Nunito", sans-serif; --display:"Baloo 2", cursive;
}

html, body { height: 100%; }
body {
  font-family: var(--font); color: var(--ink);
  background: linear-gradient(180deg, #bceeff 0%, #e8fff0 70%);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
svg { display: block; }

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px clamp(12px, 2vw, 22px);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(43, 106, 31, 0.08);
  flex-shrink: 0;
}
.brand-logo { height: 30px; width: auto; display: block; }
@media (max-width: 480px) { .brand-logo { height: 24px; } }
.brand__mark {
  width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 11px; background: #e7f8df; color: var(--green-deep);
}
.brand__mark svg { width: 20px; height: 20px; }
.brand__name { font-family: var(--display); font-weight: 800; font-size: 19px; color: var(--green-deep); }
.brand__pill { font-size: 11px; font-weight: 800; color: var(--green-deep); background: #eaf8e2; padding: 4px 10px; border-radius: 999px; }
.brand__pill::first-letter { color: #36c45a; }
.spacer { flex: 1; }
.whoami { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--green-deep); background: #eaf8e2; padding: 5px 11px; border-radius: 999px; }
.whoami svg { opacity: 0.8; }
.ctrl {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; cursor: pointer;
  font-family: var(--display); font-weight: 800; font-size: 14px; color: var(--ink);
  background: #fff; padding: 8px 14px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.ctrl:hover { transform: translateY(-1px); }
.ctrl:active { transform: scale(0.97); }
.ctrl[aria-pressed="true"] { background: #eaf8e2; color: var(--green-deep); }
/* Report: white + faded until there's data, then green + clickable */
.ctrl--report:disabled { opacity: 0.5; cursor: not-allowed; }
.ctrl--report.active { background: linear-gradient(135deg, #7bc84c, #49a832); color: #fff; }
.ctrl--report.active:hover { filter: brightness(1.04); }

/* ---- Learning report overlay (opens in place) ---- */
.report-ov {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; background: #f3fbff;
}
.report-ov[hidden] { display: none; }
.report-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px clamp(14px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(43, 106, 31, 0.08); flex-shrink: 0;
}
.report-head__title { font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--green-deep); }
.report-close {
  border: none; cursor: pointer; font-family: var(--display); font-weight: 800; font-size: 14px;
  color: var(--ink); background: #fff; padding: 8px 16px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.report-close:hover { color: var(--bad, #c62828); }
.report-ov iframe { flex: 1; width: 100%; border: 0; }

/* ---- Body: guide (left) + stage + sidebar (right) ---- */
.body {
  position: relative;
  overflow: hidden;
  flex: 1; min-height: 0;
  display: flex;                   /* single column — the game fills the whole area */
}
.app.sidebar-closed .body { grid-template-columns: minmax(0, 300px) 1fr 0; }
.app.guide-closed .body { grid-template-columns: 0 1fr minmax(300px, 360px); }
.app.guide-closed.sidebar-closed .body { grid-template-columns: 0 1fr 0; }
.app.sidebar-closed .sidebar { opacity: 0; pointer-events: none; }
.app.guide-closed .guide { opacity: 0; pointer-events: none; }

/* ---- Left: "How to use the demo" walkthrough timeline ---- */
.guide {
  position: relative;
  height: 100%; overflow-y: auto; overflow-x: hidden;
  padding: clamp(18px, 3vh, 30px) clamp(14px, 1.2vw, 22px);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  border-right: 1px solid rgba(67, 136, 49, 0.12);
  display: flex; flex-direction: column;
  scrollbar-width: none;
  transition: opacity 0.2s ease;
}
.guide::-webkit-scrollbar { width: 0; }
.guide-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border: none; cursor: pointer;
  border-radius: 50%; background: #fff; color: var(--ink-soft);
  font-size: 14px; font-weight: 800; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}
.guide-close:hover { color: var(--ink); }
.guide__title { font-family: var(--display); font-weight: 800; font-size: clamp(15px, 2vh, 19px); color: var(--green-dark); margin-bottom: clamp(14px, 2.2vh, 22px); padding-right: 30px; }
.timeline { list-style: none; position: relative; display: grid; gap: clamp(15px, 2.4vh, 26px); }
.timeline::before { content: ""; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(#7bc84c, #d6efc7); }
.timeline li { position: relative; display: flex; gap: 13px; align-items: flex-start; }
.tl__dot {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; z-index: 1;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #7bc84c, #49a832); color: #fff;
  font-family: var(--display); font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 10px rgba(73, 168, 50, 0.35);
}
.tl__txt { display: flex; flex-direction: column; line-height: 1.25; padding-top: 3px; }
.tl__txt strong { font-family: var(--display); font-size: 15px; color: var(--ink); }
.tl__txt span { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-top: 2px; }
.tl__txt em { font-style: normal; font-weight: 800; color: var(--green-deep); }
.guide__hint { margin-top: auto; padding-top: 16px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }

/* ---- Skeleton loader over the game while the iframe boots ---- */
.skeleton {
  position: absolute; inset: 0; z-index: 5;
  background: #eef6ff; padding: 14px;
  display: flex; flex-direction: column; gap: 14px;
  transition: opacity 0.45s ease;
}
.skeleton.done { opacity: 0; pointer-events: none; }
.sk { background: #d9e7f4; border-radius: 12px; position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk--topbar { height: 48px; border-radius: 14px; }
.sk--hero { height: 36%; border-radius: 16px; }
.sk-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sk--tile { border-radius: 14px; }

/* ---- Stage + game box (no device frame — the game fills the area) ---- */
.stage {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(10px, 2vmin, 26px);
}
.gamebox {
  position: relative;
  height: 100%;
  aspect-ratio: 122 / 82;          /* centered landscape box (no tablet frame) */
  max-width: 100%; max-height: 100%;
  border-radius: clamp(18px, 2.6vmin, 30px);
  overflow: hidden; background: #bceeff;
  box-shadow: 0 18px 50px rgba(33, 51, 29, 0.22);
}
.gamebox iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---- Sidebar ---- */
.sidebar {
  position: relative;
  height: 100%; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: clamp(10px, 1.6vh, 16px);
  padding: clamp(16px, 2.2vh, 26px) clamp(16px, 1.4vw, 24px);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(67, 136, 49, 0.12);
  transition: opacity 0.2s ease;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { width: 0; }
.side-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border: none; cursor: pointer;
  border-radius: 50%; background: #fff; color: var(--ink-soft);
  font-size: 14px; font-weight: 800; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}
.side-close:hover { color: var(--ink); }

.lead { padding-right: 30px; }
.lead h1 { font-family: var(--display); font-weight: 800; font-size: clamp(20px, 2.4vh, 26px); line-height: 1.05; color: var(--green-dark); }
.lead p { margin-top: 4px; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }

.card { background: var(--card); border-radius: 18px; padding: clamp(12px, 1.8vh, 18px) clamp(14px, 1.4vw, 18px); box-shadow: 0 10px 26px rgba(49, 94, 42, 0.1); }
.card h2 { font-family: var(--display); font-size: clamp(15px, 1.9vh, 18px); color: var(--green-dark); margin-bottom: clamp(8px, 1.2vh, 12px); }
.features { list-style: none; display: grid; gap: clamp(8px, 1.2vh, 12px); }
.features li { display: flex; align-items: center; gap: 11px; }
.ico { flex-shrink: 0; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); }
.ico svg { width: 60%; height: 60%; }
.features li div { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.features li strong { font-family: var(--display); font-size: 14.5px; color: var(--ink); }
.features li span:not(.ico) { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }

.foot { font-size: 12px; font-weight: 700; color: var(--ink-soft); opacity: 0.85; text-align: center; }
.foot strong { color: var(--green-deep); }

/* ---- Medium screens: the left guide becomes a slide-in drawer (so it still
   works at every size) instead of reserving a column. ---- */
@media (max-width: 1080px) {
  .body,
  .app.guide-closed .body { grid-template-columns: 1fr minmax(300px, 360px); }
  .app.sidebar-closed .body,
  .app.guide-closed.sidebar-closed .body { grid-template-columns: 1fr 0; }
  .guide {
    position: absolute; top: 0; left: 0; bottom: 0;
    width: min(330px, 86vw); z-index: 21;
    transform: translateX(0); opacity: 1; pointer-events: auto;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.18);
    transition: transform 0.28s ease;
  }
  .app.guide-closed .guide { transform: translateX(-100%); opacity: 1; pointer-events: none; }
}

/* ---- Compact top bar: collapse control labels to icons so it never overflows ---- */
@media (max-width: 900px) {
  .ctrl span { display: none; }
  .ctrl { padding: 9px 11px; gap: 0; }
}
@media (max-width: 560px) {
  .topbar { gap: 7px; padding: 8px 10px; }
  .brand__pill { display: none; }
  .whoami span { display: none; }
  .whoami { padding: 7px 9px; }
}
@media (max-width: 480px) {
  .brand__name { display: none; }   /* keep just the logo mark on phones */
  .topbar { gap: 6px; }
}

/* ---- Small screens: sidebar overlays the game instead of squashing it ---- */
@media (max-width: 720px) {
  .body,
  .app.guide-closed .body,
  .app.sidebar-closed .body,
  .app.guide-closed.sidebar-closed .body { grid-template-columns: 1fr; }
  .sidebar {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: min(330px, 86vw); z-index: 20;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.18);
    background: rgba(255, 255, 255, 0.96);
  }
  .app:not(.sidebar-closed) .sidebar { transform: translateX(0); }
  .app.sidebar-closed .sidebar { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) { *, *::after { transition: none !important; animation: none !important; } }
