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

:root {
    --color-tone-1: #d7dadc;
    --color-tone-2: #818384;
    --color-tone-3: #565758;
    --color-tone-4: #3a3a3c;
    --color-tone-5: #272729;
    --color-tone-6: #1a1a1b;
    --color-tone-7: #121213;
    --color-correct: #538d4e;
    --color-present: #b59f3b;
    --color-absent: #3a3a3c;
    --key-bg: #818384;
    --key-text-color: #d7dadc;
}

html, body {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
    touch-action: none;
}

body {
    font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-tone-7);
    color: var(--color-tone-1);
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    max-height: 100%;
    max-width: 500px;
    padding: 10px 15px;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.screen.active {
    display: flex;
}

header {
    width: 100%;
    text-align: center;
    padding: 5px 0 8px;
    border-bottom: 1px solid var(--color-tone-4);
    margin-bottom: 8px;
    position: relative;
    flex-shrink: 0;
}

.game-title {
    font-size: clamp(24px, 6vw, 36px);
    font-weight: 700;
    letter-spacing: 0.2rem;
    text-transform: uppercase;
}

.subtitle {
    color: var(--color-tone-2);
    font-size: clamp(11px, 3vw, 14px);
    margin-top: 3px;
}

.back-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-tone-1);
    font-size: 24px;
    cursor: pointer;
}

/* Game Description */
.game-description {
    text-align: left;
    padding: 10px 12px;
    background-color: var(--color-tone-6);
    border-radius: 8px;
    margin-bottom: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    font-size: clamp(11px, 2.8vw, 13px);
}

.game-description h2 {
    font-size: clamp(14px, 4vw, 18px);
    margin-bottom: 10px;
    text-align: center;
}

.game-description p {
    margin-bottom: 8px;
    line-height: 1.4;
}

.game-description ul {
    margin-left: 18px;
    margin-bottom: 12px;
}

.game-description li {
    margin-bottom: 6px;
    line-height: 1.3;
}

.examples {
    margin-top: 12px;
}

.example-row {
    display: flex;
    gap: 4px;
    margin: 8px 0;
}

.example-row .tile {
    width: clamp(30px, 8vw, 40px);
    height: clamp(30px, 8vw, 40px);
    border: 2px solid var(--color-tone-4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 4vw, 20px);
    font-weight: bold;
    text-transform: uppercase;
}

.example-desc {
    font-size: clamp(11px, 3vw, 14px);
    color: var(--color-tone-2);
    margin-bottom: 10px;
}

.multiplayer-rules {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-tone-4);
}

.multiplayer-rules h3 {
    margin-bottom: 8px;
    color: var(--color-correct);
    font-size: clamp(13px, 3.5vw, 16px);
}

/* Buttons */
.home-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    flex-shrink: 0;
    padding-bottom: 10px;
}

.btn {
    padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 24px);
    font-size: clamp(13px, 3.5vw, 16px);
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
}

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

.btn.primary:hover {
    background-color: #6aaa63;
}

.btn.secondary {
    background-color: var(--color-tone-4);
    color: var(--color-tone-1);
}

.btn.secondary:hover {
    background-color: var(--color-tone-3);
}

/* Forms */
.create-room-form {
    width: 100%;
    max-width: 320px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--color-tone-2);
    font-size: clamp(12px, 3.5vw, 14px);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    font-size: clamp(14px, 4vw, 16px);
    background-color: var(--color-tone-6);
    border: 2px solid var(--color-tone-4);
    border-radius: 4px;
    color: var(--color-tone-1);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-tone-2);
}

.form-group input::placeholder {
    color: var(--color-tone-3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--color-tone-6);
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 360px;
    position: relative;
}

/* Global Name Popup */
.name-popup-content {
    text-align: center;
}

.name-popup-content h2 {
    margin-bottom: 10px;
    color: var(--color-correct);
}

.name-popup-content p {
    color: var(--color-tone-2);
    margin-bottom: 20px;
}

.name-popup-content .form-group {
    margin-bottom: 15px;
}

.name-popup-content input {
    text-align: center;
    font-size: 18px;
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 18px;
    font-size: clamp(18px, 5vw, 22px);
}

.close-modal {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: var(--color-tone-2);
    font-size: 28px;
    cursor: pointer;
}

.close-modal:hover {
    color: var(--color-tone-1);
}

.error-message {
    color: #f44336;
    font-size: clamp(12px, 3.5vw, 14px);
    text-align: center;
    margin-bottom: 12px;
    min-height: 18px;
}

