*,
*::before,
*::after {
    box-sizing: border-box;
}

body.theme {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1f2937 0, #020617 40%, #000 100%);
    color: #e5e7eb;
}

.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 16px 16px 32px;
}

.app-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.header-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.title-block h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: #9ca3af;
}

.header-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.back-btn {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
}

.pot-card,
.countdown-card {
    background: radial-gradient(circle at top left, #22c55e33, #020617);
    border-radius: 16px;
    padding: 14px 16px;
    border: 1px solid #22c55e44;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pot-label,
.countdown-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a5b4fc;
}

.pot-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 26px;
    font-weight: 700;
}

.pot-unit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pot-unit-img {
    height: 22px;
    width: 22px;
    display: block;
    object-fit: contain;
}

.next-draw {
    font-size: 12px;
    color: #9ca3af;
}

.countdown-value {
    font-size: 40px;
    font-weight: 700;
}

.countdown-sub {
    font-size: 12px;
    color: #9ca3af;
}

.app-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ticket-section {
    background: rgba(15, 23, 42, 0.85);
    border-radius: 16px;
    padding: 14px 16px 16px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(18px);
}

.ticket-section h2 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
}

.ticket-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.section-help {
    margin: 0 0 12px;
    font-size: 12px;
    color: #9ca3af;
}

.ticket-form .field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-note {
    margin-top: 4px;
    font-size: 11px;
    color: #9ca3af;
}

.inline-star-icon {
    height: 14px;
    width: 14px;
    object-fit: contain;
    vertical-align: -2px;
    margin: 0 2px;
}

.chip-btn,
.ghost-chip {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
}

.chip-btn {
    width: 32px;
}

input[type="number"] {
    border-radius: 10px;
    border: 1px solid rgba(55, 65, 81, 0.8);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    padding: 6px 10px;
    font-size: 14px;
}

input[type="number"]:focus {
    outline: 1px solid #6366f1;
    border-color: #6366f1;
}

/* Hide number input spinners on desktop browsers */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.choice-mode-toggle {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 999px;
    padding: 2px;
    border: 1px solid rgba(55, 65, 81, 0.9);
}

.toggle-btn {
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
}

.toggle-btn.active {
    background: linear-gradient(135deg, #6366f1, #22c55e);
    color: #f9fafb;
}

.primary-btn,
.ghost-btn {
    width: 100%;
    border-radius: 999px;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 4px;
}

.primary-btn {
    background: linear-gradient(135deg, #6366f1, #22c55e);
    color: #f9fafb;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.55);
}

.primary-btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.5);
}

.ghost-btn {
    background: transparent;
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.8);
}

.ghost-btn.small {
    width: auto;
    padding: 6px 10px;
    font-size: 12px;
}

.ticket-card {
    border-radius: 14px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    padding: 10px 12px;
    background: radial-gradient(circle at top, rgba(79, 70, 229, 0.18), rgba(15, 23, 42, 0.9));
    margin-bottom: 8px;
}

