/* Liquid Glass Design System */
:root {
    --bg-base: #f2f2f7;
    --glass-bg: rgba(255, 255, 255, 0.78);
    --glass-bg-solid: #ffffff;
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --blur: 20px;
    --text-primary: #1c1c1e;
    --text-secondary: #48484a;
    --accent: #007aff;
    --accent-light: rgba(0, 122, 255, 0.12);
    --success: #34c759;
    --danger: #ff3b30;
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
}

.theme-dark {
    --bg-base: #000000;
    --glass-bg: rgba(44, 44, 46, 0.78);
    --glass-bg-solid: #2c2c2e;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #aeaeb2;
    --accent: #0a84ff;
    --accent-light: rgba(10, 132, 255, 0.24);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Fallback for devices without backdrop-filter support */
@supports not (backdrop-filter: blur(1px)) {
    .user-card,
    .card,
    .side-panel,
    .action-card,
    #start-screen .container,
    .share-modal,
    .qr-modal,
    .lang-menu,
    .floating-btn,
    .burger-menu {
        background: var(--glass-bg-solid) !important;
    }
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* Start Screen */
#start-screen {
    background: linear-gradient(180deg, #e8f0fe 0%, #f2f2f7 50%, #fef6f0 100%);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.theme-dark #start-screen {
    background: linear-gradient(180deg, #1a1a2e 0%, #000000 50%, #1a1a1a 100%);
}

#start-screen .container {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.logo .subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.action-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 24px;
}

.action-card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Input row - name + gender inline */
.input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.input-row input[type="text"] {
    flex: 1;
    min-width: 0;
}

.action-card input[type="text"] {
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.theme-dark .action-card input[type="text"] {
    background: rgba(255, 255, 255, 0.08);
}

.action-card input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.action-card input[type="text"]::placeholder {
    color: var(--text-secondary);
}

/* Link button for toggle create/join */
.btn-link {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    margin-top: 4px;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Gender Toggle - compact inline style */
.gender-toggle {
    display: flex;
    gap: 4px;
}

.gender-btn {
    width: 48px;
    height: 48px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
}

.gender-btn-label {
    pointer-events: none;
}

.gender-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.gender-btn.active {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

/* Buttons */
.btn {
    height: 48px;
    padding: 0 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

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

/* Language Toggle */
.lang-toggle {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 32px;
}

.lang-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 8px 18px rgba(0, 122, 255, 0.22);
}

.lang-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.lang-btn.active:hover {
    background: var(--accent);
    color: #ffffff;
}

.error-message {
    display: none;
    padding: 14px 16px;
    background: rgba(255, 59, 48, 0.12);
    color: #ff3b30;
    border-radius: var(--radius-sm);
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
}

/* Room Screen */
#room-screen {
    background: var(--bg-base);
    position: relative;
}

#room-screen.screen.active {
    display: block;
}

/* Floating Buttons - Desktop only (top corners, vertical) */
.floating-buttons {
    position: fixed;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    padding: 16px;
}

.floating-top-left {
    left: 0;
    top: 0;
}

.floating-top-right {
    right: 0;
    top: 0;
}

.floating-btn {
    width: 44px;
    height: 44px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    box-shadow: var(--glass-shadow);
}

.floating-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.floating-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.floating-btn-danger:hover {
    background: rgba(255, 59, 48, 0.12);
    color: var(--danger);
    border-color: var(--danger);
}

/* Spectator button active state */
.floating-btn.spectator-active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Theme toggle icons */
.theme-light .icon-sun { display: block; }
.theme-light .icon-moon { display: none; }
.theme-dark .icon-sun { display: none; }
.theme-dark .icon-moon { display: block; }

/* Floating button tooltips - positioned to stay on screen */
.floating-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    background: var(--text-primary);
    color: var(--bg-base);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* Left buttons: tooltip appears to the right */
.floating-top-left .floating-btn::before {
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

/* Right buttons: tooltip appears to the left */
.floating-top-right .floating-btn::before {
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    left: auto;
}

.floating-btn:hover::before {
    opacity: 1;
}

.lang-toggle-wrapper {
    position: relative;
}

/* Language menu - appears to the left of the button */
.lang-menu {
    position: absolute;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    min-width: 80px;
    right: calc(100% + 8px);
    top: 0;
    transform: none;
}

.lang-option {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    transition: background 0.15s;
}

.lang-option.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 700;
}

.lang-option:hover {
    background: var(--accent-light);
}

/* Burger Menu - Mobile only */
.burger-btn {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    z-index: 200;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glass-shadow);
}

.burger-btn svg {
    stroke: currentColor;
}

.burger-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border-left: 1px solid var(--glass-border);
    z-index: 1001;
    transition: right 0.3s ease;
    padding-top: env(safe-area-inset-top);
}

.burger-menu.active {
    right: 0;
}

.burger-menu-content {
    padding: 80px 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.burger-menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.burger-menu-item svg {
    flex-shrink: 0;
    stroke: currentColor;
}

.burger-menu-item:hover {
    background: var(--accent-light);
}

.burger-menu-danger {
    color: var(--danger);
}

.burger-menu-item.spectator-active {
    background: var(--accent-light);
    color: var(--accent);
}

.burger-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.burger-overlay.active {
    display: block;
}

/* Main Content */
.room-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 80px 20px;
}

/* Active task name (top center) */
.active-task-floating {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 50;
    max-width: 60%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Central Reveal Section (top) */
.reveal-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding-top: 56px;
    padding-bottom: 20px;
    width: 100%;
    flex-shrink: 0;
}

/* Buttons wrapper - fixed height, buttons stack on same position */
.reveal-buttons {
    height: 56px;
    display: grid;
    place-items: center;
}

.reveal-buttons .btn {
    grid-area: 1 / 1;
    height: 56px;
    padding: 0 48px;
    font-size: 18px;
    font-weight: 600;
    transition: opacity 0.2s, filter 0.2s, box-shadow 0.2s;
}

.btn-reveal {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.3);
}

