/* Latent Space - Win98 Theme Styles */

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    background: #008080;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    user-select: none;
    font-weight: 300;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Selection behavior: only puzzle content is selectable */
.main-window,
.main-window * {
    user-select: none;
}

.content-inner,
.content-inner * {
    user-select: text;
}

/* Keep non-content UI elements unselectable */
.content-inner .info-bar,
.content-inner .info-bar * {
    user-select: none;
}

.tabs,
.tabs * {
    user-select: none;
}

* {
    box-sizing: border-box;
}

.windows-box-shadow {
    box-shadow: -2px -2px #e0dede, -2px 0 #e0dede, 0 -2px #e0dede, -4px -4px white, -4px 0 white, 0 -4px white, 2px 2px #818181, 0 2px #818181, 2px 0 #818181, 2px -2px #e0dede, -2px 2px #818181, -4px 2px white, -4px 4px black, 4px 4px black, 4px 0 black, 0 4px black, 2px -4px white, 4px -4px black;
}

.inverse-windows-box-shadow {
    box-shadow: -2px -2px #818181, -2px 0 #818181, 0 -2px #818181, -4px -4px black, -4px 0 black, 0 -4px black, 2px 2px #e0dede, 0 2px #e0dede, 2px 0 #e0dede, 2px -2px #818181, -2px 2px #e0dede, -4px 2px black, -4px 4px white, 4px 4px white, 4px 0 white, 0 4px white, 2px -4px black, 4px -4px white;
}

/* Main Window Container */
.main-window {
    background: #c0c0c0;
    margin: 20px auto;
    max-width: 900px;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 5.75rem); /* stay above the taskbar height */
    overflow: hidden;  /* prevent outer window from scrolling */
}

.window-header {
    background: linear-gradient(90deg, #000b7c, #377cc6);
    color: white;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.window-header .title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-header .title img {
    width: 16px;
    height: 16px;
}

.header-buttons {
    display: flex;
    gap: 4px;
}

.header-buttons button {
    background: #c0c0c0;
    border: none;
    width: 16px;
    height: 14px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -1px -1px #e0dede, -1px 0 #e0dede, 0 -1px #e0dede, -2px -2px white, -2px 0 white, 0 -2px white, 1px 1px #818181, 0 1px #818181, 1px 0 #818181, 1px -1px #e0dede, -1px 1px #818181, -2px 1px white, -2px 2px black, 2px 2px black, 2px 0 black, 0 2px black, 1px -2px white, 2px -2px black;
}

.header-buttons button:active {
    box-shadow: -1px -1px #818181, -1px 0 #818181, 0 -1px #818181, -2px -2px black, -2px 0 black, 0 -2px black, 1px 1px #e0dede, 0 1px #e0dede, 1px 0 #e0dede;
}

.menu-bar {
    display: flex;
    padding: 4px 8px;
    gap: 16px;
    border-bottom: 1px solid #808080;
    box-shadow: 0 1px white;
}

.menu-bar span {
    color: #000;
    font-size: 12px;
    cursor: default;
}

.menu-bar span:first-letter {
    text-decoration: underline;
}

/* Content Area */
.window-content {
    background: #c0c0c0;
    padding: 16px;
    /* let content section flex to available space */
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow flex child to shrink */
    overflow: hidden; /* scrolling handled inside content-inner */
}

.content-inner {
    background: white;
    border: 2px inset;
    padding: 16px;
    /* inner white panel fills remaining space and scrolls when needed */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* Info Bar */
.info-bar {
    display: flex;
    gap: 24px;
    padding: 12px;
    background: #f0f0f0;
    border: 1px solid #c0c0c0;
    margin-bottom: 16px;
    font-size: 12px;
}

.info-item strong {
    color: #000080;
}

/* Typography */
h1 {
    font-size: 24px;
    margin: 0 0 16px 0;
    color: #000080;
}

h2 {
    font-size: 18px;
    margin: 16px 0 8px 0;
    color: #000080;
}

h3 {
    font-size: 14px;
    margin: 12px 0 6px 0;
    color: #000;
}

p {
    font-size: 12px;
    line-height: 1.6;
    color: #000;
    margin: 8px 0;
}

a {
    color: #0000FF;
    text-decoration: underline;
}

a:visited {
    color: #800080;
}

a:hover {
    color: #FF0000;
}

/* Buttons */
.win-button {
    background: #c0c0c0;
    border: none;
    padding: 4px 16px;
    font-size: 12px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    min-width: 75px;
}

.win-button:active {
    box-shadow: -2px -2px #818181, -2px 0 #818181, 0 -2px #818181, -4px -4px black, -4px 0 black, 0 -4px black, 2px 2px #e0dede, 0 2px #e0dede, 2px 0 #e0dede, 2px -2px #818181, -2px 2px #e0dede, -4px 2px black, -4px 4px white, 4px 4px white, 4px 0 white, 0 4px white, 2px -4px black, 4px -4px white;
}

.win-button:disabled {
    color: #808080;
    cursor: not-allowed;
}

.win-button.primary {
    border: 2px dotted #000;
}

/* Input Fields */
.win-input {
    background: white;
    border: none;
    padding: 4px 8px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    width: 100%;
}

.win-input:focus {
    outline: none;
}

/* Tables */
.win-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: white;
}

.win-table th {
    background: #c0c0c0;
    border: 1px solid #808080;
    padding: 4px 8px;
    text-align: left;
    font-weight: bold;
}

.win-table td {
    border: 1px solid #c0c0c0;
    padding: 4px 8px;
}

.win-table tr:nth-child(even) {
    background: #f0f0f0;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: bold;
}

.status-active {
    background: #00FF00;
    color: #000;
}

.status-upcoming {
    background: #FFFF00;
    color: #000;
}

.status-solved {
    background: #C0C0C0;
    color: #000;
}

/* Navigation Bar */
.nav-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: linear-gradient(180deg, #e0e0e0 0%, #c0c0c0 50%, #a8a8a8 100%);
    border: 2px inset;
    flex-wrap: wrap;
}

.nav-bar a {
    text-decoration: none;
}

.auth-buttons {
    margin-left: auto;
}

/* Puzzle Card */
.puzzle-card {
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    padding: 12px;
    margin-bottom: 12px;
}

.puzzle-card:hover {
    background: #d0d0d0;
}

/* Hints Section */
.hint-card {
    background: #f9f9f9;
    border: 1px solid #c0c0c0;
    margin-bottom: 8px;
}

.hint-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    background: #e8e8e8;
    border-bottom: 1px solid #c0c0c0;
    user-select: none;
}

.hint-header:hover {
    background: #ddd;
}

.hint-toggle {
    background: none;
    border: none;
    font-size: 10px;
    cursor: pointer;
    padding: 0;
    width: 16px;
    color: #000080;
}

.hint-header strong {
    flex: 1;
    font-size: 12px;
    color: #000;
}

.hint-time {
    font-size: 11px;
    color: #666;
    font-weight: normal;
}

.hint-content {
    padding: 12px;
    font-size: 12px;
    line-height: 1.6;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.hint-card.hint-locked {
    opacity: 0.6;
}

.hint-card.hint-locked .hint-header {
    cursor: default;
    background: #f0f0f0;
}

.hint-card.hint-locked .hint-header:hover {
    background: #f0f0f0;
}

/* Form Groups */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: bold;
}

/* Messages */
.message-box {
    padding: 12px;
    margin: 12px 0;
    border: 2px outset;
}

.message-success {
    background: #90EE90;
}

.message-error {
    background: #FFB6C1;
}

.message-info {
    background: #ADD8E6;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #c0c0c0;
    border: 2px inset;
    margin-bottom: 16px;
}

.user-info-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding: 4px 8px;
    background: linear-gradient(180deg, #e8e8e8 0%, #c0c0c0 100%);
    border: 1px solid #808080;
}

.user-info-display .user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #808080;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    object-fit: cover;
}

