@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;900&family=Zen+Maru+Gothic:wght@400;700;900&display=swap');

:root {
    --primary-color: #F48FB1;
    --secondary-color: #4FC3F7;
    --accent-color: #FF69B4;
    --text-color: #1976D2;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(33, 150, 243, 0.15);
}

/* Modal Stability Lock */
body.body-lock {
    overflow: hidden !important;
    height: 100vh;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    height: 100%;
    /* Fix for mobile scroll jump */
}

body {
    font-family: 'Zen Maru Gothic', sans-serif;
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 30%, #90CAF9 60%, #64B5F6 100%);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100%;
    /* Changed from 100vh to avoid viewport rework issues */
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 480px;
    /* Mobile focused */
    position: relative;
    z-index: 1;
    margin: 0 auto;
    /* Center container */
    display: none;
    /* Hidden by default for Flow Enforcement */
}

.hidden {
    display: none !important;
}

#background-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
    isolation: isolate;
    /* Create new stacking context for background elements */
}

/* Background Blobs for depth */
.blob-1 {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.3;
    top: -10%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: #42A5F5;
    animation: float1 15s infinite alternate ease-in-out;
    will-change: transform, opacity;
}

.blob-2 {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.3;
    bottom: -10%;
    right: -10%;
    width: 350px;
    height: 350px;
    background: #26C6DA;
    animation: float2 18s infinite alternate ease-in-out;
    will-change: transform, opacity;
}

.blob-3 {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.2;
    top: 40%;
    right: -5%;
    width: 250px;
    height: 250px;
    background: #FF8A80;
    animation: float3 20s infinite alternate ease-in-out;
}


/* Sky Background */
.sky-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 130%;
    height: 550px;
    background-image: url('sky_bg.png');
    background-size: cover;
    background-position: center bottom;
    z-index: -1;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.8) 50%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.8) 50%, rgba(0, 0, 0, 0) 100%);
    opacity: 0.8;
    animation: skyDrift 60s linear infinite alternate;
}

@keyframes float1 {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    50% {
        transform: translate(100px, 50px) scale(1.2) rotate(10deg);
    }

    100% {
        transform: translate(-40px, 100px) scale(1) rotate(-10deg);
    }
}

@keyframes float2 {
    0% {
        transform: translate(0, 0) scale(1.2) rotate(0deg);
    }

    50% {
        transform: translate(-80px, -70px) scale(1) rotate(-15deg);
    }

    100% {
        transform: translate(50px, -40px) scale(1.2) rotate(15deg);
    }
}

@keyframes float3 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(-50px, 100px) scale(1.3);
    }

    100% {
        transform: translate(20px, -30px) scale(1);
    }
}


@keyframes skyDrift {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-15%);
    }
}

/* Rainbow */
/* Refined Pastel Rainbow - ARCH (Frown) */
.rainbow {
    position: absolute;
    /* Position center of rings near bottom to arc upwards */
    top: auto;
    bottom: -40vh;
    /* Raised slightly more (from -50vh) */
    left: 50%;
    transform: translateX(-50%);

    width: 150vh;
    height: 150vh;

    /* Create a THINNER arc with PASTEL colors */
    background: radial-gradient(circle at 50% 100%,
            transparent 62%,
            rgba(255, 179, 186, 0.6) 62%, rgba(255, 179, 186, 0.6) 64%,
            /* Red */
            rgba(255, 223, 186, 0.6) 64%, rgba(255, 223, 186, 0.6) 66%,
            /* Orange */
            rgba(255, 255, 186, 0.6) 66%, rgba(255, 255, 186, 0.6) 68%,
            /* Yellow */
            rgba(186, 255, 201, 0.6) 68%, rgba(186, 255, 201, 0.6) 70%,
            /* Green */
            rgba(186, 225, 255, 0.6) 70%, rgba(186, 225, 255, 0.6) 72%,
            /* Cyan */
            rgba(174, 198, 255, 0.6) 72%, rgba(174, 198, 255, 0.6) 74%,
            /* Blue */
            rgba(224, 186, 255, 0.6) 74%, rgba(224, 186, 255, 0.6) 76%,
            /* Violet */
            transparent 76%);

    opacity: 0;
    z-index: 1;
    pointer-events: none;
    will-change: transform, opacity, clip-path;

    /* Fade only the left and right ends (start/end of the arc) */
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);

    /* Animation: Draw from left to right - Sped up */
    animation: rainbowDrawIn 0.6s ease-out forwards;
}

@keyframes rainbowDrawIn {
    0% {
        opacity: 0;
        clip-path: inset(0 100% 0 0);
        /* Start fully clipped from the right */
        transform: translateX(-50%) translateY(10px);
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0.9;
        clip-path: inset(0 0 0 0);
        /* Fully revealed */
        transform: translateX(-50%) translateY(0);
    }
}

