:root {
  /* 3055 ED Games brand: navy + cyan-to-blue gradient */
  --ink: #f4f9ff;
  --deep: #0f172a;
  --b1: #0aadd6;
  --b2: #216be8;
  --accent: #38c6f4;
  --accent2: #7fd3ff;
  --grad: linear-gradient(135deg, #0aadd6, #216be8);
  --glass: rgba(15, 23, 42, 0.6);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fc7e8; color: var(--ink); font-family: 'Fredoka', system-ui, sans-serif; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* loader */
#loader {
  position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; gap: 18px; text-align: center;
  background: radial-gradient(circle at 50% 38%, #163a6b 0%, #0f1f3d 38%, #0f172a 75%);
  transition: opacity 0.8s ease;
}
#loader.done { opacity: 0; pointer-events: none; }
.ld-title { font-family: Montserrat, system-ui, sans-serif; font-size: clamp(20px, 4vw, 30px); font-weight: 700; letter-spacing: 0.5px; }
.ld-logo { width: min(220px, 46vw); margin: 0 auto 6px; position: relative; }
.ld-logo img { width: 100%; display: block; filter: drop-shadow(0 0 28px rgba(10, 173, 214, 0.55)); animation: ldpulse 2.4s ease-in-out infinite; }
@keyframes ldpulse { 50% { filter: drop-shadow(0 0 46px rgba(33, 107, 232, 0.85)); transform: translateY(-4px); } }
.st-logo { width: 78px; display: block; margin: 0 auto 10px; filter: drop-shadow(0 0 18px rgba(10, 173, 214, 0.6)); }
.ld-title span, h1 span { color: var(--accent); }
.ld-bar { width: min(320px, 70vw); height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.25); overflow: hidden; margin: 0 auto; }
.ld-bar i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 99px; transition: width 0.3s ease; }
.ld-text { font-size: 15px; opacity: 0.85; }

/* start */
#start {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0) 30%, rgba(15, 23, 42, 0.6));
}
.st-card {
  width: min(520px, 100%); padding: 32px; border-radius: 28px; text-align: center;
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(8, 15, 35, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.st-eyebrow { font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent2); }
h1 { margin: 8px 0 10px; font-family: Montserrat, system-ui, sans-serif; font-size: clamp(30px, 6vw, 46px); line-height: 1.05; font-weight: 800; letter-spacing: -1px; }
.st-card p { margin: 0 0 24px; font-size: 16px; line-height: 1.5; opacity: 0.9; }
#play {
  font: inherit; font-size: 18px; font-weight: 600; color: #fff; background: var(--grad);
  border: 0; border-radius: 99px; padding: 14px 34px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(10, 173, 214, 0.45); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#play:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(33, 107, 232, 0.6); }
.st-quality { margin-top: 20px; font-size: 13px; opacity: 0.85; display: flex; gap: 6px; justify-content: center; align-items: center; }
.st-quality button { font: inherit; font-size: 13px; color: var(--ink); background: rgba(255, 255, 255, 0.1); border: 0; border-radius: 99px; padding: 5px 12px; cursor: pointer; }
.st-quality button.on { background: var(--ink); color: var(--deep); }

/* hud */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#prompt {
  position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%);
  font-size: 17px; font-weight: 500; padding: 10px 18px; border-radius: 99px; background: var(--glass); backdrop-filter: blur(8px);
  transition: opacity 0.2s ease;
}
#prompt:empty { opacity: 0; }
#prompt b { display: inline-grid; place-items: center; min-width: 26px; height: 26px; margin-right: 8px; border-radius: 8px; background: var(--ink); color: var(--deep); font-weight: 700; }
#bubble {
  position: absolute; transform: translate(-50%, -100%); max-width: 260px; padding: 10px 14px; border-radius: 16px;
  background: var(--ink); color: var(--deep); font-size: 15px; line-height: 1.35; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
#bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: var(--ink); }
#speed { position: absolute; right: 24px; bottom: 22px; font-size: 40px; font-weight: 700; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3); }
#speed small { font-size: 16px; font-weight: 500; opacity: 0.8; }
#toast {
  position: absolute; left: 50%; top: 14%; transform: translate(-50%, -10px); text-align: center;
  font-size: 22px; font-weight: 600; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast small { display: block; font-size: 15px; font-weight: 400; opacity: 0.9; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: rgba(255, 255, 255, 0.8); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15); }
