/* Global settings */
html { background-color: #24252d; min-height: 100vh; }
* { font-family: 'MiiFont', 'Rubik', sans-serif; margin: 0; padding: 0; box-sizing: border-box; }

/* General body styling */
body { width: 100%; color: #fff; background: #1e1f25; display: flex; flex-direction: column; min-height: 100vh; text-align: center; font-size: 1rem; }
body.theme-blue { background: linear-gradient(-45deg, #00bcdd, #0088dd, #0069dd, #00dd9b, #0042ff) 200% 200%; animation: Gradient 4s ease infinite; }@keyframes Gradient { 0%{background-position:0% 50%} 50%{background-position:100% 50%} 100%{background-position:0% 50%} }

/* Rainbow text animation */
.rainbow-text { animation: rainbow 8s infinite; }
@keyframes rainbow {
    0% { color: #00aeff; }
    25% { color: #ff3c3c; }
    50% { color: #3cff3c; }
    75% { color: #c83cff; }
    100% { color: #00aeff; }
}

/* Component backgrounds */
body.theme-dark header, body header { background: #111215a0; }
body.theme-dark .room-card, body .room-card { background: #282a36; }
body.theme-dark .player-group, body .player-group { background: #3a3d4d; }
body.theme-dark .modal-content, body .modal-content { background: rgba(30, 31, 37, 0.9); }
body.theme-dark .stat-item, body .stat-item { background: #44475a; }

body.theme-blue .room-card { background: #2e2f3680; }
body.theme-blue .player-group { background: #2e2f36bf; }
body.theme-blue .modal-content { background: rgba(0,0,0,0.6); }
body.theme-blue .stat-item { background: #3a3d4d; }

hr { color: white; } p { margin-top: 0.5rem; margin-bottom: 0.25rem; } a { color: #00aeff; } a:hover { text-decoration: underline; }
h1 { margin: 10px 0 0.5rem 0; font-size: 1.5em; text-decoration: none; } h2 { margin-bottom: 1rem; } button { cursor: pointer; } 
body.no-scroll { overflow: hidden; }

/* Sticky header */
header { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 0.6rem 1rem;
    padding-top: calc(0.6rem + env(safe-area-inset-top)); 
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    position: sticky; top: 0; z-index: 10; flex-wrap: wrap; gap: 5px; 
}
header h1 { font-size: 1.8em; display: flex; align-items: center; margin: 0; flex-grow: 1; flex-shrink: 1; justify-content: left; text-align: left; min-width: 0; order: 1; margin-right: auto; }
.header-logo { height: 1.6em; width: 1.6em; margin-right: 0.5rem; }
.header-buttons { display: flex; align-items: center; gap: 0.5rem; order: 2; margin-left: 0; flex-shrink: 0; }
#user-profile-btn, #settings-btn { font-size: 1.6em; background: none; border: none; color: white; cursor: pointer; transition: transform 0.2s; padding: 0.3em; line-height: 1; display: flex; align-items: center; justify-content: center; }
#user-profile-btn:hover, #settings-btn:hover { transform: rotate(15deg); }

#header-stats { flex-basis: 100%; text-align: center; font-size: 1.1em; font-weight: 300; color: #FFF; opacity: 1; height: auto; margin-top: 0; padding-bottom: 5px; order: 3; }
#header-stats.hidden { display: none; }

/* Main layout */
main { flex: 1; padding: 1rem; max-width: 600px; margin: 0 auto; width: 100%; }
#rooms-container { display: flex; flex-direction: column; gap: 1rem; }
#loading, #not-found-container { text-align: center; font-weight: bold; font-size: 1.4rem; padding: 1rem; color: #fff; }

/* Indicator styling */
#filter-indicator { padding: 10px; text-align: center; background: #00aeff40; margin: 0 auto 1rem auto; border-radius: 8px; max-width: 90%; color: #fff; }
#filter-indicator button { margin-left: 10px; padding: 5px 12px; background: #555; border: none; color: white; border-radius: 4px; cursor: pointer; font-size: 0.9em; }

/* Modal styling */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; z-index: 20; opacity: 1; visibility: visible; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal.hidden { opacity: 0; visibility: hidden; }
.modal-content { padding: 1.5rem; border-radius: 1rem; box-shadow: 0 0 20px rgba(0,0,0,0.4); width: 90%; max-width: 450px; max-height: 80vh; overflow-y: auto; position: relative; }
.modal-close-btn { margin-top: 1.5rem; padding: 0.6rem 1.2rem; border: none; border-radius: 0.4rem; background: #00aeff; color: white; cursor: pointer; font-weight: bold; display: block; width: fit-content; margin-left: auto; margin-right: auto; }

.modal-close-btn.top-right { 
    position: absolute; top: 10px; right: 10px; 
    background: #555; border: none; color: white; 
    width: 28px; height: 28px; border-radius: 50%; 
    font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    line-height: 1; padding: 0; margin: 0;
}

/* Settings elements */
.setting-row { margin-bottom: 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.setting-row input, .setting-row select { padding: 0.4rem; background: #2e2f36bf; border: 1px solid #555; color: white; border-radius: 0.3rem; flex-grow: 1; }

/* View mode buttons */
.view-mode-btn { 
    background: #333; border: 1px solid #555; color: white; 
    padding: 6px 12px; border-radius: 8px; cursor: pointer;
    font-size: 1.2em; transition: 0.2s;
}
.view-mode-btn.active { background: #00aeff; border-color: #00d4ff; }

/* Toggle switches */
.switch { position: relative; display: inline-block; width: 50px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #00aeff; }
input:checked + .slider:before { transform: translateX(26px); }

#favorites-btn { background: rgba(0, 174, 255, 0.15); color: #00aeff; border: 2px solid rgba(0, 174, 255, 0.5); width: 100%; padding: 10px; font-weight: bold; border-radius: 12px; }
#favorites-list-container { max-height: 50vh; overflow-y: auto; border: 1px solid #555; border-radius: 5px; padding: 5px; }

/* Profile display */
.player-info-modal-header { display: flex; align-items: center; gap: 15px; margin-bottom: 1rem; text-align: left; }
.player-mii-large { width: 60px; height: 60px; border-radius: 5px; background: #555; object-fit: cover; }
.player-info-modal-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 0.8rem; }
.stat-item { padding: 8px 5px; border-radius: 4px; display: flex; flex-direction: column; align-items: center; }
.stat-label { font-size: 0.8em; color: #aaa; }
.stat-value { font-size: 1em; font-weight: 500; }

/* Room card visuals */
.room-card { padding: 1rem; border-radius: 0.6rem; box-shadow: 0 4px 10px #00000080; text-align: left; }
.room-name { font-weight: bold; font-size: 1.2rem; }
.room-details { font-size: 0.9rem; color: #aaa; margin-top: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid #444; text-align: center; }
.room-card-footer { margin-top: 1rem; padding-top: 0.5rem; border-top: 1px solid #444; font-size: 0.8em; color: #fff; text-align: center; }

/* Player row styling */
.player-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
.player-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.4rem 0.5rem; position: relative; cursor: pointer; }
.player-mii { width: 40px; height: 40px; border-radius: 50%; background: #444; object-fit: cover; }
.player-info { flex: 1; overflow: hidden; }
.player-name { font-size: 1.1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-fc { font-size: 0.8em; color: #aaa; }
.player-vrbr { font-size: 1em; color: #ddd; width: 70px; text-align: right; }
.openhost { text-decoration: underline; text-decoration-color: #00aeff; text-decoration-style: wavy; }

/* Unified status animation for searching/hosting/joining */
.searching-status { color: #f0c040; font-style: italic; font-weight: bold; animation: blink 1.5s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Desktop adjustments */
body.desktop-view #rooms-container { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 20px; }
body.desktop-view .room-card { width: 420px; }

/* rgb text animation */
.excited { font-weight: bold; animation: excited 1s infinite; }
@keyframes excited { 0%,100%{color:#cba6f7} 17%{color:#f38ba8} 33%{color:#fab387} 50%{color:#f9e2af} 67%{color:#a6e3a1} 83%{color:#89b4fa} }

/* Footer styling */
.footer-links { text-align: center; padding: 1.5rem 1rem; font-size: 0.9em; }
.footer-button { display: inline-flex; align-items: center; padding: 0.5rem 1rem; background: rgba(0,0,0,0.2); border-radius: 0.4rem; text-decoration: none; color: #fff; }