/* =========================
   Base / Resets
   ========================= */
:root { --ring: 0 0% 0%; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { -webkit-tap-highlight-color: transparent; margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji"; }

.animate-fade-in { animation: fade-in .25s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(2px);} to { opacity:1; transform:none;} }

/* Layering so seasonal effects stay behind the UI */
#app, footer { position: relative; z-index: 1; }
#leaf-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

/* =========================
   Panels / Common UI
   ========================= */
.panel {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(6px);
    border-radius: 1rem;
    border: 1px solid #e2e8f0;            /* slate-200 */
    padding: 0.75rem;
    box-shadow: 0 10px 24px -16px rgba(2,6,23,0.25);
    animation: fade-in-up 350ms ease both;
}
@keyframes fade-in-up { from { transform: translateY(6px); opacity: 0 } to { transform: none; opacity: 1 } }

.panel-title {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    display: flex; align-items: center; gap: .5rem;
}
.chip-hidden {
    display: none;
    border: 1px solid #e2e8f0; border-radius: 9999px;
    background: #f8fafc;
    padding: 0.15rem .5rem; color: #475569;
}
@media (min-width: 640px) { .chip-hidden { display: inline-flex; } }

.panel--sidebar {
    background: #fef9c3;                   /* amber-100 */
    border-color: #fcd34d;                 /* amber-300 */
}
.panel--info {
    background: #e0f2fe;                   /* sky-100 */
    border-color: #bae6fd;                 /* sky-200 */
}

/* Small UI bits */
.players-wrap { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.3rem 0.65rem; border-radius: 9999px;
    background: #f1f5f9; border: 1px solid #cbd5e1;
    font-size: 0.8rem; line-height: 1; white-space: nowrap;
}
.list-row { animation: fade-in-up 200ms ease both; }
.legend { width: 10px; height: 10px; border-radius: 2px; display: inline-block; border: 1px solid rgba(0,0,0,.08); }
.legend-yellow { background: #fde68a; }
.legend-green  { background: #86efac; }
.legend-red    { background: #fca5a5; }

/* Scrollable columns */
.scroll-col {
    max-height: calc(100vh - 220px);
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.scroll-col::-webkit-scrollbar { width: 10px; }
.scroll-col::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius: 999px; }
.scroll-col::-webkit-scrollbar-track { background: transparent; }

/* =========================
   Buttons
   ========================= */
.btn-primary {
    padding: .5rem .75rem; border-radius: .75rem;
    background: #059669; color: white; border: none;
    transition: transform .06s ease, box-shadow .2s ease, background .2s ease;
}
.btn-primary:hover  { background: #047857; }
.btn-primary:active { transform: translateY(1px) scale(.99); }

.btn-outline {
    padding: .5rem .75rem; border-radius: .75rem;
    background: white; color: #334155; border: 1px solid #cbd5e1;
    transition: transform .06s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn-outline:hover  { background: #f1f5f9; border-color: #94a3b8; }
.btn-outline:active { transform: translateY(1px) scale(.99); }

.btn-danger {
    padding: .5rem .75rem; border-radius: .75rem;
    background: #fff; color: #be123c; border: 1px solid #fda4af;
}
.btn-danger:hover { background: #fff1f2; }

/* Ripple (only if you add .ripple + .ripple-ink) */
.ripple { position: relative; overflow: hidden; }
.ripple-ink {
    position: absolute; border-radius: 9999px; transform: scale(0);
    opacity: .2; background: currentColor; pointer-events: none;
    animation: ripple .5s ease-out forwards;
}
@keyframes ripple { to { transform: scale(16); opacity: 0; } }

/* =========================
   Bingo Card (center)
   ========================= */
#card {
    background: linear-gradient(135deg, #fffaf0, #fef3c7); /* warm ivory → soft amber */
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid #fcd34d;           /* amber-300 */
    box-shadow: 0 4px 14px -4px rgba(202, 138, 4, 0.35);
}

/* The grid is defined in HTML via Tailwind classes (grid grid-cols-5 gap-2).
   We size squares with the tile wrapper. */

/* =========================
   Tiles (square cells)
   ========================= */
/* Wrapper controls square shape and wiggle animation */
.tile-anim {
    display: inline-block;
    width: 100%;
    aspect-ratio: 1 / 1;                  /* <- perfect square */
    will-change: transform;
}

/* Tile fills wrapper */
.tile {
    height: 100%;
    min-height: 0;
    display: flex; align-items: center; justify-content: center;
    text-align: center;


    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    box-shadow: 0 2px 10px -6px rgba(2,6,23,0.25);
    padding: 0.7rem 0.6rem;

    /* Wrapping rules: never break mid-word */
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: manual;

    /* Adaptive typography (Option 3) */
    font-weight: 600;
    font-size: clamp(0.62rem, 0.75vw + 0.38rem, 0.98rem);
    line-height: 1.10;
    letter-spacing: -0.2px;

}
    cursor: pointer;
    transition:
            transform 0.08s ease,
            background-color .6s ease,
            border-color .6s ease-in-out,
            box-shadow 0.2s ease,
            color 0.1s ease;
}
.tile:hover  { transform: translateY(-1px); }
.tile:active { transform: scale(0.985); }

/* Free tile */
.tile .free {
    font-weight: 800;
    font-style: italic; color: #334155;
    position: relative;
    font-size: clamp(0.9rem, 1vw + 0.55rem, 1.15rem);
}
.tile .free .free-label { position: relative; z-index: 1; }
.tile .free::before {
    content: "★";
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-60%, -60%);
    font-size: 44px; line-height: 1;
    color: #f59e0b; opacity: 0.16; pointer-events: none; z-index: 0;
    animation: free-star-pulse 2600ms ease-in-out infinite;
    filter: drop-shadow(0 1px 0 rgba(0,0,0,.03));
}
@keyframes free-star-pulse {
    0%, 100% { transform: translate(-60%, -60%) scale(1.00); opacity: 0.26; }
    50%      { transform: translate(-60%, -60%) scale(1.50); opacity: 0.36; }
}
@media (prefers-reduced-motion: reduce) { .tile .free::before { animation: none; } }

/* States */
.tile.marked{
    background:#fde68a;
    border-color:#A5F3FC;
    box-shadow:0 8px 22px -8px rgba(14,165,233,.35);
}
.tile.called-unmarked{
    background:#fca5a5; color:#0F172A;
    border:1px dashed #CBD5E1;
}
.tile.called-marked{
    background:#86efac;
    border-color:#86EFAC;
    box-shadow:0 8px 22px -8px rgba(16,185,129,.35);
}
.tile.winning{ outline:3px solid #34D399; }

/* Available list highlight for locally marked phrases */
#availableList .list-row.avail-marked{
    background-color:#fde68a;
    border-color:#A5F3FC;
    box-shadow:0 8px 22px -8px rgba(14,165,233,.20);
}

/* Wiggle animation (apply to .tile-anim) */
.tile-wiggle { animation: tile-wiggle 420ms cubic-bezier(.36,.07,.19,.97) both; }
@keyframes tile-wiggle {
    0%   { transform: rotate(0deg); }
    15%  { transform: rotate(-8deg); }
    30%  { transform: rotate(8deg); }
    45%  { transform: rotate(-5deg); }
    60%  { transform: rotate(5deg); }
    75%  { transform: rotate(-2deg); }
    90%  { transform: rotate(2deg); }
    100% { transform: rotate(0deg); }
}

/* =========================
   Reset Modal – Hold progress bar
   ========================= */
.hold-btn { position: relative; overflow: hidden; }
.hold-btn::after {
    content: "";
    position: absolute; inset: 0 auto 0 0;
    width: 0; background: rgba(239, 68, 68, 0.2);   /* red tint */
    transition: width linear;
}
.hold-btn.holding::after { width: 100%; transition-duration: 2.2s; }

/* =========================
   Seasonal Falling Leaves
   ========================= */
#leaf-layer{ position:fixed; inset:0; z-index:0; pointer-events:none; overflow:hidden; }

/* outer leaf controls vertical fall */
.leaf{
    position:absolute; top:-12vh; left:var(--left, 0);
    width:var(--size, 24px); height:var(--size,24px);
    opacity:var(--opacity,.75);
    filter:drop-shadow(0 2px 2px rgba(0,0,0,.15));
    will-change:transform;
    animation: leaf-fall var(--fall,42s) linear var(--delay,0s) infinite;
    color: #f59e0b;
}

/* middle wrapper: horizontal sway */
.leaf .sway{
    width:100%; height:100%;
    will-change:transform;
    animation: leaf-sway var(--sway,8s) ease-in-out var(--delay,0s) infinite;
}

/* inner sprite: spin and mask */
.leaf .sprite{
    width: 100%; height: 100%;
    background-color: currentColor;
    will-change: transform;
    animation: leaf-spin var(--spin,14s) linear var(--delay,0s) infinite;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-position: center; mask-position: center;
}

/* masks */
.leaf.type-1 .sprite{
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M14 28c8-14 24-20 34-10-2 10-8 18-20 22 2 6 1 12-4 18-6-4-10-10-10-16 0-6 0-10 0-14z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M14 28c8-14 24-20 34-10-2 10-8 18-20 22 2 6 1 12-4 18-6-4-10-10-10-16 0-6 0-10 0-14z'/></svg>");
}
.leaf.type-2 .sprite{
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M32 8l6 10 12-4-6 12 10 6-12 2 2 12-10-8-10 8 2-12-12-2 10-6-6-12 12 4z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M32 8l6 10 12-4-6 12 10 6-12 2 2 12-10-8-10 8 2-12-12-2 10-6-6-12 12 4z'/></svg>");
}
.leaf.type-3 .sprite{
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M10 36c10-6 18-6 28 0 8 4 14 14 10 22-10 2-18 0-24-6-6-4-10-10-14-16z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M10 36c10-6 18-6 28 0 8 4 14 14 10 22-10 2-18 0-24-6-6-4-10-10-14-16z'/></svg>");
}

/* palette */
.leaf.color-1{ color:#f59e0b; } /* amber */
.leaf.color-2{ color:#d97706; } /* orange */
.leaf.color-3{ color:#ef4444; } /* red */
.leaf.color-4{ color:#8b5e34; } /* brown */
.leaf.color-5{ color:#fbbf24; } /* golden */

/* animations */
@keyframes leaf-fall { to { transform: translateY(118vh); } }
@keyframes leaf-sway {
    0%,100%{ transform: translateX(calc(-1 * var(--swayAmp,28px))); }
    50%    { transform: translateX(var(--swayAmp,28px)); }
}
@keyframes leaf-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce){
    #leaf-layer{ display:none; }
}

/* =========================
   Utilities
   ========================= */
.hide { display: none !important; }
.center { display:flex; align-items:center; justify-content:center; }