.user-info-display .user-name {
    font-size: 12px;
    font-weight: bold;
    color: #000;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 0;
    border: 1px solid #808080;
}

/* Login Section */
.login-container {
    max-width: 400px;
    margin: 40px auto;
    text-align: center;
}

.login-container img.logo {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: white;
    border: 2px outset #c0c0c0;
    padding: 8px 24px;
    cursor: pointer;
    font-size: 14px;
    margin: 16px auto;
}

.google-btn:hover {
    background: #f0f0f0;
}

.google-btn:active {
    border-style: inset;
}

.google-btn img {
    width: 20px;
    height: 20px;
}

/* Leaderboard */
.leaderboard-container {
    margin-top: 16px;
}

.rank-gold {
    color: #000000;
    font-weight: bold;
}

.rank-silver {
    color: #000000;
    font-weight: bold;
}

.rank-bronze {
    color: #000000;
    font-weight: bold;
}

/* Puzzle Content */
.puzzle-description {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 16px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.8;
}

.puzzle-artifact {
    background: #000;
    color: #00FF00;
    font-family: 'Courier New', monospace;
    padding: 16px;
    border: 2px inset;
    margin: 16px 0;
    overflow-x: auto;
}

/* Submission Form */
.submission-form {
    background: #c0c0c0;
    border: 2px outset;
    padding: 16px;
    margin-top: 16px;
}

.submission-form .form-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.submission-form .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Score Display */
.score-display {
    font-size: 18px;
    font-weight: bold;
    color: #000080;
    text-align: center;
    padding: 16px;
    background: #FFFFCC;
    border: 2px inset;
    margin: 16px 0;
}

/* Footer */
.window-footer {
    background: #c0c0c0;
    padding: 4px 8px;
    border-top: 2px outset;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
}

.footer-section {
    border: 1px inset;
    padding: 2px 8px;
    background: #c0c0c0;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 32px;
    color: #808080;
}

.loading::after {
    content: '⌛';
    animation: hourglass 1s infinite;
    display: inline-block;
    font-size: 24px;
}