.ticket-card.winner {
    border-color: rgba(34, 197, 94, 0.9);
    background: radial-gradient(circle at top, rgba(22, 163, 74, 0.3), rgba(15, 23, 42, 0.95));
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-row {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: radial-gradient(circle at top, rgba(148, 163, 184, 0.18), rgba(15, 23, 42, 0.95));
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    color: inherit;
}

.history-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-title {
    font-size: 14px;
    font-weight: 600;
}

.history-sub {
    font-size: 12px;
    color: #9ca3af;
}

.history-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.history-label {
    font-size: 11px;
    color: #9ca3af;
}

.history-value {
    font-size: 13px;
    font-weight: 500;
}

.winner-status-tag {
    color: #22c55e;
}

.no-winner-status-tag {
    color: #f97373;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 8px;
}

.ticket-body {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.number-input {
    width: 52px;
    text-align: center;
}

.ticket-quick-add {
    margin-top: 8px;
}

.ticket-list.empty-state {
    font-size: 13px;
    color: #9ca3af;
}

.number-pill {
    min-width: 32px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: rgba(15, 23, 42, 0.85);
    text-align: center;
    font-size: 13px;
}

.drawing-page .app-main {
    margin-top: 8px;
}

.drawing-stage {
    position: relative;
    height: 300px;
    border-radius: 20px;
    background: radial-gradient(circle at top, rgba(94, 234, 212, 0.25), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(56, 189, 248, 0.5);
    overflow: hidden;
}

.drawing-line {
    position: absolute;
    bottom: 30%;
    left: 8%;
    right: 8%;
    height: 2px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0), rgba(248, 250, 252, 0.9), rgba(148, 163, 184, 0));
}

#falling-numbers-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.slots {
    position: absolute;
    bottom: 12%;
    left: 8%;
    right: 8%;
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.slot {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-bubble {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #e5e7eb, #60a5fa);
    color: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.6);
}

.number-bubble.falling {
    position: absolute;
    top: -60px;
    animation: fall 2.1s cubic-bezier(0.24, 0.82, 0.42, 1.07) forwards;
}

.number-bubble.landed {
    animation: landed-pop 0.5s ease-out;
}

@keyframes fall {
    0% {
        transform: translate3d(0, -20px, 0) scale(0.9);
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
    70% {
        transform: translate3d(0, 170px, 0) scale(1.05);
    }
    100% {
        transform: translate3d(0, 190px, 0) scale(1);
    }
}

@keyframes landed-pop {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }
    60% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.animated-card {
    animation: card-in 0.35s ease-out;
}

.animated-card.pulse {
    animation: pulse 0.4s ease-out;
}

@keyframes card-in {
    from {
        transform: translateY(6px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.referral-card {
    border-radius: 14px;
    padding: 10px 12px 12px;
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.22), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(59, 130, 246, 0.7);
    margin-bottom: 10px;
}

.referral-card label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #bfdbfe;
}

.referral-row {
    margin-top: 6px;
    display: flex;
    gap: 6px;
}

.ref-input {
    flex: 1;
    border-radius: 10px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    padding: 6px 10px;
    font-size: 12px;
}

.referral-stats {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
}

.stat {
    flex: 1;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(55, 65, 81, 0.9);
    padding: 8px 10px;
}

.stat-label {
    font-size: 11px;
    color: #9ca3af;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    margin-top: 2px;
}

.ref-users-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ref-users-header {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) auto auto;
    column-gap: 10px;
    padding: 0 10px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
}

.ref-user-row {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) auto auto;
    align-items: center;
    column-gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: radial-gradient(circle at top, rgba(59,130,246,0.14), rgba(15,23,42,0.95));
}

.ref-user-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ref-user-name {
    font-size: 13px;
    font-weight: 500;
}

.ref-user-joined {
    font-size: 11px;
    color: #9ca3af;
}

.ref-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.ref-user-label {
    font-size: 11px;
    color: #9ca3af;
}

.ref-user-value {
    font-size: 15px;
    font-weight: 600;
}

.ref-user-name-col a {
    font-size: 13px;
    color: #e5e7eb;
    text-decoration: none;
}

.ref-user-name-col a:hover {
    text-decoration: underline;
}

.ref-user-tickets {
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.ref-user-date {
    font-size: 11px;
    color: #9ca3af;
    text-align: right;
}

/* Ensure header labels stay small even though they share column classes */
.ref-users-header .ref-user-name-col,
.ref-users-header .ref-user-tickets,
.ref-users-header .ref-user-date {
    font-size: 11px;
    font-weight: 500;
}

.help-widget-section {
    padding-top: 10px;
}

.help-widget {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switch {
    display: inline-flex;
    gap: 4px;
}

.lang-btn {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
}

.lang-btn.active {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4);
}

.buy-stars-btn {
    /* Reuse primary-btn visuals but make it a compact header pill */
    width: auto;
    padding: 6px 12px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: -2px; /* visually center with language buttons */
}

.buy-stars-label {
    white-space: nowrap;
}

.help-icon {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #22c55e, #6366f1);
    color: #f9fafb;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.6);
    cursor: pointer;
}

.help-copy h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.help-copy .section-help {
    margin-top: 2px;
}

.winner-status-chip {
    margin-top: 8px;
    font-size: 12px;
}

.winner-status-chip--yes {
    color: #22c55e;
    font-weight: 600;
}

.winner-status-chip--no {
    color: #f97373;
    font-weight: 600;
}

.winner-row a,
.winner-row span {
    font-size: 13px;
    color: #e5e7eb;
    text-decoration: none;
}

.winner-row a:hover {
    text-decoration: underline;
}

.help-list,
.help-steps {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 13px;
    color: #e5e7eb;
}

.help-list li + li,
.help-steps li + li {
    margin-top: 4px;
}

/* Draw animation drum (shared with demo-draw-animation.html) */
#draw_animation{
    background: radial-gradient(circle at top, #1f2937 0, #020617 40%, #000 100%);
    height: 300px;
    width: 450px;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    color: #e5e7eb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
}
#draw_animation>div{
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
}
#draw_animation p{
    margin: 0;
}
#draw_animation .intro{
    background: radial-gradient(circle at top, #0b1120, #020617);
    margin: 10px;
    border-radius: 16px;
}
#draw_animation .intro p{
    position: absolute;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