/* Lobby */
.room-info {
    text-align: center;
    margin-bottom: 20px;
}

.room-code {
    font-size: clamp(24px, 7vw, 32px);
    font-weight: bold;
    color: var(--color-correct);
    letter-spacing: 0.3rem;
}

#round-settings {
    color: var(--color-tone-2);
    font-size: clamp(12px, 3.5vw, 14px);
}

.players-list {
    width: 100%;
    max-width: 280px;
    margin-bottom: 20px;
}

.players-list h3 {
    text-align: center;
    margin-bottom: 12px;
    font-size: clamp(14px, 4vw, 16px);
}

.players-list ul {
    list-style: none;
}

.players-list li {
    padding: 10px 16px;
    background-color: var(--color-tone-6);
    border-radius: 4px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(13px, 3.5vw, 15px);
}

.players-list li.host::after {
    content: '👑';
    margin-left: 8px;
}

#waiting-message {
    color: var(--color-tone-2);
    font-style: italic;
    font-size: clamp(12px, 3.5vw, 14px);
}

/* Game Screen Layout */
#game-screen {
    max-width: none;
    padding: 0;
    position: relative;
}

.game-layout {
    display: flex;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.sidebar-left {
    position: absolute;
    left: 0;
    top: 0;
    width: 130px;
    height: 100%;
    background-color: var(--color-tone-6);
    border-right: 1px solid var(--color-tone-4);
    padding: 10px;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.game-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 8px;
    width: 100%;
    max-width: 500px;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 400px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--color-tone-4);
    margin-bottom: 3px;
    flex-shrink: 0;
    gap: 15px;
}

.game-header .game-title {
    font-size: clamp(16px, 4vw, 24px);
}

.header-spacer {
    width: 60px;
}

.round-info {
    font-size: clamp(10px, 2.5vw, 13px);
    color: var(--color-tone-2);
    white-space: nowrap;
    min-width: 60px;
}

/* Timer Display */
.timer-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: clamp(12px, 3vw, 16px);
    font-weight: bold;
    color: var(--color-tone-1);
    background-color: var(--color-tone-5);
    padding: 4px 10px;
    border-radius: 6px;
    min-width: 65px;
    justify-content: center;
}

.timer-icon {
    font-size: clamp(10px, 2.5vw, 14px);
}

.timer-display.timer-warning {
    color: var(--color-present);
    animation: pulse 1s ease-in-out infinite;
}

.timer-display.timer-critical {
    color: #ff4444;
    animation: pulse 0.5s ease-in-out infinite;
    background-color: rgba(255, 68, 68, 0.2);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Scoreboard - Always visible on left */
.scoreboard {
    background-color: var(--color-tone-7);
    border: 1px solid var(--color-tone-4);
    border-radius: 8px;
    padding: 12px;
}

.scoreboard h3 {
    text-align: center;
    margin-bottom: 10px;
    font-size: clamp(12px, 3vw, 14px);
    color: var(--color-tone-2);
}

.scoreboard ul {
    list-style: none;
}

.scoreboard li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: clamp(11px, 2.8vw, 13px);
    border-bottom: 1px solid var(--color-tone-4);
}

.scoreboard li:last-child {
    border-bottom: none;
}

.scoreboard li .player-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px;
}

.scoreboard li .player-score {
    font-weight: bold;
    color: var(--color-correct);
}

.game-message {
    text-align: center;
    padding: 4px 8px;
    min-height: 24px;
    font-size: clamp(11px, 3vw, 14px);
    font-weight: 600;
    flex-shrink: 0;
}

.game-message.success {
    color: var(--color-correct);
}

.game-message.error {
    color: #f44336;
}

.game-message.info {
    color: var(--color-present);
}

.game-message.waiting {
    color: var(--color-tone-2);
}

/* Game Board */
#board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

#game-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    grid-gap: clamp(3px, 1vw, 5px);
    padding: 5px;
    box-sizing: border-box;
    max-height: 100%;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: clamp(3px, 1vw, 5px);
}

