/* Kopīgie stili: kalendārs, stāsta lapa, etiķetes. Strādā arī telefonā. */
:root {
  --red: #b0151f;
  --red-dark: #6a0a10;
  --ink: #1d2433;
  --paper: #fffaf2;
  --night: #173a5e;
  --gold: #f5c542;
  --font: "Segoe UI Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; font-family: var(--font); background: var(--night); color: var(--ink); }
button, a.next, a.pill { font: inherit; font-weight: 700; border: 0; border-radius: 999px; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
canvas { display: block; touch-action: none; }

/* --- 3D etiķetes --- */
.labels { position: fixed; inset: 0; pointer-events: none; }
.place-label { display: flex; flex-direction: column; align-items: center; background: rgba(255,255,255,.92); color: #7a1018; border-radius: 12px; padding: 5px 12px; box-shadow: 0 3px 0 var(--red), 0 6px 16px rgba(0,0,0,.25); }
.place-label b { font-size: 15px; }
.place-label span { font-size: 11px; color: #555; font-weight: 600; }
.zzz { font-size: 22px; font-weight: 800; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.5); animation: zzz 1.6s ease-in-out infinite; }
/* CSS2DRenderer novieto birkas ar `transform`, tāpēc animācijās izmanto atsevišķās īpašības translate/scale */
@keyframes zzz { 0%,100% { translate: 0 0; opacity: .6; } 50% { translate: 0 -10px; opacity: 1; } }
.bubble { background: #fff; color: var(--red); font-weight: 800; font-size: 18px; padding: 6px 12px; border-radius: 16px; box-shadow: 0 3px 0 var(--red), 0 6px 14px rgba(0,0,0,.25); animation: pop .3s ease-out; white-space: nowrap; }
@keyframes pop { from { scale: .3; } to { scale: 1; } }

/* --- stāsta lapa --- */
body.story { overflow: hidden; }
#top { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 8px; align-items: center; z-index: 5; }
.pill { background: rgba(18,28,48,.72); color: #fff; padding: 8px 12px; font-size: 16px; line-height: 1; display: inline-flex; align-items: center; }
.pill.title { flex: 1; justify-content: center; font-size: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#music.on { background: var(--red); }
#panel { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); width: min(760px, calc(100% - 20px)); background: var(--paper); border-radius: 20px; padding: 16px 18px 14px; box-shadow: 0 6px 0 var(--red), 0 18px 40px rgba(0,0,0,.35); z-index: 5; }
#who { display: inline-block; background: var(--red); color: #fff; font-weight: 800; font-size: 14px; border-radius: 999px; padding: 3px 12px; margin: -30px 0 6px; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
#text { margin: 0; font-size: clamp(17px, 2.3vw, 21px); line-height: 1.45; font-weight: 600; }
#hint { margin-top: 8px; font-size: 15px; font-weight: 800; color: var(--red); }
#hint:empty { display: none; }
#actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 10px; }
#actions:empty { display: none; }
#actions .next { background: var(--red); color: #fff; padding: 12px 22px; font-size: 17px; box-shadow: 0 4px 0 var(--red-dark); }
#actions .choice { background: #fff; color: var(--red); padding: 12px 20px; font-size: 20px; box-shadow: 0 4px 0 var(--red), 0 2px 8px rgba(0,0,0,.15); min-width: 64px; }
#actions button:active, #actions a:active { transform: translateY(3px); box-shadow: none; }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, rgba(23,58,94,.55), rgba(23,58,94,.85)); z-index: 10; padding: 16px; }
.cover-box { text-align: center; color: #fff; max-width: 520px; }
.cover-day { display: inline-block; background: var(--gold); color: var(--red-dark); font-weight: 800; border-radius: 999px; padding: 6px 16px; }
.cover-box h1 { font-size: clamp(34px, 8vw, 64px); margin: 14px 0 6px; text-shadow: 0 4px 0 var(--red), 0 10px 30px rgba(0,0,0,.35); line-height: 1.1; }
.cover-box p { margin: 0 0 20px; font-weight: 700; opacity: .9; }
.cover-box .small { font-size: 14px; margin-top: 16px; opacity: .8; }
button.big { background: #fff; color: var(--red); font-size: 22px; padding: 14px 34px; box-shadow: 0 5px 0 var(--red); }

.card { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; z-index: 6; opacity: 0; transition: opacity .5s; }
.card.on { opacity: 1; }
.card b { font-size: clamp(36px, 9vw, 80px); color: #fff; text-shadow: 0 4px 0 var(--red), 0 10px 30px rgba(0,0,0,.4); }
.card span { font-size: clamp(18px, 3.5vw, 30px); color: #fff; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,.5); }

/* --- kalendārs --- */
body.calendar { min-height: 100%; background: radial-gradient(ellipse at top, #24507e, #0f2440 70%); color: #fff; overflow-x: hidden; }
.cal-head { text-align: center; padding: max(28px, env(safe-area-inset-top)) 16px 8px; }
.cal-head h1 { font-size: clamp(30px, 7vw, 60px); margin: 0; text-shadow: 0 4px 0 var(--red), 0 10px 30px rgba(0,0,0,.35); }
.cal-head p { margin: 8px 0 0; font-weight: 700; opacity: .85; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 30vw), 1fr)); gap: 12px; max-width: 980px; margin: 18px auto 30px; padding: 0 16px; }
.door { position: relative; aspect-ratio: 1; border-radius: 18px; display: flex; flex-direction: column; justify-content: space-between; padding: 10px; color: #fff; text-decoration: none; box-shadow: 0 5px 0 rgba(0,0,0,.3); overflow: hidden; }
.door .n { font-size: clamp(30px, 8vw, 46px); font-weight: 800; line-height: 1; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.door .d { font-size: 12px; font-weight: 700; opacity: .9; }
.door .t { font-size: 13px; font-weight: 800; line-height: 1.2; }
.door.locked { filter: saturate(.35) brightness(.75); cursor: default; }
.door.locked .t { opacity: .8; }
.door.today { outline: 4px solid var(--gold); outline-offset: 2px; animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { outline-color: #fff6c8; } }
.door.soon .t::after { content: " · top…"; opacity: .8; }
.cal-foot { text-align: center; padding: 0 16px 30px; font-weight: 700; }
.cal-foot a { color: #fff; }
.snow { position: fixed; inset: 0; pointer-events: none; background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent), radial-gradient(2px 2px at 80px 120px, #fff, transparent), radial-gradient(3px 3px at 160px 60px, #fff, transparent), radial-gradient(2px 2px at 220px 160px, #fff, transparent); background-size: 260px 200px; animation: fall 12s linear infinite; opacity: .6; }
@keyframes fall { to { background-position: 30px 200px; } }

/* --- pieteikšanās --- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at top, #24507e, #0f2440 70%); }
.login form { background: var(--paper); border-radius: 22px; padding: 26px 22px; width: min(380px, 100%); text-align: center; box-shadow: 0 6px 0 var(--red), 0 18px 40px rgba(0,0,0,.35); }
.login h1 { margin: 0 0 6px; font-size: 26px; }
.login p { margin: 0 0 16px; font-weight: 600; color: #555; }
.login input { width: 100%; font: inherit; font-size: 18px; padding: 12px 14px; border-radius: 14px; border: 2px solid #ddd; margin-bottom: 12px; }
.login button { width: 100%; background: var(--red); color: #fff; font-size: 18px; padding: 12px; box-shadow: 0 4px 0 var(--red-dark); }
.login .err { color: var(--red); font-weight: 800; min-height: 1.2em; }
@media (prefers-reduced-motion: reduce) { .snow, .door.today, .zzz { animation: none; } }