/* Twinkle Stars */
.stars-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Cover full BG, but stars generated in top 40% via JS */
    pointer-events: none;
    z-index: 2;
}

.star {
    position: absolute;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #fff 20%, transparent 70%);

    /* Sharp 4-point Sparkle (Cross-like) */
    clip-path: polygon(50% 0%,
            55% 45%,
            100% 50%,
            55% 55%,
            50% 100%,
            45% 55%,
            0% 50%,
            45% 45%);

    opacity: 0;
    animation: twinkle 2.5s infinite ease-in-out;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));
}

.star::after {
    /* Remove previous rounded after-element */
    display: none;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.2) rotate(45deg);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

/* Glassmorphism Card */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

/* Header */
/* Header */
header {
    text-align: center;
    margin-bottom: 25px;
    /* Normal spacing for admin etc. */
    position: relative;
    z-index: 3;
}

header.logo-header {
    margin-bottom: -45px;
    /* Overlap for logo view */
}

.icon-btn-header {
    background: rgba(255, 255, 255, 0.3);
    border: none !important;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    line-height: 1;
    position: relative;
    z-index: 100;
    padding: 0;
    font-family: inherit;
}

.icon-btn-header:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.icon-btn-header:active {
    transform: scale(0.95);
}

/* Privacy Mode Toggle Button Styles */
.privacy-btn {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.eye-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.settings-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Privacy Masking Styles */
body.privacy-mode .total-points,
body.privacy-mode .currency-value-large,
body.privacy-mode #total-earned,
body.privacy-mode #total-used,
body.privacy-mode .history-item .bubble-meta,
body.privacy-mode .history-item .bubble,
body.privacy-mode .request-item .item-reason,
body.privacy-mode .request-item .item-points,
body.privacy-mode #members-list div>span:first-child,
body.privacy-mode .item-left .item-reason,
body.privacy-mode .item-left .item-points {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease;
}

body.privacy-mode .history-item .avatar {
    filter: grayscale(1) opacity(0.5);
}

/* Optional: overlay text for blurred areas? No, blurring is enough. */



.app-title-logo {
    max-width: 200px;
    /* Standardize */
    width: 65%;
    height: auto;
    display: block;
    margin: 0px auto 15px auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

h1.app-title {
    /* display: none; - Restored for admin and setup screens */
    font-family: 'Zen Maru Gothic', sans-serif;
    font-weight: 900;
    font-size: 2.2rem;
    letter-spacing: 2px;
    color: #F48FB1;
    text-shadow: 0 2px 8px rgba(244, 143, 177, 0.4);
    -webkit-text-stroke: 2px white;
    paint-order: stroke fill;
    margin: 10px 0 20px 0;
    text-align: center;
}

/* Points Display */
/* Points Display */
.points-display {
    text-align: center;
    position: relative;
    margin-top: 0;
}

.points-label {
    font-size: 1rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-btn {
    font-size: 1.6rem;
}

.stats-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1) rotate(5deg);
}

/* Floating Stats Button */
.stats-btn-floating {
    position: absolute;
    top: 83px;
    right: 35px;
    z-index: 10000;
    pointer-events: auto;
}

@media screen and (max-width: 480px) {
    .stats-btn-floating {
        right: 40px;
        top: 73px;
    }
}

/* Stats Page Styles */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.back-btn {
    text-decoration: none;
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
    opacity: 0.8;
}

.chart-container {
    width: 100%;
    height: 300px;
    margin-bottom: 20px;
}

.stats-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.stats-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    text-align: center;
}

.summary-val {
    font-size: 1.5rem;
    font-weight: 900;
    font-family: 'Nunito', sans-serif;
}

.summary-label {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Rotating Display */
.rotating-container {
    position: relative;
    width: 100%;
    height: 80px;
    perspective: 1000px;
    z-index: 1;
}

.display-side {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.8s;
}

.side-front {
    transform: rotateX(0deg);
}

.side-back {
    transform: rotateX(180deg);
}

/* Flip State */
.rotating-container.show-back .side-front {
    transform: rotateX(-180deg);
}

.rotating-container.show-back .side-back {
    transform: rotateX(0deg);
}

.total-points {
    font-family: 'Nunito', sans-serif;
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    margin: 0;
    /* Reset margin for flex layout */
    color: #F48FB1;
    text-shadow: 0 0 20px rgba(244, 143, 177, 0.3);
}

.points-wrapper {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin: 10px 0;
    /* Restore margin on wrapper */
}

.points-unit {
    font-family: 'Zen Maru Gothic', sans-serif;
    font-size: 1rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-color);
    /* Match body text color, not pink points color */
    align-self: baseline;
    padding-bottom: 12px;
    /* Slight fine-tuning for visual baseline with Nunito font */
}

