:root {
  --ink: #3a2205; --ink2: #6b4310; --cream: #fff8e6; --wax: #fdecb8; --wax2: #f6d887; --gold: #ffc21a; --gold2: #f29a0c;
  --honey: #f5a30f; --honey2: #d97706; --ok: #2f9e44; --bad: #d9480f;
  --display: "Fredoka", "Rubik", system-ui, sans-serif;
  --w: min(92px, 25vw, 14.5dvh);   /* szerokość komórki plastra */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: linear-gradient(180deg, #ffe39a 0%, #ffc457 30%, #f29a38 62%, #b8600f 100%);
  color: var(--ink); font-family: "Rubik", system-ui, sans-serif; overflow: hidden;
}
button { font-family: inherit; color: inherit; }

/* ---------- Słońce i pszczoły w tle ---------- */
.sun { position: fixed; right: -30vmax; top: -30vmax; width: 80vmax; height: 80vmax; pointer-events: none; z-index: 0; }
.sun::before { content: ""; position: absolute; inset: 35%; border-radius: 50%; background: radial-gradient(circle, #fff7d1 0%, #ffe48a 40%, transparent 70%); }
.rays { position: absolute; inset: 0; border-radius: 50%; opacity: .35;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.55) 0 5deg, transparent 5deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%);
  animation: spin 80s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bees { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bee { position: absolute; width: 30px; height: 24px; }
.bee svg { width: 100%; height: 100%; overflow: visible; }
.bee .wing { transform-origin: 50% 100%; animation: flap .06s linear infinite alternate; }
@keyframes flap { to { transform: scaleY(.35); } }
.bee.amb { animation: roam var(--d, 14s) ease-in-out infinite; opacity: .9; }
@keyframes roam {
  0% { transform: translate(var(--x0), var(--y0)) rotate(0deg); }
  25% { transform: translate(var(--x1), var(--y1)) rotate(8deg); }
  50% { transform: translate(var(--x2), var(--y2)) rotate(-6deg) scaleX(-1); }
  75% { transform: translate(var(--x3), var(--y3)) rotate(5deg) scaleX(-1); }
  100% { transform: translate(var(--x0), var(--y0)) rotate(0deg); }
}

/* ---------- Szkielet ---------- */
.app { position: relative; z-index: 1; max-width: 480px; height: 100dvh; margin: 0 auto; display: flex; flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) 14px max(10px, env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 8px; height: 44px; flex: none; }
.brand { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--ink); margin-right: auto; white-space: nowrap; text-shadow: 0 1px 0 rgba(255,255,255,.6); }
.stat { font-weight: 900; font-size: 15px; background: rgba(255,248,230,.75); border-radius: 99px; padding: 6px 12px; white-space: nowrap; box-shadow: 0 2px 0 rgba(58,34,5,.15); }
.stat.low { color: #fff; background: var(--bad); animation: pulse .5s ease-in-out infinite alternate; }
.drops::before { content: "🍯 "; }
@keyframes pulse { to { transform: scale(1.08); } }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,248,230,.75); font-size: 20px; cursor: pointer; flex: none; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- Wybór ula ---------- */
#pick { justify-content: center; gap: 14px; text-align: center; }
.title { font-family: var(--display); font-weight: 700; margin: 0; font-size: clamp(32px, 9.5vw, 44px); color: var(--cream); text-shadow: 0 3px 0 var(--honey2), 0 6px 18px rgba(120,60,0,.35); }
.sub { margin: 0; color: var(--ink); line-height: 1.45; font-size: 15px; }
.hives { display: grid; gap: 12px; margin-top: 6px; }
.hive { display: flex; align-items: center; gap: 14px; min-height: 86px; padding: 10px 16px 10px 12px; border: 0; border-radius: 24px; cursor: pointer; text-align: left;
  background: rgba(255,248,230,.88); box-shadow: 0 6px 0 rgba(122,62,5,.45); transition: transform .12s; animation: pop .45s backwards; }
.hive:nth-child(2) { animation-delay: .08s; } .hive:nth-child(3) { animation-delay: .16s; }
.hive:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(122,62,5,.45); }
.skep { position: relative; width: 62px; height: 62px; flex: none; }
.skep::before { content: ""; position: absolute; inset: 0 4px 0; border-radius: 50% 50% 14px 14px / 62% 62% 14px 14px;
  background: repeating-linear-gradient(180deg, var(--hc) 0 10px, color-mix(in srgb, var(--hc) 70%, #000) 10px 13px); box-shadow: inset -6px -4px 0 rgba(0,0,0,.12); }
.skep i { position: absolute; left: 50%; bottom: 6px; width: 16px; height: 12px; margin-left: -8px; border-radius: 8px 8px 2px 2px; background: #2a1600; }
.hive.green { --hc: #7cbf4a; } .hive.yellow { --hc: #f2b81c; } .hive.black { --hc: #3b3330; }
.htxt { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.htxt b { font-family: var(--display); font-weight: 700; font-size: 23px; }
.htxt small { color: var(--ink2); font-size: 13.5px; line-height: 1.3; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.96); } }

/* ---------- Status: słoik + mały plaster ---------- */
.play { gap: 6px; align-items: center; }
.status { flex: none; width: 100%; display: flex; align-items: center; gap: 12px; height: 74px; }
.jar { position: relative; width: 56px; height: 70px; flex: none; }
.jar .lid { position: absolute; left: 6px; right: 6px; top: 0; height: 12px; border-radius: 5px; background: linear-gradient(180deg, #e0573a, #a8321b);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.jar .lid::after { content: ""; position: absolute; left: 4px; right: 4px; top: 3px; height: 2px; background: repeating-linear-gradient(90deg, #fff 0 4px, transparent 4px 8px); opacity: .6; }
.jar .glass { position: absolute; left: 2px; right: 2px; top: 10px; bottom: 0; border-radius: 10px 10px 16px 16px; overflow: hidden;
  background: rgba(255,255,255,.45); box-shadow: inset 0 0 0 3px rgba(255,255,255,.8), inset 6px 0 0 rgba(255,255,255,.35), 0 3px 0 rgba(122,62,5,.3); }
.honey { position: absolute; left: 0; right: 0; bottom: 0; height: 0%; transition: height .6s cubic-bezier(.3,1.4,.5,1);
  background: linear-gradient(180deg, #ffcf3f, var(--honey) 40%, var(--honey2)); }
.honey i { position: absolute; left: -10%; right: -10%; top: -5px; height: 10px; border-radius: 50%; background: #ffd75a; animation: slosh 2.4s ease-in-out infinite; }
@keyframes slosh { 50% { transform: translateX(6%) scaleY(.7); } }
.jar.full { animation: jarPop .7s ease; }
@keyframes jarPop { 30% { transform: scale(1.25) rotate(-8deg); } 60% { transform: scale(.95) rotate(5deg); } }
.jar-count { position: absolute; right: -14px; bottom: -6px; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--cream);
  background: var(--honey2); border-radius: 99px; padding: 1px 8px; box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.cells { flex: 1; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 2px 0; padding-left: 8px; }
.cell { width: 26px; height: 23px; margin: 0 -1px; position: relative; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); background: rgba(255,248,230,.55); }
.cell:nth-child(n+8) { transform: translateX(13px); }
.cell::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #ffd75a, var(--honey)); transform: scaleY(0); transform-origin: 50% 100%; transition: transform .5s ease; }
.cell.on::after { transform: scaleY(1); }
.cell.on.fresh { animation: cellPop .6s ease; }
@keyframes cellPop { 40% { transform: scale(1.4); } }

/* ---------- Plaster ---------- */
.comb-wrap { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.comb { position: relative; width: calc(var(--w) * 2.6); height: calc(var(--w) * .866 * 3.08); transition: transform .2s; }
.comb.shake { animation: wobble .45s ease; }
@keyframes wobble { 20% { transform: rotate(-4deg) translateX(-6px); } 45% { transform: rotate(3deg) translateX(5px); } 70% { transform: rotate(-1.5deg); } }
.hex { position: absolute; left: 50%; top: 50%; width: var(--w); height: calc(var(--w) * .866); margin: calc(var(--w) * -.433) 0 0 calc(var(--w) * -.5);
  transform: translate(calc(var(--x) * var(--w)), calc(var(--y) * var(--w) * .866)); border: 0; padding: 0; cursor: pointer;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  background: linear-gradient(180deg, var(--cream), var(--wax2)); font-family: var(--display); font-weight: 700; font-size: calc(var(--w) * .42); color: var(--ink);
  transition: transform .35s cubic-bezier(.3,1.4,.5,1), filter .1s; }
.hex::before { content: ""; position: absolute; inset: 5px; clip-path: inherit; background: linear-gradient(180deg, #fff9e8, var(--wax)); z-index: 0; }
.hex::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,215,90,.95), rgba(245,163,15,.95)); transform: scaleY(0); transform-origin: 50% 100%; transition: transform .35s ease; z-index: 0; }
.hex span { position: relative; z-index: 1; text-transform: uppercase; }
.hex.center { background: linear-gradient(180deg, #ffd34d, var(--gold2)); }
.hex.center::before { background: linear-gradient(180deg, #ffe27a, var(--gold)); }
.hex.center span { color: #3a1d00; }
.hex:active { filter: brightness(.92); }
.hex.tap span { animation: tapL .18s ease; }
@keyframes tapL { 50% { transform: scale(1.25); display: inline-block; } }
.hex.fill::after { transform: scaleY(1); }
.comb.out .hex:not(.center) { transform: translate(0, 0) scale(.5); }

.word-line { flex: none; height: 46px; min-width: 120px; max-width: 100%; align-self: center; padding: 0 16px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 1px;
  background: rgba(255,248,230,.92); box-shadow: 0 3px 0 rgba(122,62,5,.3); color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: .04em; text-transform: uppercase; overflow: hidden; }
.word-line #word { display: flex; gap: 1px; }
.word-line #word span { display: inline-block; min-width: .7em; text-align: center; }
.word-line .c { color: #3a1d00; background: linear-gradient(180deg, #ffd34d, #f5a30f); border-radius: 7px; padding: 0 3px; box-shadow: inset 0 0 0 2px #b8600f; }
.word-line .x { color: #b9b0a0; text-decoration: line-through; }
.caret { width: 3px; height: 30px; margin-left: 2px; background: var(--ink); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.word-line.bad { animation: wobble .4s ease; }
.msg { flex: none; margin: 0; min-height: 22px; text-align: center; font-weight: 700; font-size: 15px; color: var(--ink2); }
.msg.ok { color: #1f6b2d; } .msg.bad { color: #a8320b; } .msg.live { color: var(--ink); font-style: italic; }

/* Sterowanie */
.controls { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.ctl { position: relative; width: 52px; height: 52px; border: 0; border-radius: 50%; background: rgba(255,248,230,.88); font-size: 22px; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 rgba(122,62,5,.4); }
.ctl:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(122,62,5,.4); }
.ctl small { position: absolute; right: -2px; top: -2px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--honey2); color: #fff; font-size: 12px; line-height: 20px; }
.ctl:disabled { opacity: .45; }
.ctl.enter { background: #2f9e44; color: #fff; }
.mic { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #ffe27a, var(--gold) 45%, var(--gold2)); color: #3a1d00; box-shadow: 0 6px 0 #9a5a06, 0 0 0 6px rgba(255,248,230,.35); }
.mic:active { transform: translateY(4px); box-shadow: 0 2px 0 #9a5a06; }
.mic-ico { font-size: 30px; line-height: 1; } .mic-lbl { font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.mic.on { background: radial-gradient(circle at 35% 30%, #ff9b6b, #e8590c 55%, #a8320b); color: #fff; box-shadow: 0 6px 0 #6b1f06; }
.mic.on::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid #e8590c; animation: ring 1s ease-out infinite; }
.mic.off { filter: grayscale(1); opacity: .5; }
@keyframes ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }

.found { flex: none; width: 100%; height: 40px; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 4px 2px; scrollbar-width: none; }
.found::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 30px; padding: 0 10px; border: 0; border-radius: 99px; background: rgba(255,248,230,.85); font-weight: 700; font-size: 14px; cursor: pointer; animation: pop .35s backwards; }
.chip.rare { background: #fff1c2; box-shadow: inset 0 0 0 2px var(--honey); }
.chip.pan { background: linear-gradient(90deg, #ffd34d, #f29a0c); color: #3a1d00; }

/* ---------- Tablica pszczelarza ---------- */
.board { gap: 8px; text-align: center; padding-top: 4px; }
.jars { flex: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; min-height: 56px; }
.jars .mini { width: 40px; height: 52px; position: relative; animation: pop .4s backwards; }
.jars .mini::before { content: ""; position: absolute; left: 5px; right: 5px; top: 0; height: 9px; border-radius: 4px; background: #c9432a; }
.jars .mini::after { content: ""; position: absolute; left: 1px; right: 1px; top: 8px; bottom: 0; border-radius: 8px 8px 12px 12px; background: linear-gradient(180deg, #ffcf3f, var(--honey2)); box-shadow: inset 4px 0 0 rgba(255,255,255,.35); }
.jars .mini.part::after { background: linear-gradient(180deg, rgba(255,255,255,.5) var(--empty), #ffcf3f var(--empty), var(--honey2)); }
.pangram-box { flex: none; background: rgba(255,248,230,.85); border-radius: 16px; padding: 10px 14px; font-size: 14.5px; line-height: 1.4; text-align: left; }
.pangram-box b { font-family: var(--display); font-size: 17px; }
.pangram-box .big { text-transform: uppercase; letter-spacing: .06em; color: var(--honey2); }
.words { list-style: none; margin: 0; padding: 0 2px; flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; }
.words li { display: flex; align-items: center; gap: 6px; background: rgba(255,248,230,.8); border-radius: 12px; padding: 4px 4px 4px 10px; text-align: left; }
.words .w { flex: 1; min-width: 0; font-weight: 900; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.words .d { font-size: 12px; color: var(--ink2); font-weight: 700; white-space: nowrap; }
.words li.pan { background: linear-gradient(90deg, #ffe27a, #ffc21a); }
.words li.rare .w::after { content: " ✦"; color: var(--honey2); }
.say { flex: none; width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--honey); font-size: 17px; cursor: pointer; }
.say.on { animation: blink .5s steps(2) infinite; }
.words .empty { grid-column: 1 / -1; justify-content: center; color: var(--ink2); font-weight: 700; padding: 12px; }
.cta { flex: none; height: 58px; border: 0; border-radius: 99px; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 22px; color: #3a1d00;
  background: linear-gradient(180deg, #ffe27a, var(--gold)); box-shadow: 0 6px 0 #9a5a06; }
.cta:active { transform: translateY(4px); box-shadow: 0 2px 0 #9a5a06; }

/* ---------- Efekty ---------- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.pt { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.drop { position: absolute; left: 0; top: 0; width: 14px; height: 20px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 35% 35%, #ffe68a, var(--honey) 55%, var(--honey2)); will-change: transform; }
.float { position: absolute; font-family: var(--display); font-weight: 700; font-size: 26px; color: #fff; text-shadow: 0 2px 0 var(--honey2), 0 0 10px rgba(0,0,0,.2); animation: rise 1.1s ease-out forwards; white-space: nowrap; }
.banner { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 700; font-size: clamp(44px, 14vw, 72px); color: #fff;
  text-shadow: 0 4px 0 var(--honey2), 0 0 30px rgba(255,200,40,.9); animation: bannerIn 1.8s ease forwards; white-space: nowrap; }
@keyframes rise { to { transform: translateY(-70px); opacity: 0; } }
@keyframes bannerIn { 0% { transform: translate(-50%, -50%) scale(.2) rotate(-10deg); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.15) rotate(3deg); opacity: 1; }
  35% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1.05); } }
.drip { position: fixed; top: 0; z-index: 4; width: 18px; border-radius: 0 0 9px 9px; background: linear-gradient(180deg, var(--honey2), var(--honey)); pointer-events: none; animation: drip 2.6s ease-in forwards; }
@keyframes drip { from { height: 0; } 60% { opacity: 1; } to { height: 45vh; opacity: 0; } }

@media (max-height: 660px) {
  .status { height: 60px; } .jar { transform: scale(.85); } .mic { width: 72px; height: 72px; } .ctl { width: 46px; height: 46px; }
  .word-line { height: 40px; font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
.chip.dict { background: rgba(255,248,230,.55); color: var(--ink2); font-weight: 500; }
.words li.dict .w { font-weight: 600; color: var(--ink2); }
