/* Rajzország. The body is a size container (the page may be drawn sideways on an upright phone):
   sizes use cqw / cqh / px, never vw / vh. */
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: #fbf7ee; }
body {
  container-type: size; position: relative; width: 100%; height: 100%;
  font-family: "Comic Sans MS", "Chalkboard SE", "Marker Felt", system-ui, sans-serif; color: #2b2b2b;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  touch-action: none; overscroll-behavior: none;
}
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* loading */
#loading {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: #fbf7ee; z-index: 50; transition: opacity .45s;
}
#loading.gone { opacity: 0; pointer-events: none; }
#loading b { font-size: clamp(16px, 3cqh, 26px); color: #8a6a40; font-weight: 600; }
#loading .bar { width: min(320px, 50cqw); height: 14px; border-radius: 9px; border: 3px solid #e2c48e; overflow: hidden; background: #fff; }
#loading .bar i { display: block; height: 100%; width: 0; background: #f5c400; transition: width .2s; }
#loading .dots { display: flex; gap: 14px; }
#loading .dots em { width: 22px; height: 22px; border-radius: 50%; background: #e3262b; animation: hop 0.9s infinite ease-in-out; }
#loading .dots em:nth-child(2) { background: #3a7bd5; animation-delay: .15s; }
#loading .dots em:nth-child(3) { background: #3aa04a; animation-delay: .3s; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-16px); } }

/* a 2 s hold: the ring fills with --p (0-1) */
.ring { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); pointer-events: none; }
.ring circle { fill: none; stroke: #f5c400; stroke-width: 9; stroke-linecap: round; stroke-dasharray: 276.5; stroke-dashoffset: calc(276.5 * (1 - var(--p, 0))); opacity: 0; transition: opacity .15s; }
.holding .ring circle { opacity: 1; }

/* the parent corner button, top right, small and quiet */
.parent-btn {
  position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); z-index: 30;
  width: 54px; height: 54px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.55); cursor: pointer;
  touch-action: none; opacity: .75;
}
.parent-btn .ico { position: absolute; inset: 6px; background-repeat: no-repeat; background-position: 0 0; }
.parent-btn .ico.txt { display: flex; align-items: center; justify-content: center; font-size: 28px; color: #8a6a40; }
.parent-btn .tip {
  position: absolute; right: 0; top: 62px; white-space: nowrap; background: #fff; border-radius: 10px; padding: 5px 10px; font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15); opacity: 0; transition: opacity .2s; pointer-events: none;
}
.parent-btn.tipped .tip, .parent-btn.holding .tip { opacity: 1; }
.parent-btn.holding { opacity: 1; }

/* the panel */
.parent-panel { position: absolute; inset: 0; z-index: 40; background: rgba(60,45,30,.45); display: flex; align-items: center; justify-content: center; touch-action: auto; }
.pp-box {
  background: #fffaf0; border-radius: 22px; padding: 18px 24px 14px; width: min(560px, 92cqw); max-height: 92cqh; overflow: auto; box-sizing: border-box;
  box-shadow: 0 10px 40px rgba(0,0,0,.25); font-size: 16px; -webkit-user-select: text; user-select: text;
}
.pp-box h2 { margin: 0 0 4px; font-size: 24px; color: #e3262b; }
.pp-box p { margin: 4px 0; }
.pp-about, .pp-foot, .pp-note { color: #7a6a58; font-size: 14px; }
.pp-stars { font-weight: 700; }
.pp-box button { font: inherit; cursor: pointer; border-radius: 12px; border: 2px solid #e2c48e; background: #fff; padding: 9px 14px; min-height: 44px; }
.pp-box button:disabled { opacity: .45; cursor: default; }
.pp-toggles, .pp-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.pp-toggle.off { background: #eee; color: #888; }
.pp-act.danger { border-color: #e9a0a0; color: #b02020; }
.pp-ask { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pp-ask p { width: 100%; }
.pp-close { display: block; width: 100%; margin-top: 6px; background: #f5c400 !important; border-color: #e0b000 !important; font-weight: 700; }

/* the card's save button: top right of the card scene, under the parent button */
.card-save {
  position: absolute; right: max(14px, env(safe-area-inset-right)); top: max(78px, calc(env(safe-area-inset-top) + 68px)); z-index: 25;
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid #e2c48e; background: #fff; color: #3a7bd5; padding: 0; cursor: pointer; touch-action: none;
}
.card-save .ico { width: 36px; height: 36px; }
.card-save .lbl {
  position: absolute; right: 0; top: 72px; white-space: nowrap; font-size: 13px; color: #7a6a58; background: rgba(255,255,255,.85); border-radius: 8px; padding: 2px 8px;
}
.card-save.saved { color: #3aa04a; border-color: #3aa04a; }

/* cheat menu */
.cheat-menu { position: absolute; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; touch-action: auto; }
.cm-box { background: #fff; border-radius: 16px; padding: 14px 18px; width: min(720px, 94cqw); max-height: 92cqh; overflow: auto; box-sizing: border-box; font-family: system-ui, sans-serif; font-size: 14px; }
.cm-box h2 { margin: 0 0 6px; font-size: 18px; }
.cm-box h3 { margin: 10px 0 4px; font-size: 13px; color: #777; text-transform: uppercase; letter-spacing: .05em; }
.cm-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cm-box button { font: inherit; padding: 7px 10px; border-radius: 9px; border: 1px solid #ccc; background: #f6f6f6; cursor: pointer; min-height: 36px; }
.cm-box button.on { background: #ffe680; border-color: #e0b000; }
.cm-close { margin-top: 12px; width: 100%; }
.cheat-tab {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%); z-index: 35; font: 12px system-ui, sans-serif; padding: 3px 10px;
  border: 1px solid #ccc; border-top: 0; border-radius: 0 0 8px 8px; background: rgba(255,255,255,.8); cursor: pointer;
}