#keys { position: absolute; left: 20px; bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px 14px; max-width: 420px; font-size: 13px; opacity: 0.85; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }
#keys b { font-weight: 600; color: var(--accent); }

/* content panel */
#panel { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(4px); }
.pn-card {
  position: relative; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 24px;
  background: rgba(15, 23, 42, 0.94); box-shadow: 0 24px 70px rgba(5, 10, 25, 0.55), inset 0 0 0 1px rgba(56, 198, 244, 0.18);
}
.pn-close { position: absolute; right: 14px; top: 14px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; font: inherit; font-size: 18px; background: rgba(255, 255, 255, 0.9); color: var(--deep); }
.pn-media { aspect-ratio: 16 / 9; background: #000; border-radius: 24px 24px 0 0; overflow: hidden; }
.pn-media img, .pn-media iframe, .pn-media video { width: 100%; height: 100%; display: block; object-fit: cover; border: 0; }
.pn-body { padding: 24px 28px 26px; }
.pn-eyebrow { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent2); }
.pn-body h2 { margin: 6px 0 6px; font-family: Montserrat, system-ui, sans-serif; font-weight: 800; font-size: 28px; line-height: 1.15; }
.pn-tag { color: var(--accent); margin: 0 0 12px; }
.pn-desc p { margin: 0 0 12px; line-height: 1.55; opacity: 0.92; }
.pn-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.pn-btn { text-decoration: none; color: #fff; background: var(--grad); padding: 10px 18px; border-radius: 99px; font-weight: 600; }
.pn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.pn-list button { font: inherit; text-align: left; color: var(--ink); background: rgba(255, 255, 255, 0.08); border: 0; border-radius: 14px; padding: 12px 14px; cursor: pointer; }
.pn-list button:hover { background: rgba(255, 255, 255, 0.16); }
.pn-list small { display: block; opacity: 0.7; margin-top: 2px; }
.pn-dialog { font-size: 18px; line-height: 1.5; margin: 6px 0 16px; }
.pn-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pn-actions button { font: inherit; font-weight: 600; border: 0; border-radius: 99px; padding: 10px 18px; cursor: pointer; background: rgba(255, 255, 255, 0.12); color: var(--ink); }
.pn-actions button.main { background: var(--grad); color: #fff; }
@media (max-width: 640px) { #keys { display: none; } .pn-body { padding: 18px; } }
#explore { position: absolute; left: 20px; top: 18px; font-size: 16px; padding: 8px 14px; border-radius: 99px; background: var(--glass); backdrop-filter: blur(8px); }
#explore:empty { display: none; }
#rush { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); font-size: 18px; font-weight: 600; padding: 8px 16px; border-radius: 99px; background: var(--glass); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 2px rgba(255, 79, 94, 0.6); white-space: nowrap; }
#rush:empty { display: none; }
#rush b { color: #ff7a85; font-size: 22px; }
#rush span { margin-left: 10px; font-variant-numeric: tabular-nums; }
#rush.late span { color: #ff7a85; animation: rushlate 0.6s ease-in-out infinite alternate; }
@keyframes rushlate { to { opacity: 0.45; } }
.touch #rush { top: max(66px, calc(env(safe-area-inset-top) + 56px)); font-size: 15px; }
#explore b { color: var(--accent); font-size: 20px; }

/* touch devices */
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
.touch #keys { display: none; }
.touch #prompt { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); }
.touch #explore { font-size: 13px; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); }
.touch #speed { right: auto; left: 20px; bottom: 20px; font-size: 30px; }
.touch #panel, .touch .pn-card { touch-action: pan-y; }
.touch .pn-card { -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) { .st-card { padding: 24px 20px; } .st-card p { font-size: 15px; } }

/* guide marker */
#guide { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; --c: #38c6f4; transition: opacity .2s; }
#guide .g-arrow { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--c); color: #0f172a; font-size: 15px; box-shadow: 0 0 0 3px rgba(255,255,255,.85), 0 6px 18px rgba(0,0,0,.25); animation: gpulse 1.4s ease-in-out infinite; }
#guide .g-label { text-align: center; padding: 5px 10px; border-radius: 12px; background: var(--glass); backdrop-filter: blur(6px); line-height: 1.25; white-space: nowrap; }
#guide .g-label b { display: block; font-size: 14px; color: var(--c); }
#guide .g-label span { font-size: 12px; opacity: .9; }
@keyframes gpulse { 50% { box-shadow: 0 0 0 6px rgba(255,255,255,.5), 0 6px 18px rgba(0,0,0,.25); } }

/* contact */
.pn-ask { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding: 14px 16px; border-radius: 16px; background: rgba(10, 173, 214, 0.12); box-shadow: inset 0 0 0 1px rgba(56, 198, 244, 0.3); }
.pn-ask span { opacity: .9; }
.pn-ask button, .ct-mail button { font: inherit; font-weight: 600; color: #fff; background: var(--grad); border: 0; border-radius: 99px; padding: 9px 16px; cursor: pointer; }
.ct-mail { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 4px; padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.06); }
.ct-addr { flex: 1; min-width: 220px; font-family: Montserrat, system-ui, sans-serif; font-weight: 700; font-size: clamp(16px, 3.4vw, 22px); color: var(--accent); text-decoration: none; word-break: break-all; }
.ct-h { margin: 18px 0 8px; font-size: 15px; font-weight: 600; opacity: .9; }
.ct-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ct-chips button { font: inherit; font-size: 14px; color: var(--ink); background: rgba(255, 255, 255, 0.08); border: 0; border-radius: 99px; padding: 8px 14px; cursor: pointer; }
.ct-chips button.on { background: var(--grad); color: #fff; }
.ct-row { display: flex; gap: 10px; margin-bottom: 10px; }
.pn-contact input, .pn-contact textarea { flex: 1; width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: rgba(255, 255, 255, 0.07); border: 0; border-radius: 12px; padding: 11px 13px; outline: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); margin-bottom: 12px; user-select: text; -webkit-user-select: text; touch-action: auto; }
.pn-contact input:focus, .pn-contact textarea:focus { box-shadow: inset 0 0 0 2px var(--b1); }
.pn-contact textarea { resize: vertical; min-height: 90px; }
.ct-note { font-size: 12px; opacity: .65; margin: 12px 0 0; }
@media (max-width: 520px) { .ct-row { flex-direction: column; gap: 0; } }

/* always-visible contact button */
#contactBtn { position: absolute; right: 20px; top: 18px; pointer-events: auto; font: inherit; font-weight: 600; font-size: 15px; color: #fff; background: var(--grad); border: 0; border-radius: 99px; padding: 10px 18px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(10, 173, 214, 0.45); animation: ctpulse 3s ease-in-out infinite; }
#contactBtn:hover { transform: translateY(-1px); }
@keyframes ctpulse { 0%, 80%, 100% { box-shadow: 0 6px 20px rgba(10, 173, 214, 0.45); } 90% { box-shadow: 0 0 0 8px rgba(56, 198, 244, 0.25), 0 6px 20px rgba(10, 173, 214, 0.45); } }
.touch #contactBtn { display: none; }
.ct-form > input { display: block; }
.ct-err { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 90, 95, 0.14); color: #ffb3b6; font-size: 14px; }
.ct-done { text-align: center; padding: 10px 0 6px; }
.ct-done h3 { margin: 10px 0 6px; font-family: Montserrat, system-ui, sans-serif; font-size: 20px; }
.ct-done p { opacity: .9; margin: 0 0 16px; }
.ct-ok { width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--grad); font-size: 32px; font-weight: 700; box-shadow: 0 8px 26px rgba(10, 173, 214, 0.5); animation: ctpop .5s ease-out; }
@keyframes ctpop { 0% { transform: scale(0.3); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.ct-mail span { opacity: .75; font-size: 14px; }
.pn-actions button:disabled { opacity: .6; cursor: default; }

/* ---- Learning Game Design Island panels ---- */
.pn-card.wide { width: min(1180px, 100%); height: calc(100vh - 32px); max-height: none; display: flex; flex-direction: column; overflow: hidden; }
.em-head { display: flex; align-items: center; gap: 14px; padding: 12px 70px 12px 14px; }
.em-title { flex: 1; min-width: 0; }
.em-title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-back { flex: none; font: inherit; font-weight: 700; font-size: 15px; color: #fff; background: var(--grad); border: 0; border-radius: 99px; padding: 10px 18px; cursor: pointer; box-shadow: 0 4px 14px rgba(10, 173, 214, 0.35); }
.em-back:hover { filter: brightness(1.1); }
.em-head b { font-family: Montserrat, system-ui, sans-serif; font-size: 18px; }
.em-out { color: var(--accent2); font-size: 14px; white-space: nowrap; text-decoration: none; }
.em-frame { position: relative; flex: 1; margin: 0 12px 12px; border-radius: 16px; overflow: hidden; background: #0b1631; }
.em-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.em-load { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent2); }
.cr h3 { font-family: Montserrat, system-ui, sans-serif; font-size: 16px; margin: 20px 0 8px; color: var(--accent2); }
.cr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-chips span { padding: 6px 12px; border-radius: 99px; background: rgba(56, 198, 244, 0.14); font-size: 14px; }
.cr-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cr-steps button { display: grid; grid-template-columns: 34px 1fr; align-items: center; column-gap: 10px; text-align: left; font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.07); border: 0; border-left: 4px solid var(--c); border-radius: 14px; padding: 10px 12px; cursor: pointer; }
.cr-steps i { grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; background: var(--c); color: #0f172a; }
.cr-steps small { opacity: 0.75; font-size: 12px; }
.cr-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.cr-grid ul { margin: 0; padding-left: 18px; line-height: 1.7; }
.cr-price { margin-top: 20px; padding: 18px; border-radius: 18px; background: linear-gradient(160deg, rgba(10, 173, 214, 0.22), rgba(33, 107, 232, 0.22)); box-shadow: inset 0 0 0 1px rgba(127, 211, 255, 0.3); display: flex; flex-direction: column; gap: 6px; }
.cr-price small { text-transform: uppercase; letter-spacing: 2px; font-size: 11px; color: var(--accent2); }
.cr-price s { opacity: 0.6; }
.cr-price b { font-family: Montserrat, system-ui, sans-serif; font-size: 32px; }
.cr-price p { margin: 0 0 8px; font-size: 14px; opacity: 0.85; }
.cr-price button { font: inherit; font-weight: 600; padding: 11px 16px; border-radius: 99px; border: 0; cursor: pointer; color: #fff; background: rgba(255, 255, 255, 0.12); }
.cr-price button.main { background: var(--grad); }
.cr details { background: rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.cr summary { cursor: pointer; font-weight: 600; }
.cr details p { margin: 8px 0 0; opacity: 0.88; }
.cr-next { opacity: 0.85; }
@media (max-width: 640px) { .cr-grid { grid-template-columns: 1fr; } .pn-card.wide { height: calc(100vh - 20px); } .em-head { padding-right: 60px; } .em-out, .em-title .pn-eyebrow { display: none; } }
#warp { position: fixed; inset: 0; z-index: 30; pointer-events: none; opacity: 0; transition: opacity 0.35s ease;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #bff4ff 30%, #4a7dff 70%, #1b1f5c 100%); }
#warp.on { opacity: 1; transition: opacity 0.3s ease; }
.cr-fin { display: grid; grid-template-columns: 34px 1fr; align-items: center; column-gap: 10px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(135deg, rgba(255, 207, 92, 0.2), rgba(255, 138, 92, 0.16)); border-left: 4px solid #ffcf5c; }
.cr-fin i { grid-row: span 2; font-style: normal; font-size: 22px; text-align: center; }
.cr-fin small { opacity: 0.8; font-size: 12px; }
#underwater { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity 0.25s;
  background: radial-gradient(ellipse at 50% 30%, rgba(80, 200, 255, 0.18), rgba(8, 60, 110, 0.62) 80%); mix-blend-mode: normal; }
#underwater.on { opacity: 1; }
.egg-ico { font-size: 54px; line-height: 1; margin-bottom: 6px; filter: drop-shadow(0 0 18px rgba(255, 207, 92, 0.7)); }
.egg-small { opacity: 0.65; font-size: 13px; margin-top: 14px; }