.tile {
    width: clamp(38px, min(11vw, 8vh), 58px);
    height: clamp(38px, min(11vw, 8vh), 58px);
    border: 2px solid var(--color-tone-4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(18px, min(5vw, 4vh), 28px);
    font-weight: bold;
    text-transform: uppercase;
    transition: transform 0.1s;
}

.tile.filled {
    border-color: var(--color-tone-3);
    animation: pop 0.1s;
}

.tile.correct {
    background-color: var(--color-correct);
    border-color: var(--color-correct);
}

.tile.present {
    background-color: var(--color-present);
    border-color: var(--color-present);
}

.tile.absent {
    background-color: var(--color-absent);
    border-color: var(--color-absent);
}

.tile.reveal {
    animation: flip 0.5s ease forwards;
}

@keyframes pop {
    50% {
        transform: scale(1.1);
    }
}

@keyframes flip {
    0% {
        transform: rotateX(0);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.row.shake {
    animation: shake 0.5s;
}

/* Keyboard */
#keyboard {
    padding: 3px;
    user-select: none;
    flex-shrink: 0;
    width: 100%;
    max-width: 500px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    margin-bottom: clamp(3px, 0.8vw, 6px);
}

.key {
    height: clamp(35px, min(8vw, 6vh), 50px);
    min-width: clamp(22px, 6.5vw, 40px);
    padding: 0 clamp(3px, 1vw, 10px);
    margin: 0 clamp(1.5px, 0.4vw, 3px);
    background-color: var(--key-bg);
    color: var(--key-text-color);
    border: none;
    border-radius: 4px;
    font-size: clamp(9px, 2.5vw, 13px);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    transition: background-color 0.2s;
}

.key:hover {
    background-color: #a0a1a2;
}

.key.large {
    min-width: clamp(40px, 11vw, 60px);
    font-size: clamp(8px, 2.2vw, 11px);
}

.key.correct {
    background-color: var(--color-correct);
}

.key.present {
    background-color: var(--color-present);
}

.key.absent {
    background-color: var(--color-tone-4);
}

/* Round Winner Animation Overlay */
.round-winner-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.round-winner-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.round-winner-content {
    text-align: center;
    animation: scaleIn 0.5s ease;
}

.trophy {
    font-size: clamp(60px, 20vw, 100px);
    animation: bounce 0.6s ease infinite alternate;
}

.round-winner-content h2 {
    font-size: clamp(24px, 7vw, 36px);
    color: var(--color-correct);
    margin: 15px 0 10px;
}

.round-winner-content p {
    font-size: clamp(14px, 4vw, 18px);
    color: var(--color-tone-2);
}

.round-winner-content.tie .trophy {
    filter: grayscale(0.5);
}

.round-winner-content.tie h2 {
    color: var(--color-tone-2);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-15px); }
}

/* Game Over */
#gameover-screen {
    justify-content: center;
}

.final-results {
    text-align: center;
    margin-bottom: 25px;
}

#winner-announcement {
    font-size: clamp(20px, 6vw, 28px);
    margin-bottom: 25px;
    color: var(--color-correct);
}

.final-scores {
    background-color: var(--color-tone-6);
    padding: 18px;
    border-radius: 8px;
    min-width: 250px;
}

.final-scores h3 {
    margin-bottom: 12px;
    font-size: clamp(14px, 4vw, 16px);
}

.final-scores ul {
    list-style: none;
}

.final-scores li {
    display: flex;
    justify-content: space-between;
    padding: 10px 18px;
    border-bottom: 1px solid var(--color-tone-4);
    font-size: clamp(13px, 3.5vw, 15px);
}

.final-scores li:last-child {
    border-bottom: none;
}

.final-scores li:first-child {
    font-weight: bold;
    color: var(--color-correct);
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
}

.gameover-buttons .btn {
    min-width: 200px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .sidebar-left {
        width: 100px;
        min-width: 100px;
        padding: 8px;
    }

    .scoreboard {
        padding: 8px;
    }

    .scoreboard li .player-name {
        max-width: 55px;
    }

    .game-main {
        padding: 5px 8px;
    }
}

/* Very small screens and mobile landscape */
@media (max-height: 600px) {
    .tile {
        width: clamp(32px, 8vh, 44px);
        height: clamp(32px, 8vh, 44px);
        font-size: clamp(16px, 4vh, 22px);
    }

    .key {
        height: clamp(32px, 6vh, 42px);
    }

    .game-message {
        min-height: 20px;
        padding: 2px 6px;
    }

    .game-header {
        padding-bottom: 3px;
        margin-bottom: 2px;
    }

    .game-header .game-title {
        font-size: 18px;
    }

    #keyboard {
        padding: 2px;
    }

    .keyboard-row {
        margin-bottom: 2px;
    }
}

/* Hide sidebar on very small screens */
@media (max-width: 480px) {
    .sidebar-left {
        display: none;
    }

    .game-main {
        padding: 5px 10px;
    }
}