.currency-value-large {
    font-size: 4rem;
    font-weight: 700;
    margin: 10px 0;
    color: #F48FB1;
    text-shadow: 0 0 20px rgba(244, 143, 177, 0.3);
}

/* Section Titles */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
    z-index: 5;
}

.section-header h2 {
    margin: 0;
}

.glass-card h2 {
    font-size: 1.2rem;
    padding-left: 10px;
    border-left: 4px solid #F48FB1;
    margin: 0px 0px 10px 0px;
}

.settings-btn-history {
    font-size: 1.3rem;
}

/* History List - Chat Style Refactor */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    animation: slideIn 0.3s ease forwards;
}

.bubble-container {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    max-width: 85%;
}

.bubble-left {
    align-self: flex-start;
}

.bubble-right {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.bubble {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    overflow-wrap: anywhere;
}

.bubble-left .bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.bubble-right .bubble {
    background: #FFFEF0;
    /* Very light yellow, almost white */
    color: #333;
    border-bottom-right-radius: 4px;
}

/* Points within bubble or next to it */
.bubble-meta {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 4px;
    color: #1976d2
}

.history-item:has(.bubble-left) .bubble-meta {
    align-items: flex-start;
    margin-left: 40px;
}

.history-item:has(.bubble-right) .bubble-meta {
    align-items: flex-end;
    margin-right: 40px;
}

.bubble-points {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 1.1rem;
    color: #ffd700;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

.bubble-left .bubble-points {
    color: #f39c12;
}

.bubble-right .bubble-points {
    color: #d35400;
}

.item-points.negative {
    color: #ff4444;
}

.stamp-badge {
    display: inline-block;
    color: #ff4444;
    border: 2px solid #ff4444;
    border-radius: 50%;
    width: 24px;
    /* Slightly smaller for alignment */
    height: 24px;
    line-height: 20px;
    text-align: center;
    font-weight: 900;
    font-size: 0.8rem;
    margin-right: 8px;
    /* Space before points */
    transform: rotate(-15deg);
    box-shadow: 0 0 2px rgba(255, 68, 68, 0.5);
    background: rgba(255, 68, 68, 0.1);
    vertical-align: middle;
    flex-shrink: 0;
}

.history-item.is-appeal {
    background: rgba(255, 92, 147, 0.15);
    /* Soft pink/red tint for appeals */
    border-left: 4px solid #ff4444;
}

/* Admin Styles */
.pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 22000;
    transition: opacity 0.3s;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

.pin-input {
    display: block;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-align: center;
    padding: 10px;
    width: 100%;
    margin: 10px auto;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.pin-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

input,
button,
select {
    font-family: 'Zen Maru Gothic', sans-serif;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.form-label::before {
    content: '▼ ';
    color: #F48FB1;
    margin-right: 4px;
}

.form-input {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 2px solid #B3E5FC;
    background: rgba(227, 242, 253, 0.5);
    color: #1976D2;
    font-size: 1.1rem;
}

.form-input:focus {
    outline: 2px solid #1976D2;
    background: rgba(227, 242, 253, 0.8);
}


/* Reason Chips */
.reason-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

/* Purpose Chips (for つかいみち selection) */
.purpose-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.chip {
    background: rgba(100, 181, 246, 0.2);
    border: 2px solid #B3E5FC;
    border-radius: 20px;
    padding: 6px 12px;
    color: #1976D2;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 700;
}

.chip:hover {
    background: rgba(100, 181, 246, 0.4);
    border-color: #81D4FA;
    transform: translateY(-2px);
}

.chip:active {
    transform: scale(0.95);
}

/* Hide chip radio inputs */
.chip-input {
    display: none;
}

/* Selected chip state */
.chip-input:checked+.chip {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
    box-shadow: 0 4px 10px rgba(37, 117, 252, 0.3);
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
}

.toggle-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    color: #1976D2;
}

.toggle-btn.active {
    background: #F48FB1;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.toggle-btn:not(.active) {
    opacity: 0.6;
}

.toggle-btn:not(.active):hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

/* Use Mode Colors - Removed red gradient to match standard theme as requested */


body.use-mode .form-input:focus {
    outline-color: #ff4444;
}

.btn-primary {
    width: 100%;
    padding: 18px;
    border-radius: 50px;
    /* Matched to FAB */
    border: none;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    font-size: 1.2rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.3);
    transition: transform 0.1s;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Modal Styles */
/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    padding: 30px 25px;
    border-radius: 28px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: auto;
    /* Ensure centering */
}

.modal .form-input {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.modal .form-input:focus {
    background: white;
}

.modal h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

/* Request Modal and Appeal Modal Title Colors */
#request-modal h2,
#appeal-modal h2 {
    color: #F48FB1;
}

/* Remaining Points Text Color in Request Modal */
#request-modal p {
    color: #F48FB1;
}

.close-modal {
    position: absolute;
    top: 15px;
    left: 15px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: #555;
    background: #f0f0f0;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding-right: 2px;
}

.close-modal.top-right {
    left: auto;
    right: 15px;
    padding-right: 0;
}

.close-modal:hover {
    background: #e0e0e0;
    color: var(--primary-color);
    transform: scale(1.05);
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.radio-label {
    flex: 1;
    text-align: center;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.radio-input {
    display: none;
}

.radio-input:checked+.radio-label {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(37, 117, 252, 0.3);
}

/* Request List */
.request-item {
    background: rgba(255, 255, 0, 0.15);
    border: 1px solid rgba(255, 255, 0, 0.3);
    padding: 0px 10px 10px 10px;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.request-actions {
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.btn-approve {
    background: #4caf50;
    color: white;
}

.btn-reject {
    background: #f44336;
    color: white;
}

/* Floating Fab for Request */
/* Floating Fab for Request */
/* Floating Fab for Request */
.fab-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 100;
    align-items: center;
    width: 100%;
    pointer-events: none;
    /* Let clicks pass through container area */
}

.fab {
    pointer-events: auto;
    /* Re-enable clicks on buttons */
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    /* Match btn-primary */
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.3);
    /* Match btn-primary shadow approx */
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    letter-spacing: 1px;
    /* white-space: nowrap; Removed to allow wrap */
    border: none;
    /* Ensure no border on button elements */
    font-size: 1.4rem;
    /* Increased size */
    animation: gentlePulse 3s infinite ease-in-out;
}

@keyframes gentlePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 6px 20px rgba(33, 150, 243, 0.6);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
    }

}

.fab-secondary {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    /* Match btn-primary */
    font-size: 1.2rem;
    /* Increased size relative to base but kept slightly smaller if desired, or match main fab */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    padding: 15px 30px;
    /* Increased padding */
}

.fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.5);
}

