/* Kubo Maker: the Kubo world (paper panels on a plum frame, Fredoka, chunky ink outlines). Single light theme on
   purpose, like the other Kubo sites. */
:root {
  --paper: #F4ECDD; --card: #FFF6E6; --ink: #221B2E; --frame: #2A2138; --muted: #6E6478;
  --sun: #FFC94A; --pink: #F48FB1; --teal: #3FB7A8; --blue: #4F9BD9; --red: #E8374A;
  --ol: 3px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--frame); color: var(--ink); font: 600 16px/1.35 Fredoka, "Trebuchet MS", system-ui, sans-serif; }
.hidden { display: none !important; }
.display { font-family: "Luckiest Guy", Impact, sans-serif; font-weight: 400; letter-spacing: .03em; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }

.btn {
  border-radius: 14px; background: var(--sun); color: var(--ink); padding: 8px 14px;
  box-shadow: inset 0 0 0 var(--ol) var(--ink), 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: inset 0 0 0 var(--ol) var(--ink), 0 1px 0 var(--ink); }
.btn.cream { background: var(--card); }
.btn.teal { background: var(--teal); }
.btn.small { font-size: 15px; padding: 6px 12px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- top bar ---------- */
.top { height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 14px; color: var(--paper); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 26px; white-space: nowrap; }
.brand img { height: 44px; }
.title {
  flex: 1; min-width: 80px; max-width: 360px; font: inherit; font-size: 18px; color: var(--paper); background: transparent;
  border: 0; border-bottom: 2px dashed #5A4D6E; padding: 4px 2px; outline: none;
}
.title:focus { border-bottom-color: var(--sun); }
.tools { margin-left: auto; display: flex; gap: 10px; }
.lang { min-width: 48px; }

/* ---------- work area ---------- */
.work { height: calc(100dvh - 64px); display: grid; grid-template-columns: minmax(340px, 38%) 1fr; gap: 12px; padding: 0 12px 12px; }
.side { background: var(--paper); border-radius: 18px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tabs { display: flex; gap: 6px; padding: 10px 10px 0; }
.tab { flex: 1; padding: 8px; border-radius: 12px 12px 0 0; color: var(--muted); }
.tab.on { background: var(--card); color: var(--ink); box-shadow: inset 0 var(--ol) 0 var(--ink), inset var(--ol) 0 0 var(--ink), inset calc(-1 * var(--ol)) 0 0 var(--ink); }
.pane { display: none; flex: 1; min-height: 0; flex-direction: column; background: var(--card); margin: 0 10px 10px; border-radius: 0 0 14px 14px; box-shadow: inset 0 0 0 var(--ol) var(--ink); }
.pane.on { display: flex; }
.hint { color: var(--muted); font-size: 14px; font-weight: 500; }
.hint.light { color: #CFC5DD; }

/* chat */
.log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.kid { align-self: flex-end; background: var(--sun); box-shadow: inset 0 0 0 2px var(--ink); border-bottom-right-radius: 4px; }
.row { display: flex; gap: 8px; align-items: flex-end; }
.row img.who { width: 46px; flex: none; }
.msg.ai { background: #fff; box-shadow: inset 0 0 0 2px var(--ink); border-bottom-left-radius: 4px; }
.msg.err { background: #FDE3E6; box-shadow: inset 0 0 0 2px var(--red); }
.msg .what { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 54px; }
.choice { background: var(--paper); border-radius: 999px; padding: 6px 12px; box-shadow: inset 0 0 0 2px var(--ink); font-size: 15px; }
.choice:hover { background: var(--sun); }
.starter { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: auto 0; text-align: center; }
.starter img { width: 120px; }
.starter .choices { padding: 0; justify-content: center; }
.thinking img.who { animation: bob .6s ease-in-out infinite; }
.thinking .msg { color: var(--muted); }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-3deg); } }

.ask { display: flex; gap: 10px; padding: 10px; border-top: 2px solid #E6D9C2; }
.ask textarea {
  flex: 1; resize: none; font: inherit; font-weight: 500; border-radius: 12px; border: 0; padding: 10px 12px; background: #fff;
  box-shadow: inset 0 0 0 2px var(--ink); outline: none;
}
.ask textarea:focus { box-shadow: inset 0 0 0 3px var(--blue); }
.btn.go { font-size: 22px; padding: 0 18px; }

/* assets */
#pane-assets { overflow-y: auto; padding: 12px; }
#pane-assets .hint { margin: 0 0 8px; }
.assets h3 { margin: 14px 0 8px; font-size: 16px; text-transform: capitalize; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.asset { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 2px #E6D9C2; font-size: 12px; font-weight: 500; text-align: center; overflow-wrap: anywhere; }
.asset:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.asset img { height: 54px; max-width: 100%; object-fit: contain; }
.sounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.sound { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 2px #E6D9C2; font-size: 13px; font-weight: 500; text-align: left; }
.sound:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.sound b { color: var(--teal); font-size: 12px; }

/* code */
.code { flex: 1; margin: 10px 10px 0; border: 0; border-radius: 10px; padding: 10px; resize: none; font: 500 13px/1.45 ui-monospace, Consolas, monospace; background: #fff; box-shadow: inset 0 0 0 2px #E6D9C2; outline: none; tab-size: 2; }
.codebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; }

/* stage */
.stage { display: flex; flex-direction: column; min-height: 0; gap: 8px; }
.stagebar { display: flex; align-items: center; gap: 10px; }
.stagebar #full { margin-left: auto; }
.screen { position: relative; flex: 1; min-height: 0; background: var(--paper); border-radius: 18px; overflow: hidden; }
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.screen:fullscreen { border-radius: 0; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--paper); color: var(--muted); font-size: 20px; text-align: center; padding: 20px; }
.empty img { width: 160px; }
.crash { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: #FDE3E6; box-shadow: inset 0 0 0 2px var(--red); font-size: 14px; }
.crash span { flex: 1; overflow-wrap: anywhere; }

@media (max-width: 800px) {
  .work { grid-template-columns: 1fr; grid-template-rows: 50% 1fr; height: auto; min-height: calc(100dvh - 64px); }
  .brand span, .tools .btn[data-t="download"] { display: none; }
}
