/* Vánoční okénka: vánoční vzhled mapy izomapa + adventní kalendář okének (okenka.js) */
:root {
  --night: #141b2b;
  --panel: #1d2a24;
  --panel-2: #17221d;
  --edge: #3d5a48;
  --tile: #e2463b;
  --grass: #f2c94c;
  --lamp: #ffd76a;
  --okn-red: #d93a2f;
  --okn-red-d: #9e2219;
  --okn-green: #1f5a3a;
  --okn-green-d: #143d28;
  --okn-gold: #f6c945;
  --okn-gold-d: #c48a17;
  --okn-snow: #f4f7fb;
}

/* cukrová hůl nahoře na panelech + sněhová čepice */
.panel, .card, .okn-box, .okn-card, dialog.help { border-color: var(--edge) !important; }
.panel::before, .okn-box::before, .okn-card::before {
  content: ""; position: absolute; left: -2px; right: -2px; top: -2px; height: 6px; pointer-events: none;
  background: repeating-linear-gradient(-45deg, var(--okn-red) 0 6px, var(--okn-snow) 6px 12px);
}
.panel { position: fixed; padding-top: 18px !important; }
h1 span { color: var(--okn-gold) !important; }

/* girlanda světýlek přes horní okraj obrazovky */
.okn-garland { position: fixed; z-index: 7; left: 0; right: 0; top: 0; height: 18px; pointer-events: none; display: flex; justify-content: space-around;
  background: linear-gradient(var(--okn-green-d), var(--okn-green-d)) 0 3px / 100% 2px no-repeat; }