.fab:active {
    transform: scale(0.95);
}


.delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    border: 2px solid white;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.delete-btn:hover {
    background: #cc0000;
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(255, 68, 68, 0.4);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.action-container,
.appeal-container {
    text-align: center;
    margin: 10px 0 0 0;
    padding: 0;
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 15px;
    position: relative;
}

@media screen and (max-width: 480px) {

    html,
    body {
        height: auto;
        /* Prevent horizontal scroll from background elements */
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    body {
        padding: 5px 12px 20px 12px;
        /* Added bottom padding for space after last button */
    }

    .container {
        height: auto;
        /* Natural height */
        display: block;
        /* Standard flow */
        padding: 0;
        max-width: 100%;
    }

    header {
        margin-bottom: 20px;
        /* Reset for admin/setup */
        position: relative;
        z-index: 3;
    }

    header.logo-header {
        margin-bottom: -45px;
        /* Keep for logo overlap */
    }

    .app-title-logo {
        max-width: 180px;
        /* Slightly smaller on mobile */
        margin: 0px auto 15px auto;
        display: block;
    }

    .glass-card {
        margin-bottom: 12px;
        /* Standard card spacing */
        border-radius: 20px;
        margin: 10px 20px 0px 20px;
    }

    .section-header {
        z-index: 5;
    }

    .rotating-container {
        height: 60px;
    }

    .total-points {
        font-size: 4rem;
    }

    .currency-value-large {
        font-size: 2.1rem;
    }

    /* History Section */


    .history-section h2 {
        font-size: 1.1rem;
    }

    .history-list {
        height: 250px;
        gap: 12px;
    }

    .avatar {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .bubble {
        padding: 10px 14px;
        font-size: 0.95rem;
    }

    /* Footer / Appeal area */
    .appeal-container {
        padding: 0;
        text-align: center;
    }

    .fab {
        padding: 14px 25px;
        font-size: 1.2rem;
    }

    .icon-btn-header {
        width: 38px;
        height: 38px;
    }

    .stats-btn {
        font-size: 1.3rem;
    }

    .settings-btn-history {
        font-size: 1.1rem;
    }

    /* Modals & Others */
    .modal {
        max-height: 98vh;
        overflow-y: auto;
    }

    /* Login Screen Input Fields */
    .pin-input {
        display: block;
        font-size: 1rem;
        letter-spacing: 1px;
        width: 100%;
        margin: 10px auto;
    }

    /* Welcome Screen Optimization for iPhone SE */
    #setup-overlay .modal {
        padding: 15px 12px !important;
        max-height: 95vh;
        overflow-y: auto;
    }

    #setup-overlay .app-title {
        font-size: 1.4rem !important;
        margin-bottom: 8px !important;
    }

    #setup-overlay p {
        font-size: 0.8rem !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
    }

    #setup-overlay .form-group {
        margin-bottom: 10px !important;
    }

    #setup-overlay .form-label {
        font-size: 0.85rem !important;
        margin-bottom: 4px !important;
    }

    #setup-overlay .form-input {
        padding: 10px !important;
        font-size: 0.95rem !important;
    }

    #setup-overlay #setup-pin {
        font-size: 1.2rem !important;
        letter-spacing: 0.3em !important;
        padding: 10px !important;
    }

    #setup-overlay input[type="checkbox"] {
        width: 16px !important;
        height: 16px !important;
    }

    #setup-overlay label[for="tos-checkbox"] {
        font-size: 0.8rem !important;
    }

    #setup-overlay .btn-primary {
        padding: 12px !important;
        font-size: 0.95rem !important;
    }

    #setup-overlay .form-group[style*="margin: 20px 0"] {
        margin: 10px 0 !important;
    }

    /* Admin Management Screen Optimization for iPhone SE */
    #members-modal .modal {
        padding: 15px 12px !important;
        max-height: 95vh;
        overflow-y: auto;
    }

    #members-modal h2 {
        font-size: 1.3rem !important;
        margin-bottom: 15px !important;
    }

    #members-modal h3 {
        font-size: 0.9rem !important;
        margin-bottom: 10px !important;
    }

    #members-modal h4 {
        font-size: 0.85rem !important;
        margin-bottom: 8px !important;
    }

    #members-modal>div>div[style*="margin-bottom: 25px"] {
        margin-bottom: 15px !important;
    }

    #members-modal .form-group {
        margin-bottom: 10px !important;
    }

    #members-modal .form-label {
        font-size: 0.8rem !important;
        margin-bottom: 4px !important;
    }

    #members-modal .form-input {
        padding: 10px !important;
        font-size: 0.9rem !important;
    }

    #members-modal .btn-primary {
        padding: 10px !important;
        font-size: 0.9rem !important;
    }

    #members-modal button[style*="flex: 1"] {
        padding: 10px 8px !important;
    }

    #members-list {
        max-height: 180px !important;
        font-size: 0.85rem !important;
    }

    #members-summary {
        font-size: 0.8rem !important;
        margin-bottom: 10px !important;
    }

    #members-modal div[style*="background: rgba(255,255,255,0.3)"] {
        padding: 12px !important;
    }

    #members-modal div[style*="padding-top: 20px"] {
        padding-top: 15px !important;
    }

    #members-modal p[style*="font-size: 0.75rem"] {
        font-size: 0.7rem !important;
    }
}