.btn-reveal:hover:not(:disabled):not(.hidden) {
    filter: brightness(1.1);
    box-shadow: 0 6px 24px rgba(0, 122, 255, 0.4);
}

.btn-reveal:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-reveal.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.btn-reset {
    border-radius: var(--radius-md);
}

.btn-reset.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Wrapper with fixed height to reserve space */
.room-average-wrapper {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-average {
    font-size: 48px;
    font-weight: 700;
    color: var(--success);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, visibility 0.2s;
    line-height: 1;
}

/* Hidden state for average - keep space reserved */
.room-average.hidden {
    visibility: hidden;
    opacity: 0;
}

/* Room Content */
.room-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 1000px;
}

/* Users Grid */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(126px, 168px));
    gap: clamp(12px, 2vw, 20px);
    width: 100%;
    justify-content: center;
    justify-items: center;
}

/* User Card - full-bleed avatar with bottom title overlay */
.user-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0;
    width: 100%;
    min-width: 0;
    aspect-ratio: 2 / 3;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    transition: border-color 0.2s, box-shadow 0.2s; /* Only animate borders, not layout */
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.user-card:hover {
    box-shadow: var(--glass-shadow);
}

.user-card.spectator {
    opacity: 0.6;
}

.user-card.has-voted {
    border-color: var(--success);
    box-shadow: 0 0 0 1px var(--success);
}

.user-card.revealed {
    border-color: var(--accent);
}

.user-card::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 44%;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(10, 14, 24, 0.2) 35%, rgba(10, 14, 24, 0.78) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.user-card::after,
.user-card.status-voted::after,
.user-card.status-vote::after {
    opacity: 1;
}

.user-card.status-avatar.gender-girl::after {
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255, 245, 250, 0.14) 28%, rgba(65, 24, 53, 0.82) 100%);
}

.user-card.status-avatar.gender-boy::after {
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(240, 248, 255, 0.12) 28%, rgba(12, 29, 54, 0.84) 100%);
}

.user-card.status-voted.gender-girl::after,
.user-card.status-vote.gender-girl::after {
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255, 240, 246, 0.16) 24%, rgba(58, 18, 46, 0.86) 100%);
}

.user-card.status-voted.gender-boy::after,
.user-card.status-vote.gender-boy::after {
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(237, 247, 255, 0.15) 24%, rgba(10, 24, 48, 0.88) 100%);
}

/* Spectator badge with tooltip */
.spectator-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--accent-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    cursor: help;
}

