/* Login: cartoon safe ("tijori") mascot on ledger paper. Thick ink outlines, chunky buttons. */
:root {
  --ink: #12241f; --green: #0e5a4f; --leaf: #2f9e6a; --marigold: #f2a900; --marigold-dk: #c98a00;
  --mist: #eef3f1; --rust: #d64933; --muted: #5f736d;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: 'Mukta', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--mist); }
h1, .bubble, .go, .brand { font-family: 'Baloo 2', 'Mukta', system-ui, sans-serif; }

.stage { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }

/* ---- scene (ledger paper) ---- */
.scene { position: relative; overflow: hidden; padding: max(18px, env(safe-area-inset-top)) 18px 54px; text-align: center;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, rgba(255,255,255,.08) 31px, rgba(255,255,255,.08) 32px), var(--green); }
.scene::before { content: ""; position: absolute; top: 0; bottom: 0; left: 28px; width: 2px; background: #e9806e; opacity: .85; }
.brand { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 1.25rem; float: left; margin-left: 24px; }
.brand i { width: 11px; height: 11px; border-radius: 3px; background: var(--marigold); display: inline-block; }
.decor { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: var(--marigold); border: 3px solid var(--ink); opacity: .9; }
.decor::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; border: 2px solid rgba(18,36,31,.45); }
.d1 { right: 8%; top: 22%; } .d2 { left: 14%; bottom: 20%; width: 18px; height: 18px; } .d3 { right: 18%; bottom: 14%; width: 20px; height: 20px; }

.mwrap { position: relative; width: min(250px, 62vw); margin: 34px auto 0; }
.bubble { position: relative; display: inline-block; max-width: 92%; background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: 18px; padding: 6px 16px; font-weight: 600; font-size: 1.05rem; line-height: 1.3; margin-bottom: 16px; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -12px; width: 16px; height: 16px; background: #fff; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
.bubble.pop { animation: pop .28s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { from { transform: scale(.88); } to { transform: scale(1); } }

#mascot { width: 100%; height: auto; display: block; overflow: visible; }
#mascot * { transform-box: view-box; }
.mb { animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.eyes { transform-origin: 150px 142px; transition: transform .08s; }
.pupil { transition: transform .12s ease-out; }
#mascot.blink .eyes { transform: scaleY(.1); }
.hand { transition: transform .38s cubic-bezier(.34,1.56,.64,1); }
.m, .brows, .sweat, .happy-eyes { transition: opacity .15s; }
.m-sad, .m-open, .brows, .sweat, .happy-eyes { opacity: 0; }
.dial { transform-origin: 150px 240px; transition: transform .9s cubic-bezier(.3,1.4,.5,1); }

/* states: password = hands over eyes */
[data-s="pw"] .hand-l { transform: translate(72px, -64px); }
[data-s="pw"] .hand-r { transform: translate(-72px, -64px); }
/* wrong password */
[data-s="error"] .m-smile { opacity: 0; } [data-s="error"] .m-sad { opacity: 1; }
[data-s="error"] .brows, [data-s="error"] .sweat { opacity: 1; }
[data-s="error"] .mb { animation: shake .5s ease; }
@keyframes shake { 20% { transform: translateX(-9px) rotate(-2deg); } 40% { transform: translateX(8px) rotate(2deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
/* success */
[data-s="ok"] .eyes { opacity: 0; } [data-s="ok"] .happy-eyes { opacity: 1; }
[data-s="ok"] .m-smile { opacity: 0; } [data-s="ok"] .m-open { opacity: 1; }
[data-s="ok"] .dial { transform: rotate(540deg); }
[data-s="ok"] .mb { animation: jump .45s ease-out 2; }
@keyframes jump { 45% { transform: translateY(-26px); } }

.cn { position: absolute; left: 50%; top: 52%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: var(--marigold); border: 3px solid var(--ink); pointer-events: none; animation: fly .95s ease-out forwards; }
@keyframes fly { from { transform: translate(0,0) scale(.4); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) rotate(360deg) scale(1); opacity: 0; } }

/* ---- form panel ---- */
.panel { padding: 0 16px 28px; }
#lf { position: relative; max-width: 420px; margin: -28px auto 0; background: #fff; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 6px 6px 0 var(--ink); padding: 22px 20px 20px; }
#lf.shake { animation: shake .5s ease; }
h1 { margin: 0; font-size: 2rem; line-height: 1.1; font-weight: 700; }
.sub { margin: 2px 0 12px; color: var(--muted); }
.err { min-height: 0; color: var(--rust); font-weight: 600; margin-bottom: 6px; }
.err:empty { display: none; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 10px 0 4px; color: #34504a; }
input[type=email], input[type=password], input[type=text] { width: 100%; font: inherit; padding: 11px 14px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); transition: box-shadow .15s, border-color .15s; }
input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(242,169,0,.45); }
.pw { position: relative; }
.pw input { padding-right: 86px; }
#tog { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: #e5efeb; color: var(--ink); font: inherit; font-weight: 600; font-size: .85rem; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
#tog:hover { background: #d3e5de; }
.chk { display: flex; align-items: center; gap: 8px; margin: 12px 0 14px; font-weight: 500; cursor: pointer; }
.chk small { color: var(--muted); font-weight: 400; }
.chk input { appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; margin: 0; border: 2.5px solid var(--ink); border-radius: 8px; background: #fff; display: grid; place-content: center; cursor: pointer; transition: background-color .12s, transform .12s; }
.chk input:checked { background: var(--marigold); }
.chk input:checked::after { content: ""; width: 6px; height: 12px; border: solid var(--ink); border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.chk input:active { transform: scale(.9); }

.go { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.25rem; font-weight: 700; color: var(--ink); background: var(--marigold);
  border: 3px solid var(--ink); border-radius: 16px; padding: 8px 14px 6px; cursor: pointer; box-shadow: 0 5px 0 var(--ink); transition: transform .08s, box-shadow .08s; }
.go:hover { background: #f7b92a; }
.go:active, .go[disabled] { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.go[disabled] { cursor: progress; }
.sp { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(18,36,31,.25); border-top-color: var(--ink); display: none; animation: spin .7s linear infinite; }
.go.busy .sp { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }

/* ---- desktop: two columns ---- */
@media (min-width: 900px) {
  .stage { grid-template-columns: 1.1fr 1fr; grid-template-rows: 1fr; }
  .scene { padding: 28px 28px 28px; display: flex; flex-direction: column; justify-content: center; }
  .scene::before { left: 48px; }
  .brand { position: absolute; top: 26px; left: 70px; margin: 0; float: none; }
  .mwrap { width: min(340px, 34vw); margin-top: 0; }
  .panel { display: flex; align-items: center; justify-content: center; padding: 28px; }
  #lf { margin: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