.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    /* Solid high-opacity background instead of buggy blur */
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    overflow-y: auto;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.celebration-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#appeal-modal {
    z-index: 25000 !important;
}

.celebration-sunburst {
    position: fixed;
    width: 600px;
    height: 600px;
    background: repeating-conic-gradient(from 0deg,
            rgba(255, 255, 255, 0.5) 0deg 20deg,
            transparent 20deg 40deg);
    z-index: -1;
    border-radius: 50%;
    animation: sunburstRotate 20s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    -webkit-mask-image: radial-gradient(closest-side, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 0) 100%);
    mask-image: radial-gradient(closest-side, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 0) 100%);
}

@keyframes sunburstRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.celebration-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    gap: 15px;
    /* Added 15px gap instead of 0 */
    animation: celebratePop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backface-visibility: hidden;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.celebration-text {
    text-align: center;
    font-size: 2.8rem;
    /* Increased from 1.8rem */
    font-weight: 900;
    color: #F48FB1;
    -webkit-text-stroke: 2px white;
    /* Increased stroke */
    text-shadow: 0 4px 15px rgba(244, 143, 177, 0.5);
    /* Enhanced shadow */
    margin-top: 0;
    line-height: 1.2;
}

.celebration-mascot {
    width: 250px;
    height: 250px;
    margin-bottom: 0;
    /* Removed -20px */
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
}

@keyframes celebratePop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Mascot Features (Sprite Sheet) --- */