.spectator-badge svg {
    width: 12px;
    height: 12px;
}

/* Spectator tooltip */
.spectator-badge::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-base);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.spectator-badge:hover::before {
    opacity: 1;
}

.user-avatar {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.28), rgba(255,255,255,0) 42%),
        linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 38%),
        var(--bg-base);
    z-index: 0;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 24%;
    transform: scale(1.04);
    transform-origin: center center;
}

.user-card.gender-girl .user-avatar-img {
    object-position: center 22%;
    filter: saturate(1.05) brightness(1.03);
}

.user-card.gender-boy .user-avatar-img {
    object-position: center 23%;
    filter: saturate(1.02) contrast(1.03);
}

.user-name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 34px 12px 12px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.45);
    text-align: center;
    max-width: 100%;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.user-card.status-vote .user-name,
.user-card.status-voted .user-name {
    padding-top: 24px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.54));
}

/* iOS Safari requires cursor:pointer to fire click events on non-interactive elements */
.user-name.is-truncated {
    cursor: pointer;
}

/* JS-driven tooltip for truncated names — appended to body to avoid overflow:hidden clipping */
#name-tooltip {
    position: fixed;
    background: var(--text-primary);
    color: var(--bg-base);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.22);
    opacity: 0;
    transition: opacity 0.12s;
}
#name-tooltip.visible {
    opacity: 1;
}
#name-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
}

.user-status-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* User status - same size as avatar */
.user-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px 52px;
    font-size: clamp(30px, 3vw, 42px);
    font-weight: 700;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02)),
        rgba(6, 14, 26, 0.5);
    border-radius: inherit;
    text-shadow: 0 5px 20px rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(1.8px) saturate(0.9);
    -webkit-backdrop-filter: blur(1.8px) saturate(0.9);
}

/* Better contrast for dark theme */
.theme-dark .user-status {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
        rgba(4, 11, 21, 0.58);
}

.user-card.status-vote .user-status {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02)),
        rgba(14, 66, 132, 0.58);
}

.user-card.revealed.status-vote.gender-girl .user-status {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02)),
        rgba(142, 34, 86, 0.62);
}

.user-card.revealed.status-vote.gender-boy .user-status {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02)),
        rgba(24, 84, 168, 0.62);
}

.user-status.icon-voted {
    font-size: clamp(40px, 4.8vw, 54px);
    font-weight: 800;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02)),
        rgba(18, 120, 57, 0.62);
}

.icon-voted-mark {
    width: clamp(24px, 2.8vw, 34px);
    height: clamp(44px, 5vw, 58px);
    border-right: clamp(6px, 0.65vw, 8px) solid #ffffff;
    border-bottom: clamp(6px, 0.65vw, 8px) solid #ffffff;
    transform: rotate(45deg) translateY(-6%);
    border-radius: 2px;
    box-sizing: border-box;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.22));
}

@media (max-width: 640px) {
    .user-status {
        padding-bottom: 48px;
    }

    .user-status.icon-voted {
        font-size: clamp(44px, 12vw, 60px);
    }

    .icon-voted-mark {
        width: clamp(26px, 7vw, 36px);
        height: clamp(48px, 13vw, 62px);
        border-right-width: clamp(6px, 1.5vw, 8px);
        border-bottom-width: clamp(6px, 1.5vw, 8px);
        filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.16));
    }
}

/* Card label styling */
.card-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: relative;
    z-index: 1;
    text-shadow: 0 8px 18px rgba(0, 0, 0, 0.36);
}

.vote-status .card-value {
    font-size: clamp(38px, 4.2vw, 52px);
}

/* Card icon styling (for ?, ☕ and 🌈) */
.card-icon {
    font-size: inherit;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-weight: 400;
    line-height: 1;
}

.vote-status-special .card-value {
    font-size: clamp(42px, 4.8vw, 58px);
}

.vote-status-rainbow .card-icon,
.vote-status-coffee .card-icon {
    text-shadow: 0 8px 18px rgba(0, 0, 0, 0.36);
}

.vote-status-question .card-value {
    font-weight: 800;
}

@media (max-width: 640px) {
    .vote-status .card-value {
        font-size: clamp(42px, 11vw, 58px);
    }

    .vote-status-special .card-value {
        font-size: clamp(46px, 12vw, 64px);
    }
}