.okn-garland i { width: 6px; height: 8px; margin-top: 5px; display: block; box-shadow: 0 0 6px currentColor; background: currentColor; animation: okn-blink 1.6s steps(1) infinite; }
.okn-garland i:nth-child(4n+1) { color: #ff5b4f; }
.okn-garland i:nth-child(4n+2) { color: #ffd76a; animation-delay: -.4s; }
.okn-garland i:nth-child(4n+3) { color: #6fd3ff; animation-delay: -.8s; }
.okn-garland i:nth-child(4n+4) { color: #7ee06a; animation-delay: -1.2s; }
@keyframes okn-blink { 0% { opacity: 1; } 50% { opacity: .35; box-shadow: none; } }

/* ---------- kalendář okének ---------- */
.okn-box {
  position: fixed; z-index: 4; top: calc(env(safe-area-inset-top, 0px) + 26px); right: max(16px, env(safe-area-inset-right, 0px));
  width: 292px; box-sizing: border-box; padding: 18px 14px 12px;
  background: var(--panel); border: 2px solid var(--edge); box-shadow: 4px 4px 0 rgba(0, 0, 0, .35); color: var(--ink, #eef1e6);
  font-family: var(--body);
}
.okn-box h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.25rem; line-height: 1.05; color: var(--okn-snow); display: flex; align-items: center; gap: 8px; }
.okn-box h2 svg { width: 26px; height: 26px; flex: none; }
.okn-box .okn-sub { margin: 4px 0 10px; color: var(--muted, #a9b3c4); font-size: .8rem; line-height: 1.35; }
.okn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.okn-toggle { display: none; flex: none; }
.okn-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.okn-door {
  position: relative; aspect-ratio: 1; min-width: 0; padding: 0; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  color: var(--okn-snow); background: var(--okn-green); border: 2px solid var(--okn-green-d);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .28), inset 3px 3px 0 rgba(255, 255, 255, .10), 2px 2px 0 rgba(0, 0, 0, .35);
  display: grid; place-items: center; transition: transform .08s;
}
.okn-door:hover, .okn-door:focus-visible { transform: translateY(-2px); outline: none; }
.okn-door:focus-visible { box-shadow: 0 0 0 2px var(--okn-gold), 2px 2px 0 rgba(0, 0, 0, .35); }
.okn-door:nth-child(3n+2) { background: var(--okn-red); border-color: var(--okn-red-d); }
.okn-door:nth-child(5n+3) { background: #2c4f7a; border-color: #1d3554; }
.okn-door.zavreno { opacity: .78; }
.okn-door.zavreno::after { content: ""; position: absolute; right: 3px; top: 3px; width: 4px; height: 4px; background: var(--okn-snow); box-shadow: 4px 0 0 -0 transparent; opacity: .7; }
.okn-door.hadanka { background: var(--okn-gold); border-color: var(--okn-gold-d); color: #3a2208; animation: okn-wiggle 2.4s ease-in-out infinite; }
.okn-door.hadanka::after { content: "?"; position: absolute; right: 2px; top: -1px; font-size: .7rem; }
.okn-door.otevreno { background: #2a1c12; border-color: #120b06; color: transparent; }
.okn-door.otevreno svg { width: 72%; height: 72%; }
.okn-door.otevreno span { position: absolute; left: 2px; bottom: 0; font-size: .62rem; color: var(--okn-gold); }
.okn-door.dnes { outline: 2px solid var(--okn-snow); outline-offset: 1px; }
.okn-door.dnes.otevreno svg { animation: okn-coin 1.1s infinite; }
@keyframes okn-wiggle { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(-6deg); } 88% { transform: rotate(5deg); } 92% { transform: rotate(-3deg); } 96% { transform: rotate(2deg); } }
.okn-today { margin-top: 10px; padding: 8px 10px; background: var(--panel-2); border: 2px solid var(--edge); font-size: .84rem; line-height: 1.4; }
.okn-today b { font-family: var(--display); color: var(--okn-gold); font-weight: 700; }
.okn-today button { margin-top: 6px; }

.okn-btn {
  font-family: var(--display); font-weight: 700; font-size: .92rem; cursor: pointer; padding: 6px 12px; color: #2a1606;
  background: var(--okn-gold); border: 2px solid var(--okn-gold-d); box-shadow: 2px 2px 0 rgba(0, 0, 0, .4);
}
.okn-btn:hover, .okn-btn:focus-visible { background: #ffe08a; }
.okn-btn.sec { background: var(--panel-2); color: var(--ink, #eef1e6); border-color: var(--edge); }
a.okn-btn { text-decoration: none; display: inline-block; }

/* ---------- karta okénka ---------- */
.okn-card {
  position: fixed; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(400px, calc(100vw - 28px)); max-height: calc(100% - 40px); overflow: auto;
  box-sizing: border-box; padding: 20px 18px 16px; background: var(--panel); border: 2px solid var(--edge); box-shadow: 6px 6px 0 rgba(0, 0, 0, .45);
  color: var(--ink, #eef1e6); font-family: var(--body);
}
.okn-card[hidden] { display: none; }
.okn-card .okn-x { position: absolute; top: 10px; right: 8px; width: 32px; height: 32px; padding: 0; font-size: 1.1rem; }
.okn-card h3 { margin: 0 34px 0 0; font-family: var(--display); font-weight: 700; font-size: 1.45rem; line-height: 1; color: var(--okn-snow); }
.okn-card .okn-date { margin: 4px 0 12px; color: var(--muted, #a9b3c4); font-size: .86rem; }
.okn-riddle { position: relative; margin: 0 0 12px; padding: 12px 14px 12px 40px; background: #f7efd9; color: #3a2a12; border: 2px solid #c9b07a;
  font-size: .98rem; line-height: 1.5; white-space: pre-line; box-shadow: 3px 3px 0 rgba(0, 0, 0, .35); }
.okn-riddle::before { content: "?"; position: absolute; left: 10px; top: 6px; font-family: var(--display); font-weight: 700; font-size: 1.7rem; color: var(--okn-red); }
.okn-riddle.old { opacity: .8; font-size: .9rem; }
.okn-wait { font-size: .92rem; line-height: 1.45; }
.okn-wait b { color: var(--okn-gold); font-family: var(--display); }
.okn-place { display: grid; gap: 4px; margin-bottom: 12px; }
.okn-place .n { font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: var(--okn-gold); }
.okn-place .a { color: var(--muted, #a9b3c4); font-size: .9rem; }
.okn-place .p { font-size: .94rem; line-height: 1.45; white-space: pre-line; }
.okn-place .o { font-size: .86rem; }
.okn-ans { margin: 0 0 12px; font-size: .88rem; color: var(--muted, #a9b3c4); }
.okn-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.okn-shade { position: fixed; inset: 0; z-index: 7; background: rgba(8, 12, 22, .45); }
.okn-shade[hidden] { display: none; }

/* ---------- značky na mapě ---------- */
.okn-mark { position: relative; width: 64px; height: 108px; cursor: pointer; pointer-events: auto; -webkit-tap-highlight-color: transparent; }
.okn-mark .beam { position: absolute; left: 50%; bottom: 6px; width: 6px; height: 62px; transform: translateX(-50%);
  background: linear-gradient(to top, rgba(255, 215, 106, .0), rgba(255, 215, 106, .55) 40%, rgba(255, 240, 190, .9)); image-rendering: pixelated; animation: okn-beam 1.8s ease-in-out infinite; }
.okn-mark .spot { position: absolute; left: 50%; bottom: 0; width: 30px; height: 10px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(rgba(255, 215, 106, .75), rgba(255, 215, 106, 0) 70%); animation: okn-beam 1.8s ease-in-out infinite; }
.okn-mark .bob { position: absolute; left: 50%; top: 0; width: 48px; height: 48px; margin-left: -24px; animation: okn-bob 1.6s ease-in-out infinite; }
.okn-mark .gift { width: 100%; height: 100%; filter: drop-shadow(0 0 6px rgba(255, 220, 120, .9)) drop-shadow(2px 2px 0 rgba(0, 0, 0, .45)); animation: okn-coin 1.1s infinite; }
.okn-mark .num { position: absolute; left: 50%; top: 40px; transform: translateX(-50%); font-family: var(--display); font-weight: 700; font-size: .78rem; line-height: 1;
  padding: 2px 5px; color: #2a1606; background: var(--okn-gold); border: 2px solid var(--okn-gold-d); white-space: nowrap; box-shadow: 2px 2px 0 rgba(0, 0, 0, .4); }
.okn-mark .spark { position: absolute; width: 10px; height: 10px; animation: okn-twinkle 1.4s steps(1) infinite; }
.okn-mark .spark.s1 { left: 0; top: 6px; }
.okn-mark .spark.s2 { right: 0; top: 18px; animation-delay: -.5s; }
.okn-mark .spark.s3 { left: 8px; top: 36px; animation-delay: -1s; }
.okn-mark.past { width: 40px; height: 54px; }
.okn-mark.past .bob { width: 30px; height: 30px; margin-left: -15px; animation: none; }
.okn-mark.past .gift { animation: none; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .45)) saturate(.75); }
.okn-mark.past .beam { height: 18px; animation: none; opacity: .55; }
.okn-mark.past .num { top: 24px; font-size: .68rem; padding: 1px 4px; }
.okn-mark.past .spark, .okn-mark.past .spot { display: none; }
.okn-mark:hover .gift, .okn-mark:focus-visible .gift { filter: drop-shadow(0 0 10px rgba(255, 240, 180, 1)) drop-shadow(2px 2px 0 rgba(0, 0, 0, .45)); }
.okn-mark.pop .bob { animation: okn-pop .7s cubic-bezier(.2, 1.6, .4, 1) 1, okn-bob 1.6s ease-in-out .7s infinite; }
.far .okn-mark.past .num { display: none; }

/* mince z Maria: plná → užší → hrana → užší → plná, po skocích jako sprity */
@keyframes okn-coin {
  0% { transform: scaleX(1); }
  16% { transform: scaleX(.72); }
  33% { transform: scaleX(.38); }
  50% { transform: scaleX(.12); }
  66% { transform: scaleX(.38); }
  83% { transform: scaleX(.72); }
  100% { transform: scaleX(1); }
}
.okn-mark .gift { animation-timing-function: steps(1, end); }
@keyframes okn-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes okn-beam { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }
@keyframes okn-twinkle { 0% { opacity: 1; transform: scale(1); } 33% { opacity: .2; transform: scale(.6); } 66% { opacity: .8; transform: scale(.9); } }
@keyframes okn-pop { 0% { transform: translateY(40px) scale(.2); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }

.okn-toast { position: fixed; z-index: 9; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 30px); transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
  padding: 8px 8px 8px 12px; background: var(--okn-red); color: var(--okn-snow); border: 2px solid var(--okn-red-d); box-shadow: 4px 4px 0 rgba(0, 0, 0, .4);
  font-family: var(--display); font-weight: 700; max-width: calc(100vw - 32px); }
.okn-toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .okn-mark .gift, .okn-mark .bob, .okn-mark .beam, .okn-mark .spot, .okn-door.hadanka, .okn-garland i, .okn-door.dnes.otevreno svg { animation: none !important; }
}

/* ---------- mobil: kalendář jako lišta nad dolním ovládáním, rozbalí se nahoru ---------- */
@media (max-width: 640px) {
  .okn-box { top: auto; right: 8px; left: 8px; width: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); padding: 12px 10px 10px; z-index: 6; }
  .okn-box h2 { font-size: 1.05rem; }
  .okn-box h2 svg { width: 22px; height: 22px; }
  .okn-toggle { display: block; padding: 4px 10px; }
  .okn-box:not(.open) .okn-sub, .okn-box:not(.open) .okn-grid { display: none; }
  .okn-box:not(.open) .okn-today { margin-top: 6px; }
  .okn-box.open { max-height: 72%; overflow: auto; }
  .okn-grid { gap: 5px; }
  .okn-card { top: auto; bottom: 0; transform: translateX(-50%); width: 100vw; max-height: 82%; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .okn-garland { height: 14px; }
}