#draw_animation .shuffle_board{
    height: 100%;
    background: radial-gradient(circle at top, #020617, #020617 60%, #000);
}
#draw_animation .shuffle_board>div{
    display: inline-block;
    float: left;
}
#draw_animation .shuffle_board .indicator_section{
    height: 100%;
    width: 10%;
    padding-top: 20px;
    transform: rotate(-1deg);
}
#draw_animation .shuffle_board .indicator_section .indicator{
    width: 15px;
    height: 15px;
    margin: 30px 15px;
    border-radius: 50%;
    background-color: #4b5563;
    box-shadow: 3px 1px 4px #020617;
    animation: indicator_lights 3s linear infinite;
    animation-delay: 0.5s;
}
#draw_animation .shuffle_board .indicator_section .indicator+div{
    animation-delay: 1s;
}
#draw_animation .shuffle_board .indicator_section .indicator+div+div{
    animation-delay: 1.5s;
}
#draw_animation .shuffle_board .indicator_section .indicator+div+div+div{
    animation-delay: 2s;
}
#draw_animation .shuffle_board .board_bars{
    height: 100%;
    width: 10%;
    border-left: 14px solid #197d74;
    border-right: 14px solid #197d74;
    box-sizing: border-box;
    box-shadow: 3px 1px 4px #111827;
    transform: rotate(-1deg);
}
#draw_animation .shuffler{
    height: 100%;
    width: 80%;
}
#draw_animation .shuffler .shuffler_caret{
    border-radius: 50%;
    width: 250px;
    height: 250px;
    margin: -90px auto 20px;
    border: 40px solid #c7c4a4;
    background-color: #111827;
    box-shadow: inset 0px 0px 0px 90px #6366f1;
    position: relative;
    animation: rotate_shuffler 5s linear infinite;
}
#draw_animation .shuffler .shuffler_caret:after{
    content: '';
    position: absolute;
    left: -20px;
    top: -20px;
    right: -20px;
    bottom: -20px;
    border: 3px dashed #22c55e;
    border-radius: 50%;
    animation: rotate_shuffler 0.5s linear infinite reverse;
}
#draw_animation .shuffler .shuffler_caret .shuffler_ball{
    /* Hidden internal balls (we only show result balls) */
    display: none;
}
#draw_animation .shuffler_canel{
    position: absolute;
    bottom: -25px;
    width: 300px;
    height: 50px;
    padding-right: 20px;
    left: 0;
    background-color: #020617;
    transform: rotate(-5deg);
    border-right: 10px solid #444;
    box-sizing: border-box;
    text-align: right;
}
#draw_animation .shuffler_canel:after{
    position: absolute;
    content: '';
    background-color: #0f172a;
    height: 35px;
    width: 240px;
    left: -20px;
    top: -34px;
    border-right: 60px solid #444;
    z-index: -1;
}
#draw_animation .shuffler_canel:before{
    content: '';
    position: absolute;
    bottom: 50px;
    right: -30px;
    width: 50px;
    height: 100px;
    border-radius: 40%;
    background-color: #111827;
    border: 15px solid #6366f1;
    border-bottom: 0;
    transform: rotate(5deg);
}
#draw_animation .shuffler_canel .indicator{
    display: inline-block;
    float: right;
    width: 15px;
    height: 15px;
    margin: 20px 15px;
    border-radius: 50%;
    background-color: #ababab;
    box-shadow: 3px 1px 4px #444;
    animation: indicator_lights 3s linear infinite;
    animation-delay: 0.5s;
}
#draw_animation .shuffler_canel .indicator+div{
    animation-delay: 1s;
}
#draw_animation .shuffler_canel .indicator+div+div{
    animation-delay: 1.5s;
}
#draw_animation>.drawn_ball{
    height: 50px;
    width: 50px;
    left: 300px;
    top: -100px;
    border-radius: 50%;
    position: absolute;
    text-align: center;
    line-height: 50px;
    background: radial-gradient(circle at 30% 20%, #bbf7d0, #22c55e);
    box-shadow: 0 4px 12px rgba(15,23,42,0.9);
    color: #020617;
}
.final_scene{
    background-color: #020617;
}
.final_scene .frame{
    background-color: #020617;
    height: 100%;
    border-radius: 20px;
    box-shadow: 3px 1px 4px #444;
    transform: rotate(5deg);
    margin: 20px 50px -20px -50px;
    text-align: center;
}
.final_scene .canel{
    padding-right: 30px;
    height: 60px;
}
.final_scene .canel .indicator{
    display: inline-block;
    float: right;
    width: 20px;
    height: 20px;
    margin: 20px 15px;
    border-radius: 50%;
    background-color: #4b5563;
    box-shadow: 3px 1px 4px #444;
    animation: indicator_lights 3s linear infinite;
    animation-delay: 0.5s;
}
.final_scene .main_canel{
    background-color: #111827;
    height: 40px;
    /* Center the chute within the frame and make it a bit larger */
    margin: 0 40px;
    border-radius: 24px;
}
@keyframes rotate_shuffler{
    0%{ transform: rotate(0deg); }
    100%{ transform: rotate(360deg); }
}
@keyframes indicator_lights{
    0%{ background-color: #ababab; }
    25%{ background-color: red; box-shadow: 3px 1px 4px red; }
    50%{ background-color: #ababab; box-shadow: 3px 1px 4px #444; }
}