.char-sprite {
    display: inline-block;
    background-image: url('characters/yoipon.png');
    background-size: 2000px 1000px;
    /* 8 chars * 250px, 4 rows * 250px */
    background-repeat: no-repeat;
    image-rendering: -webkit-optimize-contrast;
    /* Keep it crisp */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

/* Row 1: Celebration (0-7) */
.sprite-row-1 {
    background-position-y: 0px;
}

/* Row 2: Title Decor (8-15) */
.sprite-row-2 {
    background-position-y: -250px;
}

/* Row 3: Stamps (16-23) */
.sprite-row-3 {
    background-position-y: -500px;
}

/* Row 4: Approval (24) */
.sprite-row-4 {
    background-position-y: -750px;
}

/* Indices (0-7 per row) */
.sprite-idx-0 {
    background-position-x: 0px;
}

.sprite-idx-1 {
    background-position-x: -250px;
}

.sprite-idx-2 {
    background-position-x: -500px;
}

.sprite-idx-3 {
    background-position-x: -750px;
}

.sprite-idx-4 {
    background-position-x: -1000px;
}

.sprite-idx-5 {
    background-position-x: -1250px;
}

.sprite-idx-6 {
    background-position-x: -1500px;
}

.sprite-idx-7 {
    background-position-x: -1750px;
}



/* Title Decoration (Fixed at Left Shoulder) */
.title-decoration {
    position: absolute;
    width: 90px;
    height: 90px;
    background-size: 720px 360px;
    /* 8*90, 4*90 */
    z-index: 10;
    pointer-events: none;
}

/* Continuously bob in place */
.title-decoration.resting {
    animation: simpleBob 3s infinite ease-in-out;
}

@keyframes simpleBob {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Row/Index Overrides for 90px (Restored Original) */
.title-decoration.sprite-row-2 {
    background-position-y: -90px;
}

.title-decoration.sprite-idx-0 {
    background-position-x: 0px;
}

.title-decoration.sprite-idx-1 {
    background-position-x: -90px;
}

.title-decoration.sprite-idx-2 {
    background-position-x: -180px;
}

.title-decoration.sprite-idx-3 {
    background-position-x: -270px;
}

.title-decoration.sprite-idx-4 {
    background-position-x: -360px;
}

.title-decoration.sprite-idx-5 {
    background-position-x: -450px;
}

.title-decoration.sprite-idx-6 {
    background-position-x: -540px;
}

.title-decoration.sprite-idx-7 {
    background-position-x: -630px;
}

/* Sticker system (Stamps) */
.yoipo-sticker {
    display: inline-block;
    width: 80px;
    height: 80px;
    background-size: 640px 320px;
    /* 8*80, 4*80 */
    vertical-align: middle;
    margin: -10px -15px -5px -5px;
}


.yoipo-sticker.sprite-row-3 {
    background-position-y: -160px;
}

.yoipo-sticker.sprite-row-4 {
    background-position-y: -240px;
}

.yoipo-sticker.sprite-idx-0 {
    background-position-x: 0px;
}

.yoipo-sticker.sprite-idx-1 {
    background-position-x: -80px;
}

.yoipo-sticker.sprite-idx-2 {
    background-position-x: -160px;
}

.yoipo-sticker.sprite-idx-3 {
    background-position-x: -240px;
}

.yoipo-sticker.sprite-idx-4 {
    background-position-x: -320px;
}

.yoipo-sticker.sprite-idx-5 {
    background-position-x: -400px;
}

.yoipo-sticker.sprite-idx-6 {
    background-position-x: -480px;
}

.yoipo-sticker.sprite-idx-7 {
    background-position-x: -560px;
}

.history-list {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Ensure bubbles don't break with large stamps */
.bubble {
    display: flex;
    flex-direction: column;
    justify-content: center;
}


/* Sticker Picker */
.sticker-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 columns for better display */
    gap: 8px;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 8px;
}

.sticker-option {
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    transition: all 0.2s;
    padding: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1 / 1;
}

.sticker-option:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

.sticker-option.selected {
    border-color: #F48FB1;
    background: white;
    box-shadow: 0 4px 10px rgba(244, 143, 177, 0.3);
}

/* Avatar Picker - Using Carousel */
#avatar-picker {
    margin-top: 10px;
}

/* Avatar Carousel Styles */
.avatar-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.3);
    padding: 15px;
    box-sizing: border-box;
}

.avatar-carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    cursor: grab;
    user-select: none;
    width: 100%;
}

.avatar-carousel-track:active {
    cursor: grabbing;
}

.avatar-page {
    min-width: 100%;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    padding: 5px;
    box-sizing: border-box;
}

.avatar-page .avatar-option {
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    transition: all 0.2s;
    padding: 0;
    font-size: 2.5rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 60px;
}

