/* ===== Cozy laptop shell: chef panel | game | stats board, on a kitchen wall (loaded last) ===== */
:root { --wood1: #c7925c; --wood2: #8a5a35; --wood3: #6b4226; --wall-stripe: rgba(255,255,255,.22); --wall-dot: rgba(120,70,30,.06); --font: "Fredoka", "Trebuchet MS", "Segoe UI", system-ui, sans-serif; }
body[data-theme="night"] { --pill: rgba(255,255,255,.08); --wood1: #6a5a8e; --wood2: #463a6b; --wood3: #2f2850; --wall-stripe: rgba(255,255,255,.05); --wall-dot: rgba(255,255,255,.05); }
body[data-theme="mint"] { --wood1: #b9905f; --wood2: #7d5634; }

body { font-family: var(--font); background: var(--bg); display: block; min-height: 100vh; overflow: hidden; }
button { font-family: var(--font); }
h1, h2, h3, h4, b, .play, .tile b { font-family: var(--font); }

/* ---------- the kitchen wall (behind everything) ---------- */
#wall { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(180deg, transparent calc(100% - 46px), var(--wood3) calc(100% - 46px) calc(100% - 40px), var(--wood1) calc(100% - 40px), var(--wood2)),
    repeating-linear-gradient(90deg, var(--wall-stripe) 0 18px, transparent 18px 52px),
    radial-gradient(circle, var(--wall-dot) 2px, transparent 2.5px) 0 0 / 26px 26px,
    url("../images/misc/bg_kitchen.png") center / cover,
    linear-gradient(180deg, var(--bg), var(--bg2)); }
#wall::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(80,40,10,.16)); }

/* string lights (built in JS for the window size) */
#lights { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
#lights svg { display: block; overflow: visible; }
#lights .wires path { fill: none; stroke: #4a3a2a; stroke-width: 2; opacity: .85; }
#lights .bulb rect { fill: #6b6b6b; }
#lights .bulb ellipse { fill: var(--c); filter: drop-shadow(0 0 5px var(--c)) drop-shadow(0 0 12px var(--c)); animation: twinkle 2.8s ease-in-out infinite; animation-delay: var(--d); }
@keyframes twinkle { 0%, 100% { opacity: 1; } 45% { opacity: .55; } 55% { opacity: .9; } }

/* ---------- 3-column shell ---------- */
#shell { position: relative; z-index: 1; height: 100vh; display: grid; grid-template-columns: 290px minmax(0, 1fr) 300px; gap: 22px; padding: 44px 30px 54px; }
main { max-width: none; margin: 0; padding: 0; min-width: 0; height: 100%; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.panel { position: relative; min-height: 0; overflow-y: auto; scrollbar-width: none; border-radius: 26px; padding: 16px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: 0 0 0 6px var(--wood1), 0 0 0 9px var(--wood2), 0 16px 30px rgba(60,30,10,.28); }
.panel::-webkit-scrollbar { display: none; }
body[data-screen="profile"] #left, body[data-screen="profile"] #right, body:not([data-screen]) #left, body:not([data-screen]) #right { display: none; }
body[data-screen="profile"] #shell, body:not([data-screen]) #shell { grid-template-columns: 1fr; }
#topbar { display: none !important; }

/* ---------- left: the chef ---------- */
#left { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.portrait { position: relative; width: 100%; height: clamp(220px, 38vh, 380px); display: flex; justify-content: center; align-items: flex-end; border-radius: 20px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 85%, color-mix(in srgb, var(--accent) 22%, #fff) 0 35%, transparent 70%), linear-gradient(180deg, var(--bg2), var(--bg)); box-shadow: inset 0 0 0 3px var(--line), inset 0 -18px 30px rgba(80,40,10,.12); }
.portrait::before { content: ""; position: absolute; inset: 10px; border-radius: 14px; border: 2px dashed color-mix(in srgb, var(--line) 80%, transparent); pointer-events: none; }
.pfig { position: relative; height: 92%; aspect-ratio: var(--ar); max-width: 100%; animation: breathe 5s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes breathe { 50% { transform: scale(1.012) translateY(-1px); } }
.pimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 6px 10px rgba(60,30,10,.25)); }
.pemoji { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 120px; }
.toque { position: absolute; left: var(--hx); top: var(--hy); width: var(--hw); transform: translate(-50%, -82%) rotate(var(--hr)); filter: drop-shadow(0 4px 4px rgba(0,0,0,.18)); transition: fill .3s; }
.apron { position: absolute; left: var(--ax); bottom: 0; width: var(--aw); height: var(--ah); transform: translateX(-50%); filter: drop-shadow(0 -2px 3px rgba(0,0,0,.15)); }
.nameplate { width: 100%; display: grid; gap: 4px; justify-items: center; background: linear-gradient(180deg, var(--wood1), var(--wood2)); color: #fff7ea; border-radius: 16px; padding: 8px 12px 10px; box-shadow: 0 4px 0 var(--wood3); }
.nameplate b { font-size: 1.35rem; letter-spacing: .5px; text-shadow: 0 2px 0 var(--wood3); }
.nameplate small { opacity: .9; font-size: .82rem; }
.nameplate .lvl-row { width: 100%; background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); }

/* our photo, hung on a nail */
.photoframe { position: relative; margin: 14px 0 0; width: min(210px, 80%); transform: rotate(-2.5deg); animation: swing 7s ease-in-out infinite; transform-origin: 50% -14px; }
@keyframes swing { 50% { transform: rotate(-1deg); } }
.photoframe .nail { position: absolute; left: 50%; top: -16px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ddd, #666); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.photoframe .nail::after { content: ""; position: absolute; left: 4px; top: 5px; width: 90px; height: 2px; background: #6b5a48; transform-origin: 0 0; transform: rotate(28deg) translateX(-45px) rotate(-28deg); display: none; }
.photoframe::before, .photoframe::after { content: ""; position: absolute; top: -11px; width: 52%; height: 2px; background: #6b5a48; }
.photoframe::before { left: 0; transform-origin: right; transform: rotate(-17deg); } .photoframe::after { right: 0; transform-origin: left; transform: rotate(17deg); }
.fwood { padding: 11px; border-radius: 6px; background: linear-gradient(135deg, #b47a46, #7a4a26 40%, #a86e3c 60%, #6a3f20); box-shadow: 0 10px 18px rgba(50,25,8,.35), inset 0 0 0 2px rgba(255,255,255,.15); }
.fmat { background: #fbf6ec; padding: 9px; box-shadow: inset 0 0 6px rgba(0,0,0,.25); }
.fmat img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: 50% 30%; filter: saturate(1.05) contrast(1.02); }

/* little shelf at the bottom: plant + Dante */
.sill { margin-top: auto; width: 100%; min-height: 26px; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 10px; border-bottom: 12px solid var(--wood1); box-shadow: 0 6px 0 var(--wood2); border-radius: 0 0 4px 4px; }
.sill:empty { border-bottom-width: 0; box-shadow: none; min-height: 0; }
.plant { width: 86px; height: 108px; margin-bottom: -2px; }
.plant .leaves { transform-origin: 60px 92px; animation: sway 6s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(3deg); } }
.sill .dantecat { height: 78px; margin-left: auto; }

/* ---------- right: stats board ---------- */
#right { display: flex; flex-direction: column; gap: 12px; }
.rtop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rtop .coinpill { font-size: 1.15rem; padding: 6px 16px; }
.rchips { display: flex; flex-wrap: wrap; gap: 6px; }
.rchips .chip { font-size: .85rem; }
.statcard { display: grid; gap: 2px; background: var(--pill); border: 2px solid var(--line); border-radius: 16px; padding: 8px 12px; }
.srow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; font-size: .9rem; border: 0; border-bottom: 1px dashed var(--line); border-radius: 0; background: none; box-shadow: none; text-align: left; width: 100%; }
.srow:last-child { border-bottom: 0; } .srow b { font-variant-numeric: tabular-nums; }
.srow.link:hover { transform: none; color: var(--accent); }
#right .weekly.mini { width: 100%; }
.sidenav { display: grid; gap: 7px; margin-top: auto; }
.sidenav button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 12px; border-radius: 14px; font-size: .92rem; }
.sidenav button span { font-size: 1.25rem; width: 26px; text-align: center; }
#sideRun { display: none; flex-direction: column; gap: 10px; }
body[data-screen="game"] #sideRun { display: flex; } body[data-screen="game"] #sideHub { display: none; }
#sideHub { display: flex; flex-direction: column; gap: 12px; flex: 1; }
/* the day's HUD, stacked */
#right #g-head { flex-direction: column; align-items: stretch; gap: 10px; margin: 0; }
#right #g-head .pill { text-align: center; font-size: .95rem; }
#right #g-head .goal { height: 26px; }
#right #g-head .combo { text-align: center; font-size: 1rem; padding: 6px 10px; }
#right #prepbar { flex-direction: column; align-items: stretch; margin: 0; background: var(--pill); border: 2px solid var(--line); border-radius: 16px; padding: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#right #prepbar .prepbtn { grid-column: 1 / -1; font-size: .95rem; padding: 8px; }
#right #prepbar .stockchip { justify-content: center; }
.quitbtn { margin-top: auto; align-self: center; }

/* ---------- center ---------- */
#screen-hub .scene { min-height: 100%; border: 0; box-shadow: 0 0 0 6px var(--wood1), 0 0 0 9px var(--wood2), 0 16px 30px rgba(60,30,10,.25); justify-content: center; }
.hero { justify-content: center; gap: 16px; }
.hub-logo { height: 110px; font-size: 80px; }
.hero h2 { font-size: 1.9rem; }
.play { font-size: 1.8rem; padding: 18px 56px; }
.tiles { grid-template-columns: repeat(4, 1fr) !important; width: min(640px, 100%); gap: 14px; }
.tile { padding: 16px 8px; } .tile .ti { font-size: 2.4rem; }
.sign { display: grid; justify-items: center; padding: 10px 30px 12px; border-radius: 14px; background: linear-gradient(180deg, var(--wood1), var(--wood2)); color: #fff6e4; box-shadow: 0 5px 0 var(--wood3), 0 10px 18px rgba(60,30,10,.25); transform: rotate(-1deg); }
.sign span { font-size: .95rem; letter-spacing: 2px; opacity: .9; } .sign b { font-size: 2.2rem; line-height: 1; letter-spacing: 1px; text-shadow: 0 3px 0 var(--wood3); }
.sign.neon { background: #1d1626; box-shadow: 0 0 0 4px #35283f, 0 10px 24px rgba(0,0,0,.4); }
.sign.neon b { color: #fff; text-shadow: 0 0 4px #fff, 0 0 10px #ff4fa3, 0 0 22px #ff4fa3, 0 0 40px #ff2f8f; animation: flicker 6s infinite; }
.sign.neon span { color: #9ff; text-shadow: 0 0 6px #3ff, 0 0 14px #0cf; }
@keyframes flicker { 0%, 19%, 22%, 62%, 64%, 100% { opacity: 1; } 20%, 63% { opacity: .55; } }
#screen-game.active { display: flex; flex-direction: column; min-height: 100%; }
#kitchen { flex: 1; border: 0; border-radius: 22px; box-shadow: 0 0 0 6px var(--wood1), 0 0 0 9px var(--wood2), 0 16px 30px rgba(60,30,10,.25); }
#rail { padding: 4px 8px 14px; }
#screen-summary .hubcard { max-width: 720px; margin: 0 auto; box-shadow: 0 0 0 6px var(--wood1), 0 0 0 9px var(--wood2), 0 16px 30px rgba(60,30,10,.25); border: 0; }
#screen-profile { padding-top: 6vh; }

@media (prefers-reduced-motion: reduce) { #lights .bulb ellipse, .pfig, .photoframe, .plant .leaves, .sign.neon b { animation: none; } }

/* ---------- smaller windows: stack everything ---------- */
@media (max-width: 1100px) {
  body { overflow: auto; }
  #shell { height: auto; grid-template-columns: 1fr; padding: 34px 14px 20px; }
  main { height: auto; overflow: visible; order: 1; }
  #left { order: 0; flex-direction: row; flex-wrap: wrap; justify-content: center; }
  #right { order: 2; }
  .portrait { width: 160px; height: 200px; }
  .nameplate { width: auto; flex: 1; min-width: 180px; }
  .photoframe, .sill { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr) !important; }
}

/* laptop heights (~864 px): a more compact counter so the board fits */
@media (min-width: 1101px) and (max-height: 960px) {
  .counter .cust { width: 140px; height: 172px; font-size: 80px; }
  .custwrap { padding-top: 54px; }
  #rail { min-height: 70px; padding-bottom: 8px; }
  .tk, .tk .ring { width: 64px; } .tk .ring { height: 64px; }
  .boardcol { flex-basis: 330px; width: min(330px, 100%); }
  .buildwrap .tray { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 7px; }
  .ing { padding: 5px 3px 4px; gap: 0; } .ing .sprite { width: 40px; height: 40px; font-size: 30px; }
  .steps { transform: scale(.9); margin: -4px 0; }
}
/* in a run the customer queue sits on the stats board, freeing the center for the kitchen */
#right #rail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; justify-items: center; min-height: 0; padding: 8px; overflow: visible; background: var(--pill); border: 2px solid var(--line); border-radius: 16px; }
#right #rail:empty::before { content: "Niciun client încă…"; grid-column: 1 / -1; font-size: .85rem; opacity: .6; }

/* ---------- night theme: no light text on light surfaces ---------- */
body[data-theme="night"] .tile, body[data-theme="night"] .ing { background: linear-gradient(180deg, #3e4578, #2c3260); border-color: #5a62a8; box-shadow: 0 3px 0 #1d2245; }
body[data-theme="night"] .ing.sel { background: #4b3d6e; } body[data-theme="night"] .ing.over { background: #5b2c42; }
body[data-theme="night"] :is(.bubble, .say, .want, .plate, .chip, .modpill, .cutreq, .coinpill, .prepbtn, .ing .minus, .ordform input, .ordform select, .replyin, .loginbox input, .chefl input, button.dante, .stockchip, .hubcard input) { color: #3b2a20; }
body[data-theme="night"] .stockchip { background: #f4eefc; }
body[data-theme="night"] .chip.on { color: #1b4d32; }
body[data-theme="night"] :is(.xpbar, .goal, .bar, .bar2, .hbar) { background: #1b2042; border-color: #5a62a8; }
body[data-theme="night"] .goal .gpts { color: #ffe9a8; text-shadow: 0 1px 0 #000; }
body[data-theme="night"] .combo { background: #3a4170; color: #d9dcff; }
body[data-theme="night"] .hero h2 { text-shadow: 0 2px 0 rgba(0,0,0,.5); }
body[data-theme="night"] .scene::before { opacity: .35; }
body[data-theme="night"] .tk .face { background: #e9e4f5; }
body[data-theme="night"] .step span { color: #3b2a20; }
body[data-theme="night"] { --accent: #d23b78; }
body[data-theme="night"] .want b { background: #3b2a20; color: #fff; }
