:root {
  --cream: #fbeccb;
  --brown: #6b4a2b;
  --ink: #3a2a1c;
  --bg: #c98b4f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body { font-family: "Fredoka", system-ui, sans-serif; color: var(--ink); -webkit-user-select: none; user-select: none; touch-action: none; }
#app canvas { display: block; }

.panel {
  background: var(--cream);
  border: 3px solid var(--brown);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(58, 42, 28, .35);
}
#title {
  position: fixed; top: 16px; left: 16px; padding: 8px 14px;
  font-weight: 700; font-size: 18px; line-height: 1.1;
}
#title small { display: block; font-weight: 500; font-size: 12px; opacity: .7; letter-spacing: .04em; }
#met {
  position: fixed; top: 16px; right: 16px; padding: 8px 12px;
  font-size: 13px; font-weight: 600; max-width: calc(100vw - 32px);
}
#met .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
#met .chip { padding: 1px 8px; border-radius: 99px; border: 2px dashed var(--brown); opacity: .45; font-size: 12px; }
#met .chip.on { border-style: solid; background: #ffd66b; opacity: 1; }
#help {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  padding: 6px 14px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
#prompt {
  position: fixed; bottom: 104px; left: 50%; transform: translateX(-50%) scale(.9);
  padding: 10px 18px; font: 600 16px "Fredoka", sans-serif; color: var(--ink);
  background: #ffd66b; cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s;
}
#prompt.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) scale(1); }
#prompt kbd {
  font: 700 13px "Fredoka", sans-serif; background: var(--cream); border: 2px solid var(--brown);
  border-radius: 6px; padding: 0 6px; margin-right: 6px;
}

#throw {
  position: fixed; right: 16px; bottom: 16px; width: 56px; height: 56px; padding: 0;
  font-size: 26px; line-height: 1; cursor: pointer; background: #ffd66b;
}
#soundToggle {
  position: fixed; right: 152px; bottom: 16px; width: 56px; height: 56px; padding: 0;
  font-size: 22px; line-height: 1; cursor: pointer;
}
#modeToggle {
  position: fixed; right: 84px; bottom: 16px; width: 56px; height: 56px; padding: 0;
  font: 700 16px "Fredoka", sans-serif; color: var(--ink); cursor: pointer;
}
#throw:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(58, 42, 28, .35); }
#help { max-width: calc(100vw - 2 * 228px); white-space: normal; text-align: center; }
@media (max-width: 760px) { #help { bottom: 84px; max-width: calc(100vw - 32px); } #prompt { bottom: 164px; } }
#comic {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(30, 20, 12, .62); opacity: 0; pointer-events: none; transition: opacity .18s;
}
#comic.show { opacity: 1; pointer-events: auto; }
#comic .card {
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  width: min(760px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  transform: scale(.96); transition: transform .18s;
}
#comic.show .card { transform: scale(1); }
#comic header, #comic footer { display: flex; align-items: center; gap: 10px; }
#comic header h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; line-height: 1.2; }
#comic header small { font-size: 12px; font-weight: 600; opacity: .6; white-space: nowrap; }
#comic .frame {
  position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 3px solid var(--brown); border-radius: 10px; overflow: hidden;
}
#comic img { display: block; max-width: 100%; max-height: calc(100vh - 170px); max-height: calc(100dvh - 170px); object-fit: contain; }
#comic.loading img { opacity: .25; }
#comic .frame::after {
  content: "Loading…"; position: absolute; font-weight: 600; opacity: 0; transition: opacity .15s;
}
#comic.loading .frame::after { opacity: .7; }
#comic button.icon {
  width: 40px; height: 40px; flex: none; padding: 0; font: 700 22px "Fredoka", sans-serif; color: var(--ink);
  background: #ffd66b; cursor: pointer; border-radius: 12px;
}
#comic footer a {
  flex: 1; text-align: center; color: var(--ink); font-weight: 600; font-size: 14px;
}
#bubbles { position: fixed; inset: 0; pointer-events: none; }
.bubble {
  position: absolute; left: 0; top: 0; max-width: 220px; padding: 7px 12px;
  font-size: 14px; font-weight: 500; line-height: 1.25; text-align: center;
  background: #fffaf0; border: 3px solid var(--brown); border-radius: 14px;
  box-shadow: 0 3px 0 rgba(58, 42, 28, .3);
  opacity: 0; transition: opacity .15s;
  will-change: transform;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -10px; margin-left: -7px;
  border: 7px solid transparent; border-top-color: var(--brown); border-bottom: 0;
}
.bubble.show { opacity: 1; }
.bubble.petey { background: #dff0ff; }
.label {
  position: absolute; left: 0; top: 0; padding: 2px 9px; font-size: 12px; font-weight: 600;
  background: var(--brown); color: var(--cream); border-radius: 99px; opacity: 0; transition: opacity .15s;
}
.label.show { opacity: 1; }

@media (max-width: 760px) {
  #met { top: 74px; left: 16px; right: auto; }
}
@media (max-width: 600px) {
  #title { font-size: 15px; }
  #help { font-size: 11px; white-space: normal; width: calc(100vw - 32px); text-align: center; }
  .bubble { max-width: 170px; font-size: 13px; }
}

/* site-nav:start (stripped from the downloadable copy) */
.site-back {
  position: fixed; left: 16px; bottom: 16px; z-index: 5; padding: 6px 12px;
  font: 600 13px "Fredoka", system-ui, sans-serif; color: var(--ink); text-decoration: none;
}
.site-back:hover { background: #ffd66b; }
.site-back:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; }
@media (max-width: 760px) { .site-back { bottom: auto; top: 16px; left: auto; right: 16px; } }
/* site-nav:end */