.avatar-page .avatar-option:hover {
    transform: scale(1.05);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.avatar-page .avatar-option.selected {
    border-color: #FF9800;
    background: #FFF3E0;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.avatar-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    padding-top: 10px;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-dot.active {
    background: #FF9800;
    transform: scale(1.3);
}

.carousel-dot:hover {
    background: rgba(255, 152, 0, 0.5);
}

/* Mobile optimization for avatar carousel */
@media screen and (max-width: 480px) {
    .avatar-page {
        gap: 6px;
        padding: 2px;
    }

    .avatar-page .avatar-option {
        font-size: 2rem;
        min-height: 50px;
        border-width: 2px;
    }

    .avatar-carousel {
        padding: 10px;
    }
}

/* Photo Upload Styles */
.custom-photo-preview {
    width: 100%;
    max-width: 150px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 15px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #F48FB1;
    box-shadow: 0 4px 15px rgba(244, 143, 177, 0.4);
    background-color: #fff;
    /* Removed flex to allow img object-fit to work properly */
    position: relative;
}

.custom-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.custom-photo-preview.no-photo {
    aspect-ratio: 1 / 1;
    background-color: #eee;
    display: flex !important;
    justify-content: center;
    align-items: center;
    position: relative;
    border-color: #ddd;
    box-shadow: none;
}

.custom-photo-preview.no-photo img {
    display: none;
}

.custom-photo-preview.no-photo::after {
    content: "NO PICTURE";
    font-size: 0.8rem;
    font-weight: bold;
    color: #aaa;
    text-align: center;
}

/* Icon Preview styles */
#preview-avatar-icon {
    font-size: 4rem;
    line-height: 1;
    user-select: none;
    display: none;
}

.custom-photo-preview.showing-icon::after {
    display: none;
}

.custom-photo-preview.showing-icon {
    background: #fff;
    /* White background for icon */
    display: flex !important;
    justify-content: center;
    align-items: center;
}

.custom-photo-preview.showing-icon #preview-avatar-icon {
    display: block;
}

.custom-photo-preview.showing-icon img {
    display: none;
}

.photo-upload-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.btn-upload {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 2px solid #B3E5FC;
    background: rgba(135, 206, 235, 0.2);
    color: #1976D2;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Zen Maru Gothic', sans-serif;
}

.btn-upload:hover {
    background: rgba(135, 206, 235, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.2);
}

.btn-upload:active {
    transform: scale(0.98);
}

.btn-delete-photo {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 2px solid #ffcdd2;
    background: rgba(244, 67, 54, 0.1);
    color: #d32f2f;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Zen Maru Gothic', sans-serif;
}

.btn-delete-photo:hover {
    background: rgba(244, 67, 54, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(244, 67, 54, 0.2);
}

.btn-delete-photo:active {
    transform: scale(0.98);
}

/* Custom photo in avatar (history) */
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* --- iPhone SE & Small Screen Optimization (<480px) --- */
@media screen and (max-width: 480px) {

    /* Tighter body padding */
    body {
        padding: 5px 8px 20px 8px;
    }

    /* Modal Layout - Maximize Space */
    .modal {
        width: 95%;
        padding: 15px 15px;
        margin: 10px auto;
    }

    .modal h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }

    /* Stack Radio Groups to prevent text wrapping issues */
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .radio-label {
        width: 100%;
        margin: 0;
        /* Clear margins */
        padding: 12px;
    }

    /* Reduce Header Size and Spacing for single-scroll fit */
    h1.app-title {
        font-size: 1.5rem;
        margin: 5px 20px 5px 20px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .modal p {
        margin-bottom: 12px !important;
        font-size: 0.9rem;
    }

    .celebration-text {
        font-size: 2.0rem;
        /* Increased from 1.3rem for better visibility on mobile */
        font-weight: 900;
        -webkit-text-stroke: 1.5px white;
        text-shadow: 0 4px 10px rgba(244, 143, 177, 0.5);
    }

    /* Form Inputs */
    .form-input {
        padding: 12px;
        font-size: 1rem;
    }

    .btn-primary,
    .fab {
        padding: 14px 20px;
        font-size: 1.1rem;
    }

    /* Sticker Picker Grid Fit */
    .sticker-picker {
        padding: 6px;
        gap: 6px;
    }

    .sticker-option {
        width: auto;
        height: auto;
        aspect-ratio: 1 / 1;
        padding: 2px;
        border-width: 2px;
        position: relative;
        overflow: hidden;
    }

    /* Avatar Picker Mobile Fit */
    #avatar-picker {
        padding: 6px;
        gap: 6px;
    }

    .avatar-option {
        padding: 5px;
        font-size: 1.8rem;
        border-width: 2px;
    }

    .sticker-option .yoipo-sticker {
        position: absolute;
        top: 53%;
        left: 58%;
        width: 90px;
        height: 90px;
        margin: -45px 0 0 -45px;
        transform: scale(0.9);
        flex-shrink: 0;
    }

    /* Appeal Modal Optimizations for iPhone SE */
    #appeal-modal .modal {
        padding: 15px;
        max-height: 95vh;
        overflow-y: auto;
    }

    #appeal-modal h2 {
        margin-bottom: 8px;
        font-size: 1.2rem;
    }

    #appeal-modal p {
        margin-bottom: 8px;
        font-size: 0.85rem;
    }

    #appeal-modal .form-group {
        margin-bottom: 10px;
    }

    #appeal-modal .form-label {
        margin-bottom: 4px;
        font-size: 0.9rem;
    }

    #appeal-modal textarea.form-input {
        padding: 10px;
        font-size: 0.95rem;
    }

    #appeal-modal .sticker-picker {
        margin-top: 6px;
        margin-bottom: 6px;
    }

    #appeal-modal .btn-primary {
        padding: 12px;
        font-size: 1rem;
        margin-top: 8px;
    }
}