/* Voting Panel */
.voting-panel {
    width: 100%;
    margin-top: 20px;
    padding-bottom: 20px;
}

.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.card {
    min-width: 56px;
    height: 72px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.card:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow);
    border-color: var(--accent);
}

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

.card.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.3);
}

/* Side Panels */
.side-panel {
    position: fixed;
    top: 0;
    left: -400px;
    width: 380px;
    max-width: 100vw;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border-right: 1px solid var(--glass-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
}

.side-panel.active {
    left: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}

.panel-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.icon-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}

#add-task-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#add-task-form input {
    flex: 1;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.theme-dark #add-task-form input {
    background: rgba(255, 255, 255, 0.08);
}

#add-task-form input:focus {
    border-color: var(--accent);
}

#tasks-list {
    list-style: none;
}

#tasks-list li {
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    font-size: 14px;
    overflow: hidden;
    transition: all 0.15s;
}

.theme-dark #tasks-list li {
    background: rgba(255, 255, 255, 0.08);
}

#tasks-list li.active {
    background: var(--accent-light);
}

#tasks-list li.active .task-title {
    color: var(--accent);
    font-weight: 500;
}

.task-content {
    flex: 1;
    padding: 14px 16px;
    cursor: pointer;
    min-width: 0;
}

.task-content:hover {
    background: rgba(0, 0, 0, 0.03);
}

.theme-dark .task-content:hover {
    background: rgba(255, 255, 255, 0.05);
}

.task-title {
    display: block;
    word-break: break-word;
}

.task-actions {
    display: flex;
    gap: 4px;
    padding-right: 8px;
    flex-shrink: 0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.btn-icon svg {
    width: 14px;
    height: 14px;
}

.btn-icon:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-task-delete:hover {
    background: rgba(255, 59, 48, 0.12);
    color: var(--danger);
}

.setting-group {
    margin-bottom: 24px;
}

.setting-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.setting-group select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    cursor: pointer;
}

.theme-dark .setting-group select {
    background: rgba(255, 255, 255, 0.08);
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Share Modal / QR Modal */
.share-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1999;
}

.share-backdrop.active {
    display: block;
}

.share-modal,
.qr-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--glass-shadow);
    z-index: 2000;
    min-width: 320px;
    text-align: center;
}

.share-modal.active,
.qr-modal.active {
    display: block;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* QR Modal styles */
.qr-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.qr-image {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-sm);
    background: white;
    padding: 8px;
}

.qr-link {
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
    max-width: 280px;
    font-family: 'SF Mono', monospace;
}