/* Chromebook specific (typically 768x1366 or similar) */
@media (min-width: 768px) and (max-height: 800px) {
    .tile {
        width: clamp(40px, 7vh, 52px);
        height: clamp(40px, 7vh, 52px);
        font-size: clamp(20px, 3.5vh, 26px);
    }

    .key {
        height: clamp(36px, 5.5vh, 46px);
    }

    .sidebar-left {
        width: 120px;
    }

    .game-header .game-title {
        font-size: 22px;
    }
}

/* Chromebook and tablet landscape */
@media (min-width: 1000px) and (max-height: 700px) {
    .tile {
        width: clamp(38px, 6.5vh, 48px);
        height: clamp(38px, 6.5vh, 48px);
        font-size: clamp(18px, 3vh, 24px);
    }

    .key {
        height: clamp(34px, 5vh, 44px);
    }
}

/* ========== Friends System Styles ========== */

/* Friends Button (top right corner) */
.friends-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--color-tone-5);
    border: 2px solid var(--color-tone-4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.2s;
}

.friends-btn:hover {
    background-color: var(--color-tone-4);
    transform: scale(1.05);
}

/* Settings Button (next to friends button) */
.settings-btn {
    position: fixed;
    top: 10px;
    right: 62px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--color-tone-5);
    border: 2px solid var(--color-tone-4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.2s;
}

.settings-btn:hover {
    background-color: var(--color-tone-4);
    transform: scale(1.05);
}

.settings-icon {
    font-size: 20px;
}

/* Settings Modal */
.settings-modal-content {
    max-width: 360px;
    width: 90%;
}

.settings-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-tone-4);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.settings-section h3 {
    font-size: 14px;
    color: var(--color-tone-2);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.settings-info {
    font-size: 14px;
    color: var(--color-tone-1);
    margin-bottom: 8px;
}

.settings-info strong {
    color: var(--color-correct);
}

.friends-icon-img {
    width: 24px;
    height: 24px;
    filter: invert(1);
}

.friends-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

/* Friends Modal */
.friends-modal-content {
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Name Setup Section */
.name-setup {
    text-align: center;
    padding: 20px 0;
}

.name-setup p {
    color: var(--color-tone-2);
    margin-bottom: 20px;
}

.name-setup .form-group {
    margin-bottom: 15px;
}

.profile-name-display {
    font-size: 12px;
    color: var(--color-tone-2);
    margin-top: 8px;
}

.profile-name-display span {
    color: var(--color-tone-1);
    font-weight: 600;
}

.friends-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--color-tone-4);
    padding-bottom: 10px;
}

.tab-btn {
    flex: 1;
    padding: 8px 10px;
    background: none;
    border: none;
    color: var(--color-tone-2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s;
    position: relative;
}

.tab-btn:hover {
    background-color: var(--color-tone-5);
    color: var(--color-tone-1);
}

.tab-btn.active {
    background-color: var(--color-tone-4);
    color: var(--color-tone-1);
}

.tab-badge {
    background-color: #e74c3c;
    color: white;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 10px;
    margin-left: 3px;
}

.tab-badge:empty {
    display: none;
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

/* Friend Code Display */
.friend-code-display {
    background-color: var(--color-tone-5);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.friend-code-display p {
    font-size: 12px;
    color: var(--color-tone-2);
    margin-bottom: 5px;
}

.code-display-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#my-friend-code {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 3px;
    color: var(--color-correct);
}

.refresh-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.7;
}

.refresh-btn:hover {
    background-color: var(--color-tone-4);
    opacity: 1;
    transform: rotate(180deg);
}



/* Friends List */
.friends-list-container,
.requests-list-container {
    max-height: 250px;
    overflow-y: auto;
}

.friends-list-container ul,
.requests-list-container ul {
    list-style: none;
}

.friend-item,
.request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: var(--color-tone-5);
    border-radius: 6px;
    margin-bottom: 8px;
}

.friend-info,
.request-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--color-tone-3);
}

.online-status.online {
    background-color: var(--color-correct);
    box-shadow: 0 0 6px var(--color-correct);
}

.online-status.away {
    background-color: var(--color-present);
    box-shadow: 0 0 6px var(--color-present);
}

.friend-name {
    font-weight: 600;
}

.friend-status {
    font-size: 11px;
    color: var(--color-tone-2);
}

.friend-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.invite-btn {
    padding: 5px 10px;
    font-size: 14px;
    font-weight: bold;
    background-color: var(--color-correct);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 28px;
}

.invite-btn:hover {
    background-color: #45a049;
}

.invite-btn:disabled {
    background-color: var(--color-tone-4);
    cursor: not-allowed;
}