/* Settings Modal Actions */
.settings-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    width: 100%;
}

.text-link {
    color: #888;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    /* Increase padding for easier tap */
    text-align: center;
    width: 100%;
}

.text-link:hover {
    color: #555;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

/* PIN Overlay */
.pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.pin-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.pin-input {
    background: transparent;
    border: 2px solid white;
    color: white;
    text-align: center;
    padding: 10px;
    border-radius: 12px;
    outline: none;
}


/* Logo Shine Animation */
@keyframes logoShine {

    0%,
    90% {
        transform: scale(1);
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    }

    92% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8)) brightness(1.2);
    }

    94%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    }
}

.app-title-logo {
    animation: logoShine 15s infinite;
    /* Ensure base transition for smooth effect if other props change */
    transition: all 0.5s ease;
}

/* Settings Modal Form Spacing */
.form-group {
    margin-bottom: 30px;
}

.form-group .form-group {
    margin-top: 25px;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--text-color);
    font-size: 1.1rem;
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid rgba(33, 150, 243, 0.3);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Zen Maru Gothic', sans-serif;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}

#settings-modal .modal {
    max-height: 90vh;
    overflow-y: auto;
}

#settings-modal h2 {
    margin-bottom: 10px;
}

#settings-modal p {
    margin-bottom: 25px;
}

/* Avatar Wrapper and Nickname */
.avatar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.avatar-nickname {
    font-size: 0.65rem;
    color: var(--text-color);
    font-weight: 600;
    text-align: center;
    width: 44px;
    /* Slightly wider than 38px avatar for better text fit */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    line-height: 1.1;
    word-break: break-all;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(50, 50, 50, 0.95);
    color: white;
    padding: 14px 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 0.95rem;
    pointer-events: auto;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

.toast span {
    font-weight: 500;
}

.toast-undo-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #FFC107;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.toast-undo-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFD54F;
    border-color: #FFD54F;
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out, visibility 0.8s;
    opacity: 1;
    visibility: visible;
}

#splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-logo {
    max-width: 80%;
    width: 280px;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
    animation: splashPulse 2s infinite ease-in-out;
}

@keyframes splashPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* ToS Modal Styles */
.tos-modal {
    max-width: 90% !important;
    width: 400px !important;
}

.tos-content p {
    margin-bottom: 15px;
}

.tos-content strong {
    color: #F48FB1;
}

/* Custom scrollbar for ToS content */
.tos-content::-webkit-scrollbar {
    width: 4px;
}

.tos-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.tos-content::-webkit-scrollbar-thumb {
    background: rgba(244, 143, 177, 0.4);
    border-radius: 4px;
}

/* Standalone ToS Modal */
#tos-modal-standalone .modal {
    background: rgba(255, 255, 255, 0.98);
    border: 3px solid var(--primary-color);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2);
}

#tos-modal-standalone .tos-content {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Integrated Checkbox Styles */
#tos-checkbox {
    accent-color: var(--primary-color);
}

#setup-overlay .btn-primary:disabled {
    cursor: not-allowed;
}

/* QR and Child Setup */
.qr-container-unified {
    text-align: center;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    width: 256px;
    height: 256px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: content-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.qr-container-unified img {
    margin: 0 auto;
}

#child-setup-overlay .btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#post-setup-choice-overlay .text-link:hover {
    color: var(--primary-color) !important;
}



/* Fix for History Button Clickability */
/* Ensure history section is above header (z-index: 3) to allow button clicks */