.qr-close {
    margin-top: 8px;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: var(--bg-base);
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3000;
    pointer-events: none;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive - Tablet */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
    .room-main {
        padding: 12px 24px 16px;
    }

    .active-task-floating {
        position: static;
        transform: none;
        margin-bottom: 6px;
        max-width: 100%;
        padding: 6px 14px;
        font-size: 13px;
        border-radius: 16px;
    }

    .reveal-section {
        gap: 10px;
        padding-top: 8px;
        padding-bottom: 12px;
    }

    .room-average-wrapper {
        min-height: 40px;
    }

    .room-content {
        gap: 14px;
    }

    .users-grid {
        grid-template-columns: repeat(auto-fit, minmax(116px, 140px));
        gap: 14px;
    }
    
    .user-card {
        width: 100%;
        aspect-ratio: 2 / 2.72;
    }
    
    .user-status {
        padding: 18px 12px 44px;
    }

    .icon-voted-mark {
        filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.18));
    }

    .user-card::after {
        height: 50%;
    }
    
    .user-name {
        font-size: 12px;
        padding: 26px 8px 9px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    /* Hide desktop floating buttons */
    .floating-buttons {
        display: none;
    }
    
    /* Show burger menu button */
    .burger-btn {
        display: flex;
    }
    
    .burger-menu {
        display: block;
    }
    
    .room-main {
        padding: 12px 16px 16px;
    }
    
    .active-task-floating {
        position: static;
        transform: none;
        margin-bottom: 8px;
        max-width: 100%;
    }
    
    .reveal-section {
        gap: 10px;
        padding-top: 8px;
        padding-bottom: 12px;
    }
    
    .reveal-buttons {
        height: 48px;
    }
    
    .reveal-buttons .btn {
        height: 48px;
        padding: 0 32px;
        font-size: 16px;
    }
    
    .room-average-wrapper {
        min-height: 40px;
    }
    
    .room-average {
        font-size: 36px;
    }

    .room-content {
        gap: 14px;
    }
    
    .users-grid {
        grid-template-columns: repeat(auto-fit, minmax(104px, 128px));
        gap: 12px;
    }
    
    .user-card {
        width: 100%;
        aspect-ratio: 2 / 3;
    }
    
    .user-status {
        padding: 18px 12px 44px;
    }

    .user-card::after {
        height: 50%;
    }
    
    .user-name {
        font-size: 12px;
        padding: 26px 8px 9px;
    }
    
    .cards-container {
        gap: 8px;
        padding-bottom: 12px;
    }

    .voting-panel {
        margin-top: 12px;
        padding-bottom: 12px;
    }
    
    .card {
        min-width: 48px;
        height: 64px;
        font-size: 16px;
    }
    
    .side-panel {
        width: 100%;
        left: -100%;
    }
    
    #start-screen {
        padding: 20px;
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
    
    .toast {
        bottom: 24px;
        left: 16px;
        right: 16px;
        transform: translateY(100px);
        text-align: center;
    }
    
    .toast.active {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    #start-screen .container {
        padding: 28px 20px;
        margin: 0 12px;
    }
    
    .logo {
        margin-bottom: 32px;
    }
    
    .logo h1 {
        font-size: 24px;
    }
    
    .logo .subtitle {
        font-size: 14px;
    }
    
    .action-card {
        padding: 20px 16px;
    }
    
    .action-card h2 {
        font-size: 15px;
        margin-bottom: 14px;
    }
    
    .action-card input {
        height: 44px;
        font-size: 16px;
    }
    
    .gender-btn {
        width: 48px;
        height: 48px;
    }
    
    .btn {
        height: 44px;
        font-size: 15px;
    }
    
    .lang-toggle {
        margin-top: 24px;
    }
    
    .reveal-section {
        gap: 8px;
        padding-top: 4px;
        padding-bottom: 10px;
    }
    
    .reveal-buttons {
        height: 44px;
    }
    
    .reveal-buttons .btn {
        height: 44px;
        padding: 0 24px;
        font-size: 15px;
    }
    
    .room-average-wrapper {
        min-height: 36px;
    }
    
    .room-average {
        font-size: 30px;
    }

    .room-content {
        gap: 12px;
    }
    
    .users-grid {
        grid-template-columns: repeat(auto-fit, minmax(92px, 112px));
        gap: 10px;
    }
    
    .user-card {
        width: 100%;
        aspect-ratio: 2 / 3;
    }
    
    .user-status {
        padding: 16px 10px 40px;
    }
    
    .user-name {
        font-size: 11px;
        padding: 24px 8px 8px;
    }
    
    .card {
        min-width: 44px;
        height: 56px;
        font-size: 15px;
    }

    .voting-panel {
        margin-top: 8px;
        padding-bottom: 8px;
    }
    
    .qr-modal {
        padding: 24px;
        min-width: auto;
        width: calc(100% - 32px);
        max-width: 320px;
    }
    
    .qr-image {
        width: 160px;
        height: 160px;
    }
    
    .spectator-badge {
        width: 20px;
        height: 20px;
        top: 6px;
        right: 6px;
    }
    
    .spectator-badge svg {
        width: 10px;
        height: 10px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .users-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        justify-content: stretch;
        justify-items: stretch;
    }
    
    .user-card {
        width: 100%;
        min-width: 0;
        aspect-ratio: 2 / 3;
    }
    
    .user-status {
        padding: 14px 8px 36px;
    }

    .user-name {
        font-size: 10px;
        padding: 22px 6px 7px;
    }
    
    .card {
        min-width: 40px;
        height: 52px;
        font-size: 14px;
    }
}

/* Utility - hide old elements */
.badge, .badge-voted, .badge-not-voted, .badge-spectator,
.vote-value, .voting-actions, .room-actions, .toggle-role-btn-top,
.room-sidebar, .room-top-bar { display: none; }
