/* Color Dyer — page shell + loading page. The game itself is drawn on <canvas>. */
:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; background: #d8c2a0; overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0; }
canvas { display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }

/* ---------- loading page: the day workshop counter with one order slip (visible for exactly CONFIG.loading.seconds, hidden by JS) ---------- */
#loading {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(to bottom, rgba(255,250,235,0.35), rgba(255,250,235,0) 40%),
    repeating-linear-gradient(45deg, rgba(0,0,0,0.035) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 6px),
    linear-gradient(to bottom, #eadbbf 0%, #d8c2a0 60%, #bfa47c 100%);
  color: #2c221b; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  transition: opacity 0.6s ease; padding: var(--sat) var(--sar) var(--sab) var(--sal);
}
#loading::after {   /* the walnut counter along the bottom */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14vh; min-height: 56px;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.12) 0 1px, transparent 1px 17px), linear-gradient(to bottom, #a3713f 0, #7d4f2a 6%, #55341a 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.18), inset 0 8px 0 -6px #b8813f;
}
#loading.hide { opacity: 0; pointer-events: none; }
#loading .slip {
  position: relative; z-index: 1; width: min(88vw, 360px); max-height: calc(100vh - var(--sat) - var(--sab) - 24px); box-sizing: border-box; padding: 34px 26px 26px; text-align: center; overflow: hidden;
  background: linear-gradient(#f7efdf, #f2e7d0); box-shadow: 0 14px 30px rgba(44,34,27,0.32); transform: rotate(-1.2deg);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), 96% 100%, 92% calc(100% - 6px), 88% 100%, 84% calc(100% - 6px), 80% 100%, 76% calc(100% - 6px), 72% 100%, 68% calc(100% - 6px), 64% 100%, 60% calc(100% - 6px), 56% 100%, 52% calc(100% - 6px), 48% 100%, 44% calc(100% - 6px), 40% 100%, 36% calc(100% - 6px), 32% 100%, 28% calc(100% - 6px), 24% 100%, 20% calc(100% - 6px), 16% 100%, 12% calc(100% - 6px), 8% 100%, 4% calc(100% - 6px), 0 100%);
  animation: settle 0.9s cubic-bezier(.2,.8,.3,1) both;
}
#loading .pin { position: absolute; left: 50%; top: -2px; margin-left: -14px; width: 28px; height: 28px; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3)); }
#loading .head { font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif; font-size: 10px; letter-spacing: 0.24em; color: #6b5a4c; padding-bottom: 10px; border-bottom: 1px dashed rgba(44,34,27,0.35); }
#loading .emblem { width: min(26vmin, 120px); height: min(26vmin, 120px); margin: 14px auto 2px; display: block; filter: drop-shadow(0 6px 10px rgba(44,34,27,0.25)); }
#loading h1 { margin: 6px 0 0; font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif; font-size: clamp(26px, 7vmin, 40px); letter-spacing: 0.2em; font-weight: 700; color: #2c221b; }
#loading .sub { margin: 2px 0 14px; font-size: 10px; letter-spacing: 0.42em; color: #b83232; font-weight: 800; }
#loading .ledger { text-align: left; font-size: 12px; color: #2c221b; }
#loading .row { display: flex; align-items: center; gap: 8px; height: 26px; border-bottom: 1px solid rgba(34,50,90,0.14); }
#loading .row > span:first-child { font-family: Georgia, serif; font-style: italic; color: #6b5a4c; width: 46px; }
#loading .row > i { flex: 1; border-bottom: 1px dotted rgba(44,34,27,0.3); height: 1px; margin-top: 8px; }
#loading .row .ink { min-width: 150px; text-align: left; color: #22325a; font-family: Georgia, serif; font-style: italic; font-size: 12.5px; }
#loading .dyes b { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; box-shadow: inset -2px -2px 3px rgba(0,0,0,0.25), inset 2px 2px 3px rgba(255,255,255,0.45); }
#loading .dyes .r { background: #e63946; } #loading .dyes .y { background: #ffb703; } #loading .dyes .b { background: #219ebc; }
#loading .bar { display: inline-block; width: 150px; height: 8px; border: 1px solid rgba(44,34,27,0.45); border-radius: 2px; vertical-align: middle; overflow: hidden; background: rgba(255,255,255,0.4); }
#loading .bar em { display: block; height: 100%; width: 0%; background: repeating-linear-gradient(90deg, #22325a 0 6px, #31487c 6px 8px); transition: width 0.25s linear; }
#loading .stamp { position: absolute; right: 10px; bottom: 16px; width: 150px; height: 75px; opacity: 0; transform: rotate(-14deg) scale(1.6); animation: stamp 0.35s cubic-bezier(.2,.9,.3,1.2) 4.2s forwards; }
@keyframes stamp { to { opacity: 0.92; transform: rotate(-14deg) scale(1); } }
@keyframes settle { from { transform: translateY(-40px) rotate(-6deg); opacity: 0; } to { transform: translateY(0) rotate(-1.2deg); opacity: 1; } }
@media (max-height: 520px) { #loading .emblem { display: none; } #loading h1 { font-size: 24px; margin-top: 4px; } #loading .slip { padding: 26px 22px 22px; } #loading .sub { margin-bottom: 8px; } }
@media (prefers-reduced-motion: reduce) { #loading .slip { animation: none; } #loading .stamp { animation-duration: 0.01s; } }
