/* ============================================
   Bad Games - Centralized CSS
   ============================================ */

/* ===========================================
   1. CSS Variables & Reset
   =========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --bg-input: #0a0a1a;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #ef4444;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* ===========================================
   2. Layout
   =========================================== */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

#main {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#footer {
    padding: 16px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

.view {
    padding: 24px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===========================================
   3. Typography
   =========================================== */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 2rem; margin-bottom: 16px; }
h2 { font-size: 1.5rem; margin-bottom: 12px; }
h3 { font-size: 1.25rem; margin-bottom: 8px; }
h4 { font-size: 1rem; margin-bottom: 4px; }

p { margin-bottom: 12px; }

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

small {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===========================================
   4. Buttons
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    min-height: 44px;
}

.btn:hover {
    background: var(--bg-secondary);
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
    min-height: 36px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.copy-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* ===========================================
   5. Forms
   =========================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
}

input::placeholder {
    color: var(--text-muted);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.input-with-button {
    display: flex;
    gap: 10px;
}

.input-with-button input {
    flex: 1;
}

.input-with-button .btn {
    flex-shrink: 0;
}

.settings-form {
    max-width: 400px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.radio-label:has(input:checked) {
    border-color: var(--accent);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-label span {
    font-weight: 500;
}

.radio-label small {
    color: var(--text-secondary);
}

/* ===========================================
   6. Cards
   =========================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* ===========================================
   7. Flash Messages
   =========================================== */
.flash-messages {
    padding: 0 20px;
    margin-bottom: 16px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.flash {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    background: var(--bg-card);
    border-left: 4px solid var(--accent);
}

.flash-success { border-left-color: var(--success); }
.flash-error { border-left-color: var(--error); }
.flash-warning { border-left-color: var(--warning); }
.flash-info { border-left-color: var(--accent); }

/* ===========================================
   8. Toast Notifications
   =========================================== */
.toast {
    position: fixed;
    bottom: calc(20px + var(--safe-area-bottom));
    left: 20px;
    right: 20px;
    max-width: 400px;
    margin: 0 auto;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow);
    animation: slideUp 0.3s ease;
    z-index: 1000;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
}

/* ===========================================
   9. Modal
   =========================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 450px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn {
    flex: 1;
}

/* Confirm Modal */
.modal-confirm {
    text-align: center;
    max-width: 380px;
}

.modal-confirm h3 {
    margin-bottom: 8px;
}

.modal-confirm p {
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.5;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    line-height: 1;
}

/* ===========================================
   10. Home Page
   =========================================== */
.view-home {
    text-align: center;
}

.hero {
    padding: 60px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.games-showcase {
    padding: 48px 0;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.game-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    text-align: left;
}

.game-card-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.game-card h3 {
    margin-bottom: 8px;
}

.game-card p {
    color: var(--text-secondary);
}

.game-features {
    list-style: none;
    margin-top: 16px;
}

.game-features li {
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-secondary);
}

.game-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
}

.features {
    padding: 48px 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.feature-item {
    text-align: center;
    padding: 24px;
}

.feature-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.feature-item h4 {
    margin-bottom: 8px;
}

.feature-item p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===========================================
   11. Auth Pages
   =========================================== */
.view-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
}

/* ===========================================
   12. Profile Page
   =========================================== */
.view-profile {
    max-width: 800px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
}

.profile-avatar {
    width: 64px;
    height: 64px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.profile-info h1 {
    margin-bottom: 2px;
    font-size: 1.5rem;
}

.profile-email,
.profile-joined {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0;
}

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

.profile-section {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 20px;
}

.profile-section h2 {
    margin-bottom: 12px;
    font-size: 1.125rem;
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
}

.stat-card h4 {
    margin-bottom: 12px;
    text-transform: capitalize;
    font-size: 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value { }
.stat-win { color: var(--success); }
.stat-loss { color: var(--error); }
.stat-rating { color: var(--accent); font-weight: 600; }

/* Invites */
.generate-invite-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.invite-counter {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.invite-limit-reached {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.invites-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.invite-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
}

.invite-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.invite-code-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.invite-code {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--accent);
}

.status-available {
    color: var(--success);
    font-size: 0.875rem;
}

.status-used {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.status-used strong {
    color: var(--accent);
}

.invite-card.used {
    opacity: 0.7;
    background: var(--bg-secondary);
}

.invite-qr {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.qr-code canvas {
    border-radius: var(--border-radius);
}

.invite-link {
    width: 100%;
}

.invite-link input {
    text-align: center;
    font-size: 0.875rem;
}

/* Nickname Form - Compact */
.nickname-form {
    max-width: 400px;
}

.nickname-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.nickname-input-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nickname-input-row input {
    flex: 1;
    min-width: 0;
}

.nickname-input-row .btn {
    flex-shrink: 0;
}

/* Game History */
.games-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.history-info {
    display: flex;
    align-items: center;
}

.history-type {
    font-weight: 500;
    text-transform: capitalize;
}

.history-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-left: 12px;
}

.history-result {
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
}

.history-result.win {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

.history-result.loss {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.history-result.draw {
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning);
}

/* ===========================================
   13. Lobby Page
   =========================================== */
.view-lobby {
    max-width: 800px;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.lobby-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.game-type-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.game-type-btn {
    padding: 8px 16px;
    font-size: 0.875rem;
    background: var(--bg-card);
    border: none;
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.game-type-btn:hover {
    color: var(--text-primary);
}

.game-type-btn.active {
    background: var(--accent);
    color: white;
}

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

.game-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

.game-item-info h4 {
    margin-bottom: 2px;
    font-size: 1rem;
}

.game-item-info p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0;
}

.game-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-count {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* In Progress Sessions */
.in-progress-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.session-count {
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.in-progress-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 640px) {
    .in-progress-grid {
        grid-template-columns: 1fr;
    }
}

/* Session Tiles */
.session-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.session-tile:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.tile-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}

.session-tile.active .tile-status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.session-tile.waiting .tile-status-dot {
    background: var(--warning);
}

.tile-info {
    flex: 1;
    min-width: 0;
}

.tile-opponent {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.tile-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tile-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.5;
    transition: all 0.15s ease;
}

.session-tile:hover .tile-close {
    opacity: 1;
}

.tile-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.section-title {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* ===========================================
   14. Game Page
   =========================================== */
.view-game {
    max-width: 1000px;
}

.game-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}

.game-info {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
}

.game-type-label {
    font-weight: 500;
}

.game-status-label {
    color: var(--success);
    text-transform: capitalize;
}

/* Desktop: Side-by-side layout */
.game-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.game-main {
    flex: 1;
    min-width: 0;
}

.game-sidebar {
    width: 200px;
    flex-shrink: 0;
}

.game-players {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

.player-box {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.player-box.active {
    border-left-color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

.player-box.active .player-name {
    color: var(--success);
}

.player-box.waiting {
    color: var(--text-muted);
}

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

.player-color {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Cancel Section */
.cancel-section {
    margin-top: 20px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.cancel-request-notice {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    border-radius: var(--border-radius);
    padding: 12px;
    margin-bottom: 12px;
}

.cancel-request-notice p {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.cancel-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cancel-pending {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid var(--warning);
    border-radius: var(--border-radius);
    padding: 12px;
    margin-bottom: 12px;
}

.cancel-pending p {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
}

#game-canvas {
    max-width: 100%;
    touch-action: none;
    border-radius: var(--border-radius);
}

.game-controls {
    text-align: center;
    padding: 16px 0;
}

.waiting-message {
    color: var(--text-secondary);
    font-style: italic;
}

/* Mobile: Stack layout */
@media (max-width: 768px) {
    .game-layout {
        flex-direction: column;
    }

    .game-sidebar {
        width: 100%;
        order: -1;
    }

    .game-players {
        flex-direction: row;
        justify-content: space-between;
    }

    .player-box {
        flex: 1;
        text-align: center;
        border-left: none;
        border-top: 3px solid transparent;
    }

    .player-box.active {
        border-top-color: var(--success);
        border-left-color: transparent;
    }
}

.game-result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.game-result {
    text-align: center;
    padding: 48px;
}

.game-result h2 {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.game-result p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ===========================================
   15. Leaderboard Page
   =========================================== */
.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 24px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

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

.leaderboard-table table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 14px 16px;
    text-align: left;
}

.leaderboard-table th {
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 500;
}

.leaderboard-table tr:nth-child(even) {
    background: var(--bg-secondary);
}

.leaderboard-table .rank {
    width: 60px;
    font-weight: 600;
    color: var(--accent);
}

.leaderboard-table .rating {
    font-weight: 600;
}

/* ===========================================
   16. Empty & Loading States
   =========================================== */
.empty-state {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.loading-state {
    text-align: center;
    padding: 24px 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===========================================
   17. Chess Game Specific
   =========================================== */
.promotion-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
}

.promotion-options {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

.promotion-piece {
    width: 64px;
    height: 64px;
    padding: 8px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promotion-piece:hover {
    border-color: var(--accent);
}

/* ===========================================
   18. Responsive Design
   =========================================== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .game-item {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .game-item-meta {
        width: 100%;
        justify-content: center;
    }

    .invite-main {
        flex-direction: column;
        text-align: center;
    }

    .leaderboard-table {
        overflow-x: auto;
    }

    .header-nav {
        gap: 4px;
    }

    .nav-link {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 24px 20px;
    }

    .hero {
        padding: 40px 16px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .view {
        padding: 16px;
    }
}

/* ===========================================
   19. Utility Classes
   =========================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden { display: none !important; }

/* ===========================================
   20. Friends Page
   =========================================== */
.view-friends {
    max-width: 800px;
}

.view-friends h1 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.friends-grid .card {
    padding: 20px;
}

.friends-grid .card h3 {
    margin-bottom: 12px;
    font-size: 1rem;
}

.add-friend-form .form-row {
    display: flex;
    gap: 10px;
}

.add-friend-form input {
    flex: 1;
    padding: 10px 14px;
}

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

.request-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.request-from, .request-to {
    font-weight: 500;
    font-size: 0.9rem;
}

.request-actions {
    display: flex;
    gap: 6px;
}

.request-status {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 10px;
    background: var(--bg-tertiary);
}

.request-status.pending {
    color: var(--warning);
}

.friends-list-card {
    padding: 20px;
}

.friends-list-card h3 {
    margin-bottom: 12px;
    font-size: 1rem;
}

.friends-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.friend-nickname {
    font-weight: 500;
    font-size: 1rem;
}

.friend-actions form {
    margin: 0;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
    color: white;
}

/* ===========================================
   21. Game Creation Modal
   =========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--bg-primary);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.visibility-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.visibility-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
}

.visibility-option:hover {
    background: var(--bg-tertiary);
}

.visibility-option input[type="radio"] {
    width: auto;
    margin: 0;
}

.visibility-option label {
    cursor: pointer;
    flex: 1;
}

.friends-select {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.friends-select h4 {
    margin-bottom: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.friends-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.friend-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.friend-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* ===========================================
   22. Friend Games Section in Lobby
   =========================================== */
.friend-games-section {
    margin-bottom: 24px;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 16px 20px;
}

.friend-games-section h2 {
    margin-bottom: 12px;
    font-size: 1rem;
}

.friend-games-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.friend-game-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 14px 16px;
    border: 1px solid var(--border-color);
}

.friend-game-card:hover {
    border-color: var(--accent);
}

.friend-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.friend-game-type {
    font-weight: 600;
    font-size: 0.9rem;
}

.friend-game-host {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.friend-game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.friend-game-players {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===========================================
   23. Avatar Editor (Ported from Nuro Club)
   =========================================== */
.avatar-editor {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.avatar-preview-panel {
    position: sticky;
    top: 100px;
    align-self: start;
}

.avatar-preview {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 280px;
}

.avatar-preview img {
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.preview-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.preview-actions .btn {
    flex: 1;
    padding: 0.75rem 1rem;
}

/* Mobile action buttons - hidden by default on desktop */
.mobile-actions {
    display: none;
}

.avatar-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-group {
    margin-bottom: 0;
}

.control-group label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: block;
    color: var(--text-primary);
    font-size: 1.1em;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.option-grid.small {
    margin-top: 0.75rem;
}

.option-btn {
    padding: 14px;
    border: 3px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: capitalize;
    font-weight: 500;
    font-size: 0.95em;
}

.option-btn:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(233, 69, 96, 0.2);
}

.option-btn.active {
    border-color: var(--accent);
    border-width: 4px;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.15), rgba(233, 69, 96, 0.1));
    transform: translateY(-2px);
}

.color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.color-grid.small {
    margin-top: 0.75rem;
}

.color-btn {
    width: 45px;
    height: 45px;
    border: 3px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.color-btn:hover {
    transform: scale(1.15);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.color-btn.active {
    border-color: var(--accent);
    border-width: 4px;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
    transform: scale(1.1);
}

.thickness-toggle {
    display: flex;
    gap: 10px;
    margin-top: 0.75rem;
}

.thickness-btn {
    padding: 10px 16px;
    border: 3px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.thickness-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.thickness-btn.active {
    border-color: var(--accent);
    border-width: 4px;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.15), rgba(233, 69, 96, 0.1));
}


/* Profile Avatar Image */
.profile-avatar-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    margin-bottom: 0.25rem;
}

.page-header .text-muted {
    color: var(--text-secondary);
    margin: 0;
}

/* Responsive Avatar Editor */
@media (max-width: 768px) {
    .avatar-editor {
        grid-template-columns: 1fr;
    }

    /* Mobile: Floating preview panel */
    .avatar-preview-panel {
        position: fixed;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
        width: auto;
        height: auto;
        background: transparent;
        z-index: 999;
        padding: 0;
    }

    .avatar-preview {
        background: transparent;
        border: none;
        padding: 0;
        min-height: auto;
    }

    .avatar-preview img {
        width: 100px !important;
        height: 100px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
        cursor: pointer;
        transition: all 0.3s ease;
        border-radius: 12px;
    }

    .avatar-preview img.enlarged {
        width: 200px !important;
        height: 200px !important;
    }

    /* Hide action buttons in floating preview on mobile */
    .avatar-preview-panel .preview-actions {
        display: none;
    }

    /* Add padding to controls to account for floating avatar */
    .avatar-controls {
        padding-right: 120px;
    }

    /* Show mobile action buttons */
    .mobile-actions {
        display: flex;
        gap: 0.75rem;
        padding: 1rem;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        margin-top: 1.5rem;
        margin-left: -1rem;
        margin-right: calc(-1rem - 120px);
        padding-right: calc(1rem + 120px);
        position: sticky;
        bottom: 0;
    }

    .mobile-actions .btn {
        flex: 1;
        padding: 0.875rem 1rem;
    }
}

@media (max-width: 600px) {
    .add-friend-form .form-row {
        flex-direction: column;
    }

    .request-item {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* ===========================================
   15. Spell Card System
   =========================================== */

/* Spell Panel */
.spell-panel {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
}

.spell-hand {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

/* Spell Card */
.spell-card {
    width: 90px;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.spell-card:hover:not(.disabled) {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.spell-card.selected {
    border-color: var(--warning);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
    transform: translateY(-4px);
}

.spell-card.discard-option {
    border-color: var(--error);
    animation: pulse-discard 1s infinite;
}

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

/* Info button on spell cards */
.spell-card {
    position: relative;
}

.card-info-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.card-info-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: scale(1.1);
}

.card-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.card-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-type {
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.card-desc {
    font-size: 0.55rem;
    color: var(--text-secondary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Spell Actions */
.spell-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Animations */
@keyframes pulse-discard {
    0%, 100% { box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.5); }
}

@keyframes damage-flash {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(2) sepia(1) saturate(5) hue-rotate(-30deg); }
}

@keyframes heal-pulse {
    0%, 100% { box-shadow: 0 0 0 rgba(74, 222, 128, 0); }
    50% { box-shadow: 0 0 20px rgba(74, 222, 128, 0.8); }
}

@keyframes floating-damage {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-30px); }
}

@keyframes freeze-effect {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.3) saturate(0.5) hue-rotate(180deg); }
}

/* Floating damage number */
.floating-damage {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: #e94560;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    animation: floating-damage 1s ease-out forwards;
}

.floating-heal {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: #4ade80;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    animation: floating-damage 1s ease-out forwards;
}

/* Turn Action Modal */
.turn-action-modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--accent);
    padding: 1rem;
    margin-bottom: 1rem;
    animation: modal-appear 0.3s ease-out;
}

.turn-action-modal h3 {
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.turn-prompt {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.turn-action-buttons {
    display: flex;
    gap: 0.75rem;
}

.turn-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 1rem 0.5rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.turn-action-btn:hover {
    transform: translateY(-2px);
}

.turn-action-btn .action-icon {
    font-size: 1.5rem;
}

.turn-action-btn .action-label {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Spell Selection Modal */
.spell-select-modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--accent);
    padding: 1rem;
    margin-bottom: 1rem;
    animation: modal-appear 0.3s ease-out;
}

.spell-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.spell-select-header h3 {
    color: var(--accent);
    font-size: 1rem;
    margin: 0;
}

.modal-back-btn {
    background: var(--bg-secondary);
    border: none;
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.modal-back-btn:hover {
    background: var(--accent);
}

.spell-select-cards {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.spell-select-cards .spell-card {
    width: 90px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spell-select-cards .spell-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

/* Spell Detail Modal */
.spell-detail-modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--accent);
    padding: 1.5rem;
    margin-bottom: 1rem;
    animation: modal-appear 0.3s ease-out;
}

.spell-detail-content {
    text-align: center;
    position: relative;
}

.spell-detail-close {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.spell-detail-close:hover {
    background: var(--accent);
}

.spell-detail-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spell-detail-icon img {
    width: 60px;
    height: 60px;
    filter: brightness(0) invert(1);
}

.spell-detail-name {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.spell-detail-type {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.spell-detail-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.spell-detail-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Discard Modal - Centered Overlay */
.discard-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 3px solid var(--warning);
    padding: 1.5rem;
    z-index: 1000;
    min-width: 280px;
    max-width: 90vw;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modal-appear 0.3s ease-out;
}

.discard-modal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
}

.discard-modal h3 {
    color: var(--warning);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.discard-cards {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.discard-cards .spell-card {
    width: 80px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.discard-cards .spell-card:hover {
    transform: translateY(-4px);
    border-color: var(--error);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.discard-cancel-btn {
    display: block;
    margin: 1rem auto 0;
    padding: 0.5rem 1.5rem;
}

@keyframes modal-appear {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Mobile adjustments for spell panel */
@media (max-width: 600px) {
    .spell-panel {
        padding: 0.75rem;
    }

    .spell-card {
        width: 75px;
        padding: 0.375rem;
    }

    .card-icon {
        width: 32px;
        height: 32px;
    }

    .card-name {
        font-size: 0.6rem;
    }

    .card-type {
        font-size: 0.5rem;
    }

    .card-desc {
        font-size: 0.5rem;
        -webkit-line-clamp: 1;
    }
}