.message-btn {
    padding: 5px 8px;
    font-size: 14px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.message-btn:hover {
    background-color: #2980b9;
}

/* Chat Modal */
.chat-modal-content {
    width: 350px;
    max-width: 95%;
    height: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.chat-modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-tone-4);
}

.chat-modal-content .modal-header h2 {
    margin: 0;
    text-align: left;
}

.chat-modal-content .close-btn {
    background: none;
    border: none;
    color: var(--color-tone-2);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.chat-modal-content .close-btn:hover {
    color: var(--color-tone-1);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: var(--color-tone-7);
    border-radius: 8px;
    margin-bottom: 10px;
}

.chat-message {
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
}

.chat-message.sent {
    background-color: var(--color-correct);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.received {
    background-color: var(--color-tone-4);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message .message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

.chat-input-container {
    display: flex;
    gap: 8px;
}

.chat-input-container input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--color-tone-4);
    border-radius: 20px;
    background-color: var(--color-tone-7);
    color: var(--color-tone-1);
    font-size: 14px;
    outline: none;
}

.chat-input-container input:focus {
    border-color: var(--color-correct);
}

#send-message-btn {
    padding: 10px 15px;
    background-color: var(--color-correct);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

#send-message-btn:hover {
    background-color: #45a049;
}

.chat-empty {
    text-align: center;
    color: var(--color-tone-2);
    padding: 40px 20px;
    font-size: 14px;
}

.remove-btn {
    padding: 4px 8px;
    font-size: 12px;
    background-color: transparent;
    color: var(--color-tone-2);
    border: 1px solid var(--color-tone-4);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-btn:hover {
    background-color: #c0392b;
    color: white;
    border-color: #c0392b;
}

.empty-message {
    text-align: center;
    color: var(--color-tone-2);
    padding: 20px;
    font-size: 14px;
}

/* Request Actions */
.request-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-small.accept {
    background-color: var(--color-correct);
    color: white;
}

.btn-small.accept:hover {
    background-color: #45a049;
}

.btn-small.decline {
    background-color: var(--color-tone-4);
    color: var(--color-tone-1);
}

.btn-small.decline:hover {
    background-color: #c0392b;
}

/* Success Message */
.success-message {
    color: var(--color-correct);
    font-size: 13px;
    margin-bottom: 10px;
    text-align: center;
}

/* Friend Request Notification */
.friend-notification,
.invite-notification {
    position: fixed;
    top: 10px;
    left: 10px;
    background-color: var(--color-tone-5);
    border: 2px solid var(--color-tone-4);
    border-radius: 8px;
    padding: 12px 15px;
    z-index: 1001;
    max-width: 320px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateX(-120%);
    transition: transform 0.3s ease;
}

.friend-notification.show,
.invite-notification.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-icon {
    font-size: 24px;
}

.notification-text {
    flex: 1;
}

.notification-text p {
    font-size: 13px;
    margin: 0;
}

.notification-actions {
    display: flex;
    gap: 5px;
}

.notification-close {
    position: absolute;
    top: 5px;
    right: 8px;
    background: none;
    border: none;
    color: var(--color-tone-2);
    font-size: 18px;
    cursor: pointer;
}

.notification-close:hover {
    color: var(--color-tone-1);
}

/* Invite notification position (below friend notification) */
.invite-notification {
    top: 70px;
}

/* Mobile adjustments for friends */
@media (max-width: 480px) {
    .friends-btn {
        width: 40px;
        height: 40px;
    }

    .friends-icon {
        font-size: 18px;
    }

    .friends-modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .friend-notification,
    .invite-notification {
        max-width: 280px;
        padding: 10px 12px;
    }

    .tab-btn {
        font-size: 11px;
        padding: 6px 5px;
    }
}

/* Chat Notification Toast */
.chat-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--color-tone-5);
    border: 2px solid #3498db;
    border-radius: 10px;
    padding: 12px 16px;
    z-index: 1002;
    max-width: 320px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-notification.show {
    transform: translateX(0);
}

.chat-notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
}

.chat-notification-content:hover {
    opacity: 0.8;
}

.chat-notification-icon {
    font-size: 20px;
}

.chat-notification-content span {
    color: var(--color-tone-1);
    font-size: 14px;
}

.chat-notification-content strong {
    color: #3498db;
}

.chat-notification-close {
    background: none;
    border: none;
    color: var(--color-tone-2);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.chat-notification-close:hover {
    color: var(--color-tone-1);
}
