/* Beelines: a sunny meadow theme on top of shared/tabletop.css. */
:root {
  --honey: #f7b32b;
  --honey-deep: #d98e04;
  --ink: #3b2a12;
  --muted: #7a6a4f;
  --cream: #fffaf0;
  --line: #ecdcb8;
  --accent: #f7b32b;
  --radius: 18px;
  font-family: 'Fredoka', ui-rounded, 'Nunito', system-ui, sans-serif;
  color: var(--ink);
}

body { background: #bfe6fb; overflow-x: hidden; }
[hidden] { display: none !important; } /* panels with their own display (grid, flex) must still hide */
button { font-family: inherit; border-radius: 999px; padding: 0.45rem 1rem; border-color: #e2cf9f; font-weight: 500; }
button:hover:not(:disabled) { background: #fff3d1; border-color: var(--honey); }
button.primary {
  background: linear-gradient(#ffd25e, var(--honey)); border-color: var(--honey-deep); color: #3b2500;
  font-weight: 700; box-shadow: 0 3px 0 var(--honey-deep), 0 6px 14px #b9780033;
}
button.primary:hover:not(:disabled) { background: linear-gradient(#ffdc7a, #f9bf45); }
button.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--honey-deep); }
button.big { font-size: 1.1rem; padding: 0.6rem 1.6rem; }
kbd { font: 600 0.7rem/1 ui-monospace, Menlo, monospace; background: #ffffff8c; border-radius: 5px; padding: 0.2rem 0.35rem; margin-left: 0.6rem; vertical-align: 2px; }

/* ---------- Landscape ---------- */

.scene { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.scene svg { width: 100%; height: 100%; display: block; }
.cloud { animation: drift 160s linear infinite; }
@keyframes drift { from { transform: translateX(-1700px); } to { transform: translateX(1800px); } }
.sun-rays { animation: spin 70s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.meadow-flower, .blade { transform-box: fill-box; transform-origin: 50% 100%; animation: breeze 4.5s ease-in-out infinite alternate; }
@keyframes breeze { from { transform: rotate(-5deg); } to { transform: rotate(6deg); } }
.tiny-bee { animation: buzz-a 9s ease-in-out infinite; }
.tb2 { animation-name: buzz-b; animation-duration: 11s; }
.tb3 { animation-name: buzz-c; animation-duration: 13s; animation-delay: -4s; }
@keyframes buzz-a { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-90px, -40px); } 50% { transform: translate(-30px, -90px); } 75% { transform: translate(60px, -30px); } }
@keyframes buzz-b { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(70px, -70px); } 60% { transform: translate(-60px, -20px); } 80% { transform: translate(20px, 30px); } }
@keyframes buzz-c { 0%, 100% { transform: translate(-20px, 10px); } 40% { transform: translate(-130px, -10px); } 70% { transform: translate(-60px, -120px); } }

/* ---------- Top bar ---------- */

.topbar { background: #3b2a12a8; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 0.45rem 1.25rem; }
.topbar .logo {
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.7rem; letter-spacing: 0.02em; color: #ffd25e;
  text-shadow: 0 2px 0 #9a5f00, 0 4px 10px #0005;
}
.topbar button { border-radius: 999px; }
.topbar a, .topbar button { white-space: nowrap; }
@media (max-width: 520px) {
  .topbar { padding: 0.4rem 0.75rem; gap: 0.5rem; }
  .topbar .logo { font-size: 1.35rem; }
  .topbar button { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
}

/* ---------- Layout ---------- */

.stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 1.25rem;
  padding: 1rem 1.25rem 1.5rem; align-items: start; max-width: 1500px; margin: 0 auto;
}
@media (max-width: 1000px) {
  .stage { grid-template-columns: 1fr; padding: 0.75rem; }
  .side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}
.board-area { position: relative; min-width: 0; }
.board-wrap { display: grid; place-items: center; }
.board { width: 100%; max-height: calc(100vh - 90px); display: block; user-select: none; -webkit-user-select: none; touch-action: manipulation; overflow: visible; }

.side { display: flex; flex-direction: column; gap: 0.9rem; }
.panel {
  background: #fffaf0e6; border-radius: var(--radius); padding: 0.9rem 1rem;
  box-shadow: 0 1px 0 #fff inset, 0 8px 24px #3b5a1a2e; border: 1px solid #ffffffb0;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.panel h2 { font-size: 0.78rem; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 0.6rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.row.center { justify-content: center; }

/* ---------- Turn panel ---------- */

.turn-panel { text-align: center; background: linear-gradient(#fffdf6f2, #fff3d6f2); }
.turn-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.turn-no { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 0.45rem; background: #fff; border-radius: 999px; padding: 0.2rem 0.8rem 0.2rem 0.25rem; box-shadow: 0 0 0 2px var(--c), 0 3px 8px #0001; text-align: left; }
.chip strong { display: block; line-height: 1.1; }
.chip small { display: block; color: var(--muted); font-size: 0.72rem; line-height: 1.1; }
.status { margin: 0.4rem 0 0.6rem; font-size: 1.05rem; }
.preview-note { margin: 0 0 0.25rem; font-size: 0.9rem; color: var(--muted); min-height: 2.6em; }
.preview-note strong { color: var(--ink); }
.preview-note .gain { display: inline-flex; align-items: center; gap: 0.1rem; font-weight: 700; color: var(--ink); margin-right: 0.3rem; }
.preview-note .gain svg { vertical-align: -4px; }
.preview-note .warn { color: #c2410c; }
#turn-actions .row { justify-content: center; }
button.roll { min-width: 170px; font-size: 1.25rem; }

/* 3D die */
.die-stage { --s: 96px; position: relative; height: calc(var(--s) + 34px); display: grid; place-items: center; perspective: 700px; margin: 0.35rem 0 0.2rem; }
.die { width: var(--s); height: var(--s); position: relative; }
.cube { width: 100%; height: 100%; position: absolute; transform-style: preserve-3d; }
.cube-face {
  position: absolute; inset: 0; border-radius: 20px;
  background: radial-gradient(circle at 35% 30%, #fffef8, #fbefcf 70%, #f1dca6);
  box-shadow: inset 0 0 0 2px #e7cf96, inset 0 -6px 12px #d8b77233;
  display: grid; place-items: center; backface-visibility: hidden;
}
.cube-face .die-art { width: 82%; height: 82%; }
.cube-face.front { transform: translateZ(calc(var(--s) / 2)); }
.cube-face.back { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.cube-face.right { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.cube-face.left { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.cube-face.top { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.die-shadow { position: absolute; bottom: 4px; width: 90px; height: 16px; border-radius: 50%; background: radial-gradient(#3b2a1255, transparent 70%); }
.die-stage.tossing .die { animation: toss 1.15s cubic-bezier(.3,.6,.3,1); }
.die-stage.tossing .die-shadow { animation: toss-shadow 1.15s cubic-bezier(.3,.6,.3,1); }
@keyframes toss { 0% { transform: translateY(0); } 25% { transform: translateY(-46px) scale(1.06); } 55% { transform: translateY(0); } 70% { transform: translateY(-12px); } 85%, 100% { transform: translateY(0); } }
@keyframes toss-shadow { 0%, 55%, 85%, 100% { transform: scale(1); opacity: 1; } 25% { transform: scale(0.55); opacity: 0.45; } 70% { transform: scale(0.85); } }

/* ---------- Players ---------- */

.player {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.7rem; align-items: center;
  padding: 0.55rem 0.65rem; border-radius: 14px; margin-bottom: 0.4rem; background: #fff8; transition: background 0.3s, box-shadow 0.3s;
}
.player:last-child { margin-bottom: 0; }
.player.active { background: #fff; box-shadow: 0 0 0 3px var(--c), 0 6px 16px #0001; }
.player .name { font-weight: 600; font-size: 1.05rem; line-height: 1.15; }
.player .sub { font-size: 0.76rem; color: var(--muted); display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.haul { display: flex; gap: 0.5rem; margin-top: 0.15rem; font-size: 0.82rem; font-weight: 600; }
.haul-item { display: inline-flex; align-items: center; gap: 0.1rem; }
.haul-item.none { opacity: 0.4; }
.player .score { text-align: center; line-height: 1; }
.player .score span { display: block; font-size: 2rem; font-weight: 700; color: var(--c); }
.player .score small { color: var(--muted); font-size: 0.7rem; }
.tag { font-size: 0.68rem; font-weight: 600; border-radius: 999px; padding: 0.05rem 0.45rem; }
.tag.miss { background: #fff0d1; color: #9a5f00; }
.tag.stuck { background: #ffe3e3; color: #c92a2a; }
.tag.win { background: #d3f9d8; color: #2b8a3e; }
.tag.out { background: #e9ecef; color: #495057; }
.player.out { opacity: 0.7; }
.player.out .bee-icon { filter: grayscale(0.8); }
.player .score button.concede { display: block; margin: 0.35rem auto 0; font-size: 0.7rem; padding: 0.1rem 0.55rem; color: var(--muted); background: #fff; }
.player .score button.concede:hover { color: #c92a2a; border-color: #ffa8a8; background: #fff5f5; }
.bee.out { opacity: 0.5; filter: grayscale(0.9); }
.bee.out .bee-bob, .bee.out .wings { animation: none; }
.trail.out { opacity: 0.55; }
.bee.resting { opacity: 0.65; }
.bee.resting .bee-bob, .bee.resting .wings { animation: none; }
.seat-fixed { font-size: 0.82rem; color: var(--muted); padding: 0.3rem 0.2rem; }
dialog.concede { max-width: 440px; }
dialog.concede p { margin: 0 0 0.9rem; }
.choices { display: grid; gap: 0.5rem; }
button.choice { text-align: left; border-radius: 16px; padding: 0.7rem 0.9rem; background: #fff; }
button.choice strong, button.choice small { display: block; }
button.choice small { color: var(--muted); font-size: 0.82rem; margin-top: 0.1rem; }

/* ---------- Legend and info ---------- */

.legend { display: grid; gap: 0.35rem; }
.legend-item { display: flex; align-items: center; gap: 0.6rem; }
.legend-item strong { display: block; line-height: 1.1; }
.legend-item small { color: var(--muted); }
#legend p { margin: 0.55rem 0 0; }
.tabs button { border-radius: 999px; }
.tabs button.active { background: var(--ink); border-color: var(--ink); }
.log { max-height: 220px; }
.log li { border-color: var(--line); }
.rules { max-height: 340px; font-family: system-ui, sans-serif; }
/* Headings inside the rules read as section titles, not as small panel labels. */
.panel .rules h1 { font-family: 'Fredoka', sans-serif; font-size: 1.25rem; margin: 0.2rem 0 0.5rem; }
.panel .rules h2 { font-family: 'Fredoka', sans-serif; font-size: 1.05rem; font-weight: 600; color: var(--ink); letter-spacing: 0; text-transform: none; margin: 1rem 0 0.35rem; }
.faces { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.die-section { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 0.25rem; }
.face-ref { display: flex; gap: 0.5rem; align-items: center; font-size: 0.82rem; line-height: 1.2; }
.face-ref strong { display: block; }
.mini-die { flex: none; width: 46px; height: 46px; border-radius: 11px; background: #fbefcf; box-shadow: inset 0 0 0 2px #e7cf96; display: grid; place-items: center; }
.mini-die .die-art { width: 85%; height: 85%; }

/* ---------- Board pieces ---------- */

.tuft { transform-box: fill-box; transform-origin: 50% 100%; animation: breeze 3.8s ease-in-out infinite alternate; }
.flower .sway { transform-box: fill-box; transform-origin: 50% 50%; animation: flower-sway 5s ease-in-out infinite alternate; }
@keyframes flower-sway {
  0% { transform: rotate(-7deg) translate(-0.6px, 0) scale(1); }
  50% { transform: rotate(2deg) translate(0.5px, -0.5px) scale(1.025); }
  100% { transform: rotate(8deg) translate(0.8px, 0.3px) scale(0.995); }
}
.flower-cell .flower { transition: opacity 0.6s, filter 0.6s, transform 0.6s; transform-box: fill-box; transform-origin: center; }
.flower-cell.taken .flower { opacity: 0.42; filter: saturate(0.5); }
.flower-cell.wilted .flower { opacity: 0.4; filter: grayscale(1); transform: scale(0.85); }
.flower-cell.taken .sway, .flower-cell.wilted .sway { animation-play-state: paused; }

.bee-bob { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.wings { transform-box: fill-box; transform-origin: 50% 70%; animation: flap 0.14s linear infinite alternate; }
@keyframes flap { from { transform: scaleX(1); } to { transform: scaleX(0.7); } }
.bee-shadow { transition: opacity 0.3s; }
.bee-ring { opacity: 0; transform-box: fill-box; transform-origin: center; }
.bee.active .bee-ring { animation: ring 1.6s ease-out infinite; }
@keyframes ring { 0% { opacity: 0.9; transform: scale(0.75); } 100% { opacity: 0; transform: scale(1.35); } }
.bee.dropping .bee-bob { animation: drop 0.65s cubic-bezier(.3,1.5,.5,1); }
@keyframes drop { 0% { transform: translateY(-90px) scale(1.6); opacity: 0; } 60% { opacity: 1; } 100% { transform: translateY(0) scale(1); } }

.target-ring { transform-box: fill-box; transform-origin: center; animation: target 1.3s ease-in-out infinite alternate; }
@keyframes target { from { transform: scale(0.94); stroke-opacity: 1; } to { transform: scale(1.02); stroke-opacity: 0.55; } }
.target-badge text { font-family: 'Fredoka', sans-serif; }
.marching { animation: march 0.8s linear infinite; }
@keyframes march { to { stroke-dashoffset: -23; } }
.preview-label text, .pop text { font-family: 'Fredoka', sans-serif; }
.pop { animation: pop 1.4s ease-out forwards; }
.pop.small text { font-size: 15px; }
@keyframes pop { 0% { transform: translateY(6px) scale(0.6); opacity: 0; } 15% { transform: translateY(-6px) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-46px) scale(1); opacity: 0; } }
.petal-burst { animation: burst 0.9s ease-out forwards; }
@keyframes burst { from { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.4); opacity: 0; } }

/* ---------- Toasts ---------- */

.toast { position: absolute; left: 50%; top: 5%; transform: translateX(-50%); pointer-events: none; z-index: 5; width: max-content; max-width: 90%; opacity: 0; }
.toast.show { animation: toast 0.35s cubic-bezier(.3,1.6,.5,1) forwards; }
.toast:not(.show) { transition: opacity 0.4s; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, -14px) scale(0.85); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.toast-card { background: #fffaf0; border-radius: 999px; padding: 0.65rem 1.4rem; font-size: 1.15rem; box-shadow: 0 10px 30px #3b2a1240, 0 0 0 3px #fff; text-align: center; }
.toast-card.miss { background: #fff3d1; }
.toast-card.stuck { background: #ffe3e3; color: #a61e1e; font-size: 1.35rem; font-weight: 600; }
.toast-card.yay { background: #ebfbee; color: #2b8a3e; }

/* ---------- Results ---------- */

.gameover { position: absolute; inset: 0; display: grid; place-items: center; z-index: 6; overflow: hidden; border-radius: 30px; }
.gameover[hidden] { display: none; }
.gameover::before { content: ''; position: absolute; inset: 0; background: #fffaf033; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.result-card {
  position: relative; background: var(--cream); border-radius: 26px; padding: 1.4rem 1.6rem 1.2rem; width: min(420px, 92%);
  box-shadow: 0 24px 60px #3b2a1250, 0 0 0 4px #fff; text-align: center; animation: rise 0.5s cubic-bezier(.3,1.4,.5,1);
}
@keyframes rise { from { transform: translateY(30px) scale(0.9); opacity: 0; } }
.result-card h2 { margin: 0.3rem 0 0.1rem; font-size: 2rem; }
.result-card .trophy { display: grid; place-items: center; animation: bob 2.4s ease-in-out infinite; }
.result-card > p { margin: 0 0 0.8rem; }
.ranking { list-style: none; padding: 0; margin: 0 0 1rem; text-align: left; }
.ranking li { display: grid; grid-template-columns: auto 1fr auto auto; gap: 0.6rem; align-items: center; padding: 0.4rem 0.6rem; border-radius: 12px; }
.ranking li:first-child { background: #fff3d1; }
.ranking .name { font-weight: 600; }
.ranking .haul { margin: 0; gap: 0.35rem; font-size: 0.78rem; }
.ranking .pts { font-weight: 700; font-size: 1.4rem; color: var(--c); min-width: 2ch; text-align: right; }
.result-card .row { gap: 0.5rem; }
.petals { position: absolute; inset: 0; pointer-events: none; }
.petal { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 60% 60% 60% 0; animation: fall linear infinite; opacity: 0.9; }
.petal.p0 { background: #ff9aa2; }
.petal.p1 { background: #ffe066; }
.petal.p2 { background: #74c0fc; width: 10px; height: 14px; }
@keyframes fall { from { transform: translateY(-20px) rotate(0deg); } to { transform: translateY(110vh) rotate(540deg) translateX(40px); } }

/* ---------- Setup dialog ---------- */

dialog.setup { max-width: 520px; border-radius: 24px; padding: 1.4rem 1.5rem; background: var(--cream); box-shadow: 0 24px 60px #0006, 0 0 0 4px #fff; }
dialog.setup h2 { font-size: 1.6rem; margin: 0 0 0.6rem; }
dialog::backdrop { background: #2b3a1270; backdrop-filter: blur(3px); }
.field { margin: 0.8rem 0; }
.field[hidden] { display: none; }
.field-label { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; margin-bottom: 0.35rem; }
.seg { display: flex; gap: 0.3rem; background: #f3e6c4; padding: 0.25rem; border-radius: 999px; flex-wrap: wrap; }
.seg button { flex: 1; border: none; background: transparent; padding: 0.4rem 0.7rem; white-space: nowrap; }
.seg button.on { background: #fff; box-shadow: 0 2px 6px #0002; font-weight: 700; }
.seg.small button { font-size: 0.82rem; padding: 0.28rem 0.5rem; }
.seg.tall { border-radius: 16px; }
.seg.tall button { border-radius: 12px; padding: 0.45rem 0.6rem; }
.seg.tall strong, .seg.tall small { display: block; }
.seg.tall small { color: var(--muted); font-size: 0.75rem; }
.seat { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: center; padding: 0.55rem 0.6rem; background: #fff; border-radius: 16px; margin-bottom: 0.45rem; box-shadow: inset 4px 0 0 var(--c); }
.seat-main { display: grid; gap: 0.35rem; }
.name-row { display: flex; gap: 0.35rem; }
.name-row input { flex: 1; min-width: 0; font: inherit; padding: 0.35rem 0.7rem; border: 1px solid #e2cf9f; border-radius: 999px; background: #fffdf7; }
.name-row input:focus { outline: 2px solid var(--honey); border-color: var(--honey); }
button.icon { padding: 0.25rem 0.6rem; }
dialog.setup .actions { flex-direction: row-reverse; justify-content: flex-start; }

@media (prefers-reduced-motion: reduce) {
  .cloud, .sun-rays, .meadow-flower, .blade, .tiny-bee, .tuft, .flower .sway, .bee-bob, .wings, .target-ring, .marching, .petal, .result-card .trophy { animation: none !important; }
}