@keyframes hourglass {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .main-window {
        margin: 10px;
        /* keep flex sizing; margin reduced for small screens */
    }
    
    .nav-bar {
        flex-wrap: wrap;
    }
    
    .submission-form .form-row {
        flex-direction: column;
    }
    
    .win-table {
        font-size: 11px;
    }
    
    .win-table th, .win-table td {
        padding: 4px;
    }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: -2px;
    position: relative;
    z-index: 1;
}

.tab {
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    border-bottom: none;
    padding: 4px 16px;
    cursor: pointer;
    font-size: 12px;
}

.tab.active {
    background: white;
    border-bottom: 2px solid white;
    margin-bottom: -2px;
}

.tab-content {
    background: white;
    border: 2px inset;
    padding: 16px;
    display: none;
}

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

/* How To Section */
.how-to-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.how-to-list li {
    padding: 8px 0 8px 24px;
    position: relative;
    font-size: 12px;
    border-bottom: 1px dotted #c0c0c0;
}

.how-to-list li::before {
    content: '➤';
    position: absolute;
    left: 0;
    color: #000080;
}

/* Leaderboard Table */
.leaderboard-table {
    border-collapse: separate;
    border-spacing: 0;
}

.leaderboard-table .player-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.leaderboard-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #808080;
    object-fit: cover;
    flex-shrink: 0;
}

.leaderboard-table .rank-cell {
    text-align: center;
    font-size: 16px;
}

.leaderboard-table .points-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
    color: #008000;
}

.leaderboard-table .solved-cell {
    text-align: center;
}

.leaderboard-table tr.rank-gold {
    background: linear-gradient(90deg, #FFD700 0%, #FFF8DC 30%, white 100%);
}

.leaderboard-table tr.rank-silver {
    background: linear-gradient(90deg, #C0C0C0 0%, #E8E8E8 30%, white 100%);
}

.leaderboard-table tr.rank-bronze {
    background: linear-gradient(90deg, #CD7F32 0%, #FAEBD7 30%, white 100%);
}

/* Icon styles */
.icon-small {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Back button */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    font-size: 12px;
}

/* Timer display */
.timer-display {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: #000;
    color: #00FF00;
    padding: 4px 8px;
    display: inline-block;
}

/* Edit Name Dialog */
.edit-name-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.edit-name-content {
    background: #c0c0c0;
    min-width: 300px;
    max-width: 400px;
}

.edit-name-header {
    background: linear-gradient(90deg, #000b7c, #377cc6);
    color: white;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 12px;
}

.edit-name-header .close-btn {
    background: #c0c0c0;
    border: none;
    width: 16px;
    height: 14px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-name-body {
    padding: 16px;
}

.edit-name-body label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.edit-name-body input {
    width: 100%;
    margin-bottom: 16px;
    padding: 6px 8px;
}

.edit-name-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Clickable user name */
.user-name-clickable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.user-name-clickable:hover {
    color: #000080;
}

/* Edit Avatar Dialog */
.edit-avatar-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.edit-avatar-content {
    background: #c0c0c0;
    min-width: 300px;
    max-width: 400px;
}

.edit-avatar-header {
    background: linear-gradient(90deg, #000b7c, #377cc6);
    color: white;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 12px;
}

.edit-avatar-header .close-btn {
    background: #c0c0c0;
    border: none;
    width: 16px;
    height: 14px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-avatar-body {
    padding: 16px;
    text-align: center;
}

.avatar-preview-container {
    margin-bottom: 16px;
}

.avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid #808080;
    object-fit: cover;
    background: #f0f0f0;
}

.avatar-upload-btn {
    display: inline-block;
    cursor: pointer;
    margin-bottom: 8px;
}

.avatar-hint {
    font-size: 10px;
    color: #666;
    margin: 4px 0 12px 0;
}

#avatar-upload-status {
    font-size: 11px;
    margin-bottom: 12px;
    min-height: 16px;
}

.edit-avatar-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Avatar placeholder for leaderboards */
.leaderboard-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e0e0e0;
    border: 1px solid #808080;
    font-size: 14px;
    flex-shrink: 0;
}

/* Clickable avatar */
.user-avatar-clickable {
    cursor: pointer;
    transition: transform 0.1s;
}

.user-avatar-clickable:hover {
    transform: scale(1.1);
    box-shadow: 0 0 4px rgba(0, 0, 128, 0.5);
}

/* Release info spacing under puzzle title */
.release-info {
    margin-top: 4px;
    margin-bottom: 12px;
    font-size: 11px;
    color: #666;
}

/* Captcha Dialog (Anti-Bot Verification) */
.captcha-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.captcha-content {
    background: #c0c0c0;
    min-width: 320px;
    max-width: 420px;
}

.captcha-header {
    background: linear-gradient(90deg, #800000, #cc4444);
    color: white;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 12px;
}

.captcha-body {
    padding: 16px;
}

.captcha-body p {
    font-size: 12px;
    margin: 0;
}

#recaptcha-container {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.captcha-body input {
    width: 100%;
    margin-top: 8px;
    padding: 6px 8px;
    font-size: 12px;
}

.captcha-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Hide reCAPTCHA badge */
.grecaptcha-badge {
    display: none !important;
}

