/* css/craft.css — הסדנה של קורט (craft.html / js/craft.js) */
.craft-page { display: grid; gap: 18px; }
.craft-head h1 { margin: 0 0 4px; }
.small { font-size: .82rem; }

/* ── השמיים (לפי שעון המשחק) ── */
.sky { position: relative; height: 210px; border-radius: 22px; overflow: hidden; isolation: isolate;
       box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 10px 30px rgba(0,0,0,.25);
       background: linear-gradient(#3e9bff, #d9f1ff); }
.sky[data-phase="dawn"]  { background: linear-gradient(#3b2a6b 0%, #f2789b 55%, #ffd29b 100%); }
.sky[data-phase="day"]   { background: linear-gradient(#3e9bff 0%, #8fd0ff 60%, #d9f1ff 100%); }
.sky[data-phase="dusk"]  { background: linear-gradient(#2a1b5c 0%, #c2457a 45%, #ff9b54 80%, #ffd27a 100%); }
.sky[data-phase="night"] { background: linear-gradient(#050a1f 0%, #101a42 60%, #1d2b5e 100%); }
.sky-stars { position: absolute; inset: 0; opacity: 0; transition: opacity 2s ease;
  background-image: radial-gradient(1.5px 1.5px at 12% 20%, #fff, transparent), radial-gradient(1px 1px at 30% 40%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 48% 12%, #fff, transparent), radial-gradient(1px 1px at 62% 30%, #fff, transparent),
    radial-gradient(2px 2px at 78% 18%, #fff, transparent), radial-gradient(1px 1px at 88% 44%, #fff, transparent),
    radial-gradient(1px 1px at 22% 58%, #fff, transparent), radial-gradient(1.5px 1.5px at 70% 52%, #fff, transparent),
    radial-gradient(1px 1px at 5% 46%, #fff, transparent), radial-gradient(1px 1px at 40% 64%, #fff, transparent);
  animation: twinkle 4s ease-in-out infinite alternate; }
.sky[data-phase="night"] .sky-stars { opacity: 1; }
.sky[data-phase="dusk"] .sky-stars, .sky[data-phase="dawn"] .sky-stars { opacity: .35; }
@keyframes twinkle { to { filter: brightness(.55); } }
.sky-body { position: absolute; width: 56px; height: 56px; border-radius: 50%; transform: translate(50%, -50%);
            transition: right 1s linear, top 1s linear; z-index: 1; }
.sky-body.sun  { background: radial-gradient(circle at 40% 40%, #fffbe0, #ffd84a 55%, #ffa31a);
                 box-shadow: 0 0 30px 10px rgba(255,214,74,.55), 0 0 80px 30px rgba(255,170,40,.25); }
.sky-body.moon { background: radial-gradient(circle at 35% 35%, #ffffff, #dfe6f5 60%, #b6c2dd);
                 box-shadow: 0 0 24px 6px rgba(220,230,255,.35); }
.sky-body.moon::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; top: 14px; left: 14px;
                        background: rgba(150,165,200,.5); box-shadow: 18px 14px 0 -2px rgba(150,165,200,.45); }
.sky-hills { position: absolute; inset: auto 0 0 0; height: 46%; z-index: 2; }
.sky-hills svg { width: 100%; height: 100%; display: block; }
.sky-hills .h1 { fill: #3f8f4a; transition: fill 2s; }
.sky-hills .h2 { fill: #2f7a3a; transition: fill 2s; }
.sky[data-phase="night"] .h1 { fill: #12301f; }
.sky[data-phase="night"] .h2 { fill: #0c2416; }
.sky[data-phase="dusk"] .h1, .sky[data-phase="dawn"] .h1 { fill: #4a3a52; }
.sky[data-phase="dusk"] .h2, .sky[data-phase="dawn"] .h2 { fill: #35283f; }
.hut { position: absolute; bottom: 8px; left: 7%; width: 112px; z-index: 3; }
.hut svg { width: 100%; overflow: visible; }
.hut .win { fill: #93c5fd; transition: fill 1.5s; }
.sky[data-phase="night"] .hut .win, .sky[data-phase="dusk"] .hut .win { fill: #fde047; filter: drop-shadow(0 0 6px #fbbf24); }
.hut .smoke circle { fill: rgba(226,232,240,.75); opacity: 0; }
.hut.working .smoke circle { animation: smoke 2.6s ease-out infinite; }
.hut.working .smoke circle:nth-child(2) { animation-delay: .8s; }
.hut.working .smoke circle:nth-child(3) { animation-delay: 1.6s; }
@keyframes smoke { 0% { opacity: 0; transform: translateY(8px) scale(.6); } 30% { opacity: .9; }
                   100% { opacity: 0; transform: translate(-10px, -26px) scale(1.6); } }
.sky-info { position: absolute; top: 14px; right: 16px; z-index: 4; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.45);
            background: rgba(0,0,0,.25); padding: 10px 14px; border-radius: 16px; backdrop-filter: blur(4px); max-width: 72%; }
.sky-time { font: 900 1.9rem/1 var(--font-num); display: flex; align-items: center; gap: 8px; }
.sky-phase { font-size: .85rem; margin-top: 4px; opacity: .92; }
.sky-dusk { font-size: .85rem; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sky-dusk .item-icon { vertical-align: middle; }
.sky-dusk .muted { color: #e2e8f0; }
.dusk-on { color: #bef264; font-weight: 800; }

/* ── הכרטיסים ── */
.craft-grid { display: grid; gap: 18px; grid-template-columns: 1.1fr 1fr; }
.queue-card { grid-column: 1 / -1; }
.craft-card { background: var(--bg-secondary); border-radius: 20px; padding: 16px 18px;
              box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
.craft-card h2 { margin: 0 0 6px; font-size: 1.15rem; }

/* מדף ה-Apricorns */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 10px; }
.apri { position: relative; display: grid; justify-items: center; gap: 2px; padding: 10px 6px 8px; border-radius: 16px; cursor: pointer;
        border: 0; color: inherit; font: inherit;
        background: linear-gradient(180deg, color-mix(in srgb, var(--ac) 22%, transparent), rgba(0,0,0,.12));
        box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ac) 55%, transparent); transition: transform .15s ease; }
.apri:hover { transform: translateY(-3px) rotate(-2deg); }
.apri:active { transform: scale(.94); }
.apri.empty { opacity: .45; filter: grayscale(.6); }
.apri-ic { animation: sway 3s ease-in-out infinite; transform-origin: 50% 0; }
.apri:nth-child(2n) .apri-ic { animation-delay: -1.2s; }
@keyframes sway { 50% { transform: rotate(6deg); } }
.apri-name { font-weight: 800; font-size: .9rem; }
.apri-qty { position: absolute; top: 6px; left: 8px; font: 900 1rem var(--font-num); background: rgba(0,0,0,.45); color: #fff;
            min-width: 24px; padding: 0 6px; border-radius: 99px; }
.apri-where { font-size: .72rem; opacity: .85; }

/* הסיר */
.pot-wrap { display: grid; justify-items: center; gap: 10px; }
.pot { position: relative; width: min(260px, 100%); aspect-ratio: 200 / 150; --brew: #111827; }
.pot-svg { position: absolute; inset: auto 0 0 0; width: 100%; }
.pot .brew { fill: var(--brew); transition: fill .4s ease; }
.pot.match .brew { filter: drop-shadow(0 0 10px #fde047); }
.pot-slots { position: absolute; inset: 0 0 auto 0; height: 64px; z-index: 2; display: flex; justify-content: center; align-items: flex-end; }
.pot-apri { border: 0; background: none; padding: 0; margin: 0 -6px; cursor: pointer; animation: bob 1.6s ease-in-out infinite;
            animation-delay: calc(var(--i) * -.25s); }
.pot-apri:hover { filter: brightness(1.2) drop-shadow(0 0 4px #fff); }
@keyframes bob { 50% { transform: translateY(-6px) rotate(8deg); } }
.pot-steam { position: absolute; inset: -4px 0 auto 0; display: flex; justify-content: center; gap: 22px; z-index: 1; pointer-events: none; }
.pot-steam i { width: 10px; height: 26px; border-radius: 99px; background: rgba(255,255,255,.35); opacity: 0; }
.pot.match .pot-steam i, .pot.brewing .pot-steam i { animation: steam 1.8s ease-out infinite; }
.pot-steam i:nth-child(2) { animation-delay: .6s !important; }
.pot-steam i:nth-child(3) { animation-delay: 1.2s !important; }
@keyframes steam { 0% { opacity: 0; transform: translateY(14px) scaleY(.6); } 40% { opacity: .9; }
                   100% { opacity: 0; transform: translateY(-22px) scaleY(1.3); } }
.pot.fail { animation: potShake .6s ease; }
.pot.fail .pot-apri { animation: popOut .6s ease forwards; }
@keyframes potShake { 15%, 45%, 75% { transform: translateX(-8px) rotate(-3deg); } 30%, 60%, 90% { transform: translateX(8px) rotate(3deg); } }
@keyframes popOut { to { transform: translateY(-70px) rotate(200deg); opacity: 0; } }
.pot.brewing { animation: brewPulse .9s ease; }
@keyframes brewPulse { 40% { transform: scale(1.08); filter: drop-shadow(0 0 24px #f59e0b); } }
.pot-result { min-height: 34px; text-align: center; display: flex; align-items: center; }
.pr-ok { display: inline-flex; align-items: center; gap: 6px; color: #fbbf24; font-weight: 700; }
.pr-unknown { color: var(--text-secondary); font-size: .9rem; }
.pot-actions { display: flex; gap: 10px; }
.brew-qty { display: flex; align-items: center; gap: 8px; margin-block-end: 10px; }
.brew-qty[hidden] { display: none; }
.bq-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06); color: inherit; font-size: 1.2rem; cursor: pointer; }
.bq-num { min-width: 42px; text-align: center; font-size: 1.1rem; direction: ltr; }
.bq-max { padding: 6px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06); color: inherit; cursor: pointer; font-size: .9rem; }
.bq-btn:disabled, .bq-max:disabled { opacity: .5; cursor: not-allowed; background: transparent; border-style: dashed; }
.fly-apri { position: fixed; z-index: 9999; pointer-events: none; }

/* התור — טבעת התקדמות סביב כל כדור */
.queue-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.queue { position: relative; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.qslot { position: relative; display: grid; justify-items: center; gap: 4px; }
.qslot.empty::before { content: ""; width: 58px; max-width: 100%; aspect-ratio: 1; border-radius: 50%;
                       border: 2px dashed rgba(127,127,127,.3); box-sizing: border-box; }
.q-ring { width: 58px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; padding: 5px;
          box-sizing: border-box; background: conic-gradient(#fbbf24 calc(var(--p) * 1%), rgba(127,127,127,.18) 0); }
.q-ring > * { background: var(--bg-primary, #0b1122); border-radius: 50%; padding: 5px; width: 100% !important; height: auto !important;
              box-sizing: border-box; }
.qslot.wait { opacity: .55; }
.qslot.active .q-ring > * { animation: wobble 1.2s ease-in-out infinite; }
@keyframes wobble { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.qslot.ready .q-ring { background: #4ade80; animation: readyGlow 1.4s ease-in-out infinite; }
@keyframes readyGlow { 50% { box-shadow: 0 0 18px 4px rgba(74,222,128,.6); } }
.q-time { font: 700 .78rem var(--font-num); }
.qslot.ready .q-time { color: #4ade80; }
.spark { position: absolute; top: 40%; left: 50%; width: 8px; height: 8px; border-radius: 50%; pointer-events: none;
         animation: spark .9s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }

/* ספר המתכונים */
.recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-top: 10px; }
.recipe { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 16px;
          background: rgba(0,0,0,.12); box-shadow: inset 0 0 0 1px rgba(127,127,127,.15); }
.recipe.can { box-shadow: inset 0 0 0 2px rgba(74,222,128,.5); }
.rc-ball { display: grid; justify-items: center; gap: 2px; }
.recipe.can .rc-ball .item-icon { animation: bob 2s ease-in-out infinite; }
.rc-own { font-size: .72rem; color: var(--text-secondary); }
.rc-body h3 { margin: 0; font-size: 1rem; }
.rc-desc { margin: 2px 0 6px; font-size: .8rem; color: var(--text-secondary); }
.rc-needs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.need { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 4px; border-radius: 99px; font-size: .8rem;
        background: color-mix(in srgb, var(--ac) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac) 50%, transparent); }
.need b { font-family: var(--font-num); }
.need.miss b { color: #f87171; }
.need.ok b { color: #22c55e; }
.plus { opacity: .6; font-weight: 800; }
.rc-btn { white-space: nowrap; }

/* הכדורים שלי */
.my-balls { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.mb { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 14px; background: rgba(0,0,0,.12); }
.mb.none { opacity: .5; }
.mb-qty { font: 800 .9rem var(--font-num); color: var(--accent-secondary); }

@media (max-width: 760px) {
  .craft-grid { grid-template-columns: 1fr; }
  .queue { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .recipes { grid-template-columns: 1fr; }
  .recipe { grid-template-columns: auto 1fr; }
  .rc-btn { grid-column: 1 / -1; }
  .sky { height: 190px; }
  .sky-time { font-size: 1.5rem; }
  .hut { width: 84px; }
}

/* רשימת הבדיקה בפרונט: מי שביקש פחות תנועה — האנימציות נגמרות מיד (מצב הסיום נשמר) */
@media (prefers-reduced-motion: reduce) {
  .craft-page *, .hut *, .apri-ic, .pot, .pot *, .qslot *, .recipe * { animation-duration: .01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
}
