/* RuneCake — Games page (Roulette & Flower Games) */

/* ---------------- Roulette ---------------- */
.roulette-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem 1rem;
    margin-bottom: 1rem;
    background: radial-gradient(circle at 50% 30%, rgba(212, 175, 55, 0.14), rgba(20, 15, 10, 0.35));
    border: 2px solid var(--border);
    text-align: center;
}

.roulette-wheel-wrap {
    position: relative;
    display: inline-flex;
    padding-top: 14px;
}

.roulette-pointer {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    color: var(--gold);
    font-size: 1.35rem;
    line-height: 1;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8), 0 2px 3px #000;
    pointer-events: none;
}

.roulette-wheel {
    position: relative;
    width: clamp(180px, 56vw, 270px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 6px solid var(--gold);
    background: #171717;
    box-shadow:
        0 0 0 4px #4a2c20,
        0 0 28px rgba(212, 175, 55, 0.4),
        inset 0 0 30px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.roulette-wheel-inner {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    will-change: transform;
}

.roulette-wheel-slot {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.roulette-wheel-number {
    position: absolute;
    top: 5.5%;
    font-family: 'Cinzel', serif;
    font-size: clamp(0.48rem, 1.7vw, 0.66rem);
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-shadow: 0 1px 2px #000, 0 0 3px #000;
}

.roulette-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 34%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    background: radial-gradient(circle at 50% 35%, #4a2c20, #1a1208 75%);
    border: 2px solid var(--gold);
    box-shadow: 0 0 14px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.roulette-hub-label {
    font-size: 0.5rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
}

#rouletteLast {
    font-family: 'MedievalSharp', cursive;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--parchment);
    line-height: 1;
}

.roulette-hub-number.red { color: #ff8a8a; }
.roulette-hub-number.black { color: #d9d9d9; }
.roulette-hub-number.green { color: #7ef0a4; }

.roulette-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.chip-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.roulette-chip {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-family: 'Cinzel', serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--parchment);
    background: radial-gradient(circle at 50% 35%, #4a2c20, #241209 80%);
    border: 3px dashed var(--border);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.roulette-chip:hover {
    transform: translateY(-2px);
    border-color: var(--gold);
    color: var(--gold);
}

.roulette-chip.active {
    background: radial-gradient(circle at 50% 35%, #f5e6a8, #d4af37 75%);
    color: #2d1810;
    border-color: #8b6914;
    border-style: solid;
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.7);
}

.roulette-toolbar-actions { display: flex; gap: 0.4rem; }

.roulette-board {
    display: grid;
    grid-template-columns: 0.85fr repeat(12, minmax(0, 1fr)) 1.4fr;
    grid-template-rows: repeat(3, minmax(38px, auto));
    gap: 3px;
    margin-bottom: 3px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.roulette-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0.2rem;
    font-family: 'Cinzel', serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
    user-select: none;
}

.roulette-cell:hover { filter: brightness(1.35); transform: scale(1.04); z-index: 2; }
.roulette-cell:active { transform: scale(0.97); }

.roulette-cell.red { background: linear-gradient(145deg, #b32020, #7d1414); }
.roulette-cell.black { background: linear-gradient(145deg, #2a2a2a, #111); }
.roulette-cell.green { background: linear-gradient(145deg, #21874a, #135c30); }

.roulette-zero {
    grid-row: 1 / span 3;
    grid-column: 1;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
}

.roulette-column-bet {
    background: linear-gradient(145deg, #4a2c20, #2d1810);
    color: var(--gold);
    border: 1px solid var(--border);
    font-size: 0.72rem;
    border-radius: 0 4px 4px 0;
}

.roulette-bet-chip {
    position: absolute;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%);
    padding: 0 0.3rem;
    border-radius: 999px;
    background: linear-gradient(145deg, #f5e6a8, #d4af37);
    color: #2d1810;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    white-space: nowrap;
}

.roulette-outside {
    display: grid;
    grid-template-columns: repeat(3, 1fr) repeat(6, 1fr);
    gap: 3px;
    margin-bottom: 1rem;
}

.roulette-outside-btn {
    position: relative;
    font-family: 'Cinzel', serif;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.65rem 0.3rem;
    color: var(--parchment);
    background: linear-gradient(145deg, #4a2c20, #2d1810);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
}

.roulette-outside-btn:hover { filter: brightness(1.3); transform: translateY(-1px); }
.roulette-outside-btn:active { transform: scale(0.98); }
.roulette-outside-btn.dozen { color: var(--gold); }
.roulette-outside-btn.red { background: linear-gradient(145deg, #b32020, #7d1414); color: #fff; }
.roulette-outside-btn.black { background: linear-gradient(145deg, #2a2a2a, #111); color: #fff; }

.roulette-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    margin-bottom: 1rem;
    background: rgba(20, 15, 10, 0.55);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--parchment);
}

.roulette-summary strong { color: var(--gold); }

.spin-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.spin-dot.red { background: #b32020; }
.spin-dot.black { background: #1a1a1a; }
.spin-dot.green { background: #21874a; }

/* ---------------- Flower Games ---------------- */
.flower-modes {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.flower-mode {
    flex: 1;
    min-width: 140px;
    padding: 0.65rem 1rem;
    font-family: 'Cinzel', serif;
    font-size: 0.88rem;
    color: var(--parchment);
    background: rgba(20, 15, 10, 0.6);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.22s ease;
}

.flower-mode:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-1px);
}

.flower-mode.active {
    background: linear-gradient(145deg, #d4af37, #b8941f);
    color: #2d1810;
    border-color: var(--gold);
    font-weight: 700;
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.45);
}

.flower-mode:disabled { opacity: 0.4; cursor: not-allowed; }

.flower-stage {
    text-align: center;
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
    background: radial-gradient(circle at 50% 35%, rgba(81, 207, 102, 0.14), rgba(20, 15, 10, 0.35));
    border: 2px solid var(--border);
}

.flower-plot {
    width: 120px;
    height: 120px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    line-height: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #3b2a1a, #1a1208 78%);
    border: 3px solid #8b6914;
    box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.75), 0 0 18px rgba(212, 175, 55, 0.18);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.flower-plot.growing { animation: flowerPulse 0.55s ease-in-out infinite; }
.flower-plot.bloom { animation: flowerBloom 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.flower-plot.bloom.win { border-color: var(--green); box-shadow: 0 0 30px rgba(81, 207, 102, 0.5), inset 0 0 22px rgba(0, 0, 0, 0.7); }
.flower-plot.bloom.lose { border-color: var(--red); box-shadow: 0 0 26px rgba(255, 107, 107, 0.4), inset 0 0 22px rgba(0, 0, 0, 0.7); }

.flower-big {
    font-size: 3.5rem;
    line-height: 1;
    filter: drop-shadow(0 0 12px var(--flower, #f15bb5));
    animation: flowerSway 2.6s ease-in-out infinite;
}

@keyframes flowerPulse {
    0%, 100% { transform: scale(1); box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.75), 0 0 12px rgba(212, 175, 55, 0.2); }
    50% { transform: scale(1.04); box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.75), 0 0 26px rgba(212, 175, 55, 0.45); }
}

@keyframes flowerBloom {
    0% { transform: scale(0.55); opacity: 0.3; }
    60% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes flowerSway {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.flower-table {
    padding: 1rem;
    margin-bottom: 1rem;
    background: radial-gradient(ellipse at center, #14532d 0%, #0a2e19 70%, #071f11 100%);
    border: 3px solid #8b6914;
    border-radius: 12px;
    box-shadow: inset 0 0 45px rgba(0, 0, 0, 0.65);
}

.flower-hand-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--parchment);
    font-size: 0.82rem;
}

.flower-hand-label span:last-child {
    color: var(--gold);
    font-weight: 700;
    text-align: right;
}

.flower-hand {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    align-items: center;
    min-height: 108px;
    margin-bottom: 0.9rem;
}

.flower-hand:last-child { margin-bottom: 0; }

.flower-card {
    width: 78px;
    min-height: 102px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem;
    border: 2px solid var(--flower, var(--gold));
    border-radius: 8px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(20, 15, 10, 0.65));
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 0 12px rgba(0, 0, 0, 0.35);
    animation: flowerCardIn 0.35s ease-out both;
}

.flower-card-emoji {
    font-size: 1.9rem;
    line-height: 1;
    filter: drop-shadow(0 0 8px var(--flower, #f15bb5));
}

.flower-card-name {
    font-size: 0.58rem;
    line-height: 1.15;
    letter-spacing: 0.3px;
    text-align: center;
    color: var(--parchment);
}

@keyframes flowerCardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 640px) {
    .roulette-board {
        grid-template-columns: 0.8fr repeat(12, minmax(23px, 1fr)) 1.25fr;
        gap: 2px;
    }

    .roulette-cell {
        min-height: 31px;
        padding: 0.15rem;
        font-size: 0.62rem;
    }

    .roulette-zero { font-size: 0.8rem; }
    .roulette-column-bet { font-size: 0.58rem; }

    .roulette-bet-chip {
        font-size: 0.48rem;
        padding: 0 0.18rem;
    }

    .roulette-outside { grid-template-columns: repeat(3, 1fr); }
    .roulette-outside-btn { font-size: 0.68rem; padding: 0.5rem 0.25rem; }

    .roulette-chip { width: 42px; height: 42px; font-size: 0.62rem; }

    .roulette-toolbar { justify-content: center; }

    .choice-row { grid-template-columns: 1fr; }

    .flower-card { width: 62px; min-height: 86px; }
    .flower-card-emoji { font-size: 1.45rem; }
    .flower-card-name { font-size: 0.52rem; }
    .flower-hand { min-height: 92px; }

    .flower-mode { min-width: 120px; font-size: 0.78rem; padding: 0.55rem 0.7rem; }

    .flower-plot { width: 104px; height: 104px; }
    .flower-big { font-size: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
    .flower-plot.growing,
    .flower-plot.bloom,
    .flower-big,
    .flower-card {
        animation: none;
    }

    .roulette-wheel-inner { transition-duration: 0.01ms !important; }
}
