@font-face { font-family: "Pacifico"; src: url(fonts/Pacifico.ttf); }
@font-face { font-family: "Poppins"; font-weight: 800; src: url(fonts/Poppins-ExtraBold.ttf); }
@font-face { font-family: "Poppins"; font-weight: 500; src: url(fonts/Poppins-Medium.ttf); }

:root {
  --navy: #1B1D2A; --codebg: #15161A; --bar: #101119; --line: #2A2D40;
  --orange: #D85A30; --text: #E9E9F2; --muted: #8C8FA8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bar); color: var(--text);
  font-family: "Poppins", system-ui, sans-serif; font-weight: 500; overflow: hidden; }
body { display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
#topbar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px;
  background: var(--bar); border-bottom: 1px solid var(--line); flex: none; }
.logo { font-family: "Pacifico", cursive; font-size: 24px; color: #fff; margin-right: 18px; }
.tab { background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 8px;
  padding: 7px 14px 9px; font: inherit; font-size: 14px; cursor: pointer; position: relative; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-color: #3A3D55; }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 3px; border-radius: 2px; background: var(--orange); }
.spacer { flex: 1; }

/* every real button: lifts on hover, sinks on press */
.btn { font: inherit; font-size: 14px; border: 0; border-radius: 9px; padding: 8px 14px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.35); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn.ghost { background: #23263A; color: var(--text); }
.btn.orange { background: var(--orange); color: #fff; font-weight: 800; }
.btn.run { background: #2DB52D; color: #fff; font-weight: 800; }
.btn.run:disabled { background: #3A3C4A; color: #8C8FA8; cursor: not-allowed; }
.btn.chunk { background: #3B1F99; color: #fff; font-weight: 800; }

/* ---------- location bar ---------- */
#locbar { display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 18px;
  font-size: 13px; color: var(--muted); background: #14151F; border-bottom: 1px solid var(--line); flex: none; }
#location { color: #CFC6FF; }
#runHint { font-size: 12px; }

/* ---------- work area ---------- */
#work { flex: 1; display: flex; min-height: 0; }
#blocklyArea { flex: 1; position: relative; min-width: 0; }
#blocklyDiv { position: absolute; inset: 0; }
#addChunk { position: absolute; top: 14px; right: 18px; z-index: 5; }

#codePane { width: 38%; max-width: 560px; min-width: 320px; background: var(--codebg);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; transition: width .2s; }
#codePane.folded { width: 44px; min-width: 44px; }
#codePane.folded pre, #codePane.folded .dots, #codePane.folded .codeTitle { display: none; }
.codeHead { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px 0 14px;
  border-bottom: 1px solid #22232A; flex: none; }
.dots { display: flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #FF5F57; }
.dots i:nth-child(2) { background: #FEBC2E; } .dots i:nth-child(3) { background: #28C840; }
.codeTitle { font-size: 12px; color: var(--muted); flex: 1; }
.iconbtn { background: transparent; border: 0; color: var(--muted); font-size: 15px; cursor: pointer;
  border-radius: 6px; padding: 3px 7px; }
.iconbtn:hover { background: #2A2C38; color: #fff; }

#code { flex: 1; margin: 0; overflow: auto; padding: 12px 0; font: 13px/1.6 "SF Mono", Menlo, Consolas, monospace;
  color: #D7D9E0; counter-reset: ln; }
#code .ln { display: block; padding: 0 16px 0 0; white-space: pre; }
#code .ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 38px;
  margin-right: 14px; text-align: right; color: #4A4D5C; }
.k { color: #FF7AB6; } .f { color: #7CC8FF; } .s { color: #A8E07A; } .n { color: #FFC66D; }
.c { color: #6E7390; font-style: italic; } .b { color: #C6A8FF; }

/* ---------- goal window ---------- */
.floatwin { position: fixed; z-index: 50; background: #1F2131; border: 1px solid #3A3D55; border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5); overflow: hidden; }
.floatwin.hidden { display: none; }
.floathead { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 12px;
  font-size: 13px; cursor: move; background: #262940; user-select: none; }
#goalWin { right: 30px; bottom: 30px; width: 262px; }
#goalBox { width: 260px; height: 260px; background: #000; overflow: hidden; }
#goalCanvas { width: 440px; height: 440px; transform: scale(0.591); transform-origin: 0 0; }
#goalText { font-size: 12px; color: var(--muted); padding: 8px 12px 10px; }

/* ---------- Blockly tweaks ---------- */
.blocklyFlyoutBackground { fill: #20223A !important; fill-opacity: 1 !important; }
.blocklyMainBackground { stroke: none !important; }
/* dark text on light blocks (direct children only, so nested blocks keep their own colour) */
.controls_if > .blocklyLabelField > .blocklyText,
.controls_if > .blocklyIconGroup + .blocklyLabelField > .blocklyText { fill: #3A2A00 !important; }
.fl-chunk-light > .blocklyLabelField > .blocklyText { fill: #26215C !important; }
.blocklyText { font-family: "Poppins", sans-serif !important; font-weight: 500; }
/* dark outline around each chunk so stacked big steps read as separate pieces */
.fl_chunk > .blocklyPath { stroke: #0B0620; stroke-width: 3px; }
/* category tabs */
.blocklyToolbox { padding-top: 10px !important; border-right: 1px solid #2A2D40; }
.blocklyToolboxCategory { padding: 6px 12px 6px 0 !important; margin-bottom: 2px; height: auto !important; }
.blocklyToolboxCategoryLabel, .blocklyTreeLabel { font-family: "Poppins", sans-serif !important; font-size: 14px !important; color: #E9E9F2 !important; }
.blocklyToolboxSelected, .blocklyTreeSelected { background-color: #33365A !important; }
.blocklyToolboxCategory:hover, .blocklyTreeRow:not(.blocklyTreeSelected):hover { background-color: #2A2D45 !important; }

/* ---------- levels ---------- */
.locwrap { display: flex; align-items: center; gap: 10px; }
.btn.up { background: #2A2D45; color: #fff; font-weight: 800; padding: 2px 10px; font-size: 14px; border-radius: 7px; }
.btn.up:disabled { opacity: .35; cursor: default; }
.crumb { cursor: pointer; color: #CFC6FF; }
.crumb:hover { text-decoration: underline; }
.crumb.here { cursor: default; color: #fff; font-weight: 800; text-decoration: none; }
.sep { color: #5B5E78; margin: 0 6px; }
.lvl { color: var(--muted); margin-left: 8px; }
/* a closed chunk that has things inside: stacked paper behind it */
.fl_chunk.blocklyCollapsed > .blocklyPath { filter: drop-shadow(5px 5px 0 #8E79F0) drop-shadow(5px 5px 0 #5A40C9); }
/* peek card */
.peek { position: fixed; z-index: 60; background: #24263A; border: 1px solid #4A4D6A; border-radius: 10px;
  padding: 10px 12px; min-width: 200px; box-shadow: 0 10px 24px rgba(0,0,0,.5); font-size: 13px; }
.peek.hidden { display: none; }
.peek h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.peek .item { padding: 4px 6px; border-radius: 6px; cursor: pointer; color: #fff; }
.peek .item:hover { background: #3B1F99; }
.peek .empty { color: var(--muted); }

/* big category icons */
.blocklyToolboxCategory { padding: 8px 14px 8px 0 !important; }
.blocklyToolboxCategory .blocklyTreeRowContentContainer,
.blocklyToolboxCategoryContainer > div { display: flex; align-items: center; }
.fl-ico { display: inline-flex !important; align-items: center; justify-content: center; width: 40px !important; height: 40px !important;
  margin: 0 8px 0 6px; font-size: 30px; line-height: 1; font-style: normal;
  visibility: visible !important; background-image: none !important; }
.fl-ico-topic::before { content: "🗃️"; }
.fl-ico-variables::before { content: "📦"; }
.fl-ico-loops::before { content: "🔁"; }
.fl-ico-lists::before { content: "📋"; }
.fl-ico-math::before { content: "🔢"; }
.fl-ico-turtle::before { content: "🖌️🎨"; font-size: 22px; letter-spacing: -2px; }
.fl-ico-text::before { content: "🗨️"; }
.fl-ico.fl-ico-logic { background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg fill='none' stroke='%23FFC300' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 29 V18 L7 8 M16 18 L25 8'/%3E%3Cpath d='M7 14 V8 H13 M25 14 V8 H19'/%3E%3C/g%3E%3C/svg%3E") !important; background-position: center !important; background-size: 32px 32px !important; background-repeat: no-repeat !important; }

/* category name (bold) + every command underneath; tabs fill the whole height */
.blocklyToolbox { width: 184px; }
.blocklyToolboxCategoryGroup { display: flex !important; flex-direction: column; height: 100%; }
.blocklyToolboxCategoryContainer { flex: 1 1 0; display: flex; min-height: 0; }
.blocklyToolboxCategory { flex: 1; display: flex !important; align-items: center; padding: 6px 12px 6px 0 !important; margin: 0 !important; }
.fl-lab { display: inline-flex !important; flex-direction: column; font-weight: 800 !important; font-size: 15px !important;
  line-height: 1.25; white-space: normal !important; width: 112px; }
.fl-lab::after { font-weight: 500; font-size: 11.5px; line-height: 1.4; color: #A7AAC4; margin-top: 3px; white-space: normal; }
.fl-lab-topic::after { content: "big step · step inside ›"; }
.fl-lab-variables::after { content: "set · change · get"; }
.fl-lab-logic::after { content: "if · if else · = ≠ < > · and · or · not · true · false"; }
.fl-lab-loops::after { content: "repeat · for each · while · until"; }
.fl-lab-lists::after { content: "make list · get # · length"; }
.fl-lab-math::after { content: "number · + − × ÷ · power"; }
.fl-lab-turtle::after { content: "forward · turn · pen · color"; }
.fl-lab-text::after { content: "print · ask · ask number · text"; }
.p-light .fl-lab-turtle::after { content: "forward · turn · circle · wait"; }

/* Level tabs: each opens its problem list on hover */
#levels { display: flex; gap: 6px; }
.lvTab { position: relative; }
.lvTab.active > .tab { color: #fff; border-color: #3A3D55; }
.lvTab.active > .tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 2px; background: var(--orange); }
.caret { font-size: 10px; opacity: .7; margin-left: 2px; }
.lvMenu { position: absolute; top: 100%; left: 0; padding-top: 6px; display: none; z-index: 80; }
.lvTab:hover .lvMenu { display: block; }
.lvMenu .pItem { display: flex; justify-content: space-between; align-items: center; gap: 14px; width: 260px; text-align: left;
  background: #24263A; color: #E9E9F2; border: 1px solid #3A3D55; border-top-width: 0; padding: 10px 14px; font: inherit; font-size: 14px; }
.lvMenu .pItem:first-child { border-top-width: 1px; border-radius: 10px 10px 0 0; }
.lvMenu .pItem:last-child { border-radius: 0 0 10px 10px; }
.lvMenu button.pItem { cursor: pointer; }
.lvMenu button.pItem:hover { background: #33365A; }
.lvMenu .pItem.current { color: #FFC300; font-weight: 800; }
.lvMenu .pItem.current::after { content: "✓"; }
.lvMenu .pItem.soon { color: #7C7F98; }
.lvMenu .pItem em { font-style: normal; font-size: 11px; background: #2E3048; padding: 2px 8px; border-radius: 6px; }

/* ---------- Run result popup (on our page, not a browser window) ---------- */
#runWrap { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
#runWrap.hidden { display: none; }
#runWin { width: 70vw; height: 76vh; background: #1F2131; border: 1px solid #3A3D55; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.runHead { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #262940; }
.runHead .btn { margin-left: 6px; }
.runTitle { font-weight: 800; }
#runBody { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; background: #000; }
#runCanvas { width: 480px; height: 480px; }
#runConsole { display: none; width: 100%; height: 100%; overflow: auto; background: #15161A; padding: 18px 22px;
  font: 15px/1.6 "SF Mono", Menlo, Consolas, monospace; color: #D7D9E0; white-space: pre-wrap; }
#runWrap.text #runCanvas { display: none; } #runWrap.text #runConsole { display: block; }
#runConsole input { background: transparent; border: 0; border-bottom: 1px solid #FF6B1A; color: #FFC300; font: inherit; outline: none; width: 260px; }
#runErr { color: #FF5A5F; padding: 8px 14px; font-size: 13px; min-height: 0; }
#runErr:empty { display: none; }

/* small notice at the top (e.g. full-screen tip) */
.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 120; background: #2A2D45; color: #E9E9F2;
  border: 1px solid #FF6B1A; border-radius: 10px; padding: 12px 18px; font-size: 14px; line-height: 1.5; box-shadow: 0 10px 24px rgba(0,0,0,.45); cursor: pointer; }
.toast.hidden { display: none; }


/* ---------- dim screen + guide cards ---------- */
#dim { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: flex-end;
  padding-right: 6vw; transition: opacity .5s; }
#dim.out { opacity: 0; }
#guide { width: 470px; background: #fff; color: #1B1D2A; border-radius: 18px; padding: 30px 34px 26px; box-shadow: 0 24px 60px rgba(0,0,0,.45); }
#guide.in { animation: cardIn .45s cubic-bezier(.2,.8,.2,1); }
@keyframes cardIn { from { opacity: 0; transform: translateX(40px) scale(.97); } to { opacity: 1; transform: none; } }
#guide.card-chat { width: 620px; }
.gHead { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 15px; color: #6B6E85; letter-spacing: .02em; }
.gHead.ok { color: #00995C; }
.gEmoji { font-size: 44px; line-height: 1; }
#guide h1 { font-family: Poppins, sans-serif; font-weight: 800; font-size: 40px; line-height: 1.1; margin: 14px 0 4px; color: #1B1D2A; }
.gSub { margin: 0 0 14px; font-size: 18px; color: #4A4D63; }
#guide hr { border: 0; border-top: 1px solid #E4E4EE; margin: 16px 0; }
.gDo { font-size: 18px; line-height: 2; margin: 0 0 6px; }
.fakeBtn { display: inline-block; padding: 1px 12px; border: 1px solid #C9C9D6; border-radius: 8px; font-weight: 800; line-height: 1.6; background: #F4F4F8; }
.fakeBtn.dark { background: #1B1D2A; color: #fff; border-color: #1B1D2A; }
.gNote { font-size: 13px; color: #6B6E85; margin: 8px 0 0; line-height: 1.5; }
.gArrow { font-size: 40px; color: #FF6B1A; margin: 6px 0 2px; animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-10px); } }
.gLinks { font-size: 13px; margin: 10px 0 0; color: #9A9DB2; }
.gLinks a { color: #D85A30; cursor: pointer; text-decoration: underline; }
.gLate.hidden { display: none; }
.gRow { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 6px 0 4px; }
.gRow h1 { font-size: 36px !important; }
.gBig { font-size: 16px; line-height: 1.6; margin: 14px 0 0; }
.gBig b { font-family: Poppins, sans-serif; font-weight: 800; font-size: 24px; color: #FF6B1A; }
.puffy { flex: none; font: 800 22px/1.15 Poppins, sans-serif; color: #fff; background: #D85A30; border: 0; border-radius: 22px; padding: 22px 28px;
  box-shadow: 0 8px 0 #9E3A18, 0 14px 24px rgba(0,0,0,.25); cursor: pointer; transition: transform .1s, box-shadow .1s; text-align: left; }
.puffy:hover { transform: translateY(-3px); box-shadow: 0 11px 0 #9E3A18, 0 18px 28px rgba(0,0,0,.28); }
.puffy:active { transform: translateY(6px); box-shadow: 0 2px 0 #9E3A18, 0 6px 12px rgba(0,0,0,.2); }
#guide.card-chat { width: 680px; }
.gDo { margin: 0; }
.gArrow { display: inline-block; font-size: 30px; margin-left: 10px; vertical-align: middle; }
.nw { white-space: nowrap; }
.gEmoji.sm { font-size: 34px; vertical-align: middle; }
.gBig { line-height: 1.35; }
.gBig b { display: inline-block; margin: 0 2px; }

#guide.card-connect { width: 760px; }
.gTwo { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.gPick { border: 2px solid #E4E4EE; border-radius: 14px; padding: 18px 18px 16px; text-align: left; background: #fff; font: inherit; color: inherit; }
.gPick .gHead { color: #1B1D2A; font-size: 17px; margin-bottom: 10px; }
.gPick .gEmoji { font-size: 34px; }
.gPick .gDo { font-size: 16px; line-height: 1.9; }
.gBack { cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: transform .1s, border-color .1s, box-shadow .1s; }
.gBack:hover { transform: translateY(-3px); border-color: #D85A30; box-shadow: 0 8px 18px rgba(0,0,0,.12); }
.gBack:active { transform: translateY(2px); }
.gBig2 { font: 800 26px/1.2 Poppins, sans-serif; color: #D85A30; }
.gPick .fakeBtn { font-size: 14px; padding: 0 8px; } .gPick .gDo { white-space: nowrap; }

.gNow { font: 800 30px/1.2 Poppins, sans-serif; color: #1B1D2A; margin: 10px 0 0; }
/* card 2 button: a quick twitch, then a yellow glow that fades in and out */
#guide.card-chat .puffy { animation: twitch 1.8s ease-in-out infinite, aura 1.8s ease-in-out infinite; }
#guide.card-chat .puffy:hover, #guide.card-chat .puffy:active { animation: aura 1.8s ease-in-out infinite; }
@keyframes twitch {
  0%, 30%, 100% { transform: none; }
  6%  { transform: scale(1.06) rotate(-2deg); }
  12% { transform: scale(1.06) rotate(2deg); }
  18% { transform: scale(1.04) rotate(-1deg); }
  24% { transform: scale(1); }
}
@keyframes aura {
  0%, 100% { box-shadow: 0 8px 0 #9E3A18, 0 14px 24px rgba(0,0,0,.25), 0 0 0 0 rgba(255,230,0,0), 0 0 0 0 rgba(255,140,0,0); }
  50%      { box-shadow: 0 8px 0 #9E3A18, 0 14px 24px rgba(0,0,0,.25), 0 0 0 7px #FFE600, 0 0 50px 24px rgba(255,200,0,.95); }
}

#guide.card-chat .puffy { color: #fff; font-size: 30px; padding: 26px 34px; }

/* card 2: big button on the left, smaller text on the right */
#guide.card-chat { width: 640px; padding: 34px 34px 30px; }
.gChat { display: flex; align-items: center; gap: 34px; }
.gChatText { flex: 1; }
.gChatText .gNow { font-size: 22px; margin: 6px 0 0; }
.gChatText h1 { font-size: 24px !important; margin: 8px 0 4px !important; }
.gChatText .gEmoji.sm { font-size: 22px; }
.gChatText .gNote { font-size: 12px; }
#guide.card-chat .puffy {
  background: linear-gradient(180deg, #F08A4B 0%, #D85A30 55%, #B8461F 100%);
  border-radius: 24px; text-shadow: 0 2px 0 rgba(0,0,0,.28);
}
@keyframes aura {
  0%, 100% { box-shadow: inset 0 3px 0 rgba(255,255,255,.45), inset 0 -6px 0 rgba(0,0,0,.18), 0 10px 0 #8A3013, 0 22px 30px rgba(0,0,0,.45), 0 0 0 0 rgba(255,230,0,0), 0 0 0 0 rgba(255,200,0,0); }
  50%      { box-shadow: inset 0 3px 0 rgba(255,255,255,.45), inset 0 -6px 0 rgba(0,0,0,.18), 0 10px 0 #8A3013, 0 22px 30px rgba(0,0,0,.45), 0 0 0 7px #FFE600, 0 0 50px 24px rgba(255,200,0,.95); }
}
.gChatText h1 { white-space: nowrap; font-size: 22px !important; }

/* card 2: cursor on the button = pushed in (sinks onto its base, ledge shrinks); aura keeps pulsing */
#guide.card-chat .puffy { transition: transform .12s; }
#guide.card-chat .puffy:hover { transform: translateY(8px); animation: auraIn 1.8s ease-in-out infinite; }
#guide.card-chat .puffy:active { transform: translateY(10px); }
@keyframes auraIn {
  0%, 100% { box-shadow: inset 0 3px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(0,0,0,.18), 0 2px 0 #8A3013, 0 6px 10px rgba(0,0,0,.35), 0 0 0 0 rgba(255,230,0,0), 0 0 0 0 rgba(255,200,0,0); }
  50%      { box-shadow: inset 0 3px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(0,0,0,.18), 0 2px 0 #8A3013, 0 6px 10px rgba(0,0,0,.35), 0 0 0 7px #FFE600, 0 0 50px 24px rgba(255,200,0,.95); }
}
#guide.card-chat .puffy.press { transform: translateY(8px); animation: auraIn 1.8s ease-in-out infinite; }
/* deeper, clearer push-in when the cursor is on it */
#guide.card-chat .puffy:hover, #guide.card-chat .puffy.press { transform: translateY(10px) scale(.97); filter: brightness(.93); }
#guide.card-chat .puffy:active { transform: translateY(12px) scale(.95); }
