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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

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

.screen.active {
    display: block;
}

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

/* Login Screen */
#loginScreen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#loginScreen h1 {
    font-size: 48px;
    margin-bottom: 10px;
}

#loginScreen p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 300px;
    margin: 0 auto;
}

.login-form input {
    padding: 15px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.login-form input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.login-form button {
    padding: 15px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: white;
    color: #667eea;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.login-form button:hover {
    transform: translateY(-2px);
}

/* Header */
header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    font-size: 16px;
}

#balance {
    font-weight: bold;
    color: #667eea;
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Markets List */
.markets-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.market-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.market-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.market-question {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
    line-height: 1.4;
}

.market-prob {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.prob-indicator {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.prob-fill {
    height: 100%;
    background: #4caf50;
    transition: width 0.3s ease;
}

.market-meta-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

#modalQuestion {
    margin-bottom: 25px;
    font-size: 20px;
    line-height: 1.4;
}

.probability-display {
    margin-bottom: 30px;
}

.prob-bar {
    height: 40px;
    background: #e0e0e0;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 10px;
}

.prob-bar-fill {
    height: 100%;
    background: linear-gradient(to right, #f44336 0%, #4caf50 100%);
    transition: width 0.3s ease;
}

.prob-values {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}

.trade-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.bet-option {
    text-align: center;
}

.bet-option h4 {
    margin-bottom: 10px;
}

.bet-option button {
    margin: 5px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.bet-option:first-child button {
    background: #f44336;
    color: white;
}

.bet-option:last-child button {
    background: #4caf50;
    color: white;
}

.bet-option button:hover {
    transform: scale(1.05);
}

.trade-result {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

/* Profile Tab Styles */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h4 {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.stat-card span {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.pnl.positive {
    color: #4caf50;
}

.pnl.negative {
    color: #f44336;
}

.profile-positions {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.profile-position-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.profile-position-item:hover {
    background: #f9f9f9;
}

.profile-position-item:last-child {
    border-bottom: none;
}

.position-value-details {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 14px;
}

/* Admin Tab Styles */
.admin-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-section h4 {
    margin-bottom: 20px;
    color: #333;
}

.admin-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    min-width: 180px;
    font-weight: 500;
}

.control-group input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 100px;
}

.control-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.admin-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    display: none;
}

.admin-result.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4caf50;
}

.admin-result.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.expired-markets-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    margin: 15px 0;
    background: #f9f9f9;
}

.expired-market-item {
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.expired-market-item .market-question {
    font-weight: 500;
    margin-bottom: 5px;
}

.expired-market-item .market-meta {
    font-size: 12px;
    color: #666;
}

.resolve-single-btn {
    margin-top: 10px;
    padding: 5px 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.resolve-single-btn:hover {
    background: #45a049;
}

.resolve-single-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.resolve-btn {
    background: #ff9800;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.resolve-btn:hover {
    background: #f57c00;
}

.resolve-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.resolution-log {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.resolution-log.active {
    display: block;
}

.resolution-entry {
    padding: 15px;
    margin: 10px 0;
    background: #f5f5f5;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.resolution-entry.success {
    border-left-color: #4caf50;
}

.resolution-entry.error {
    border-left-color: #f44336;
}

.resolution-entry h5 {
    margin: 0 0 10px 0;
    color: #333;
}

.resolution-entry .resolution-details {
    font-size: 14px;
    color: #666;
    margin: 5px 0;
}

.resolution-entry .llm-prompt,
.resolution-entry .llm-response {
    background: white;
    padding: 10px;
    border-radius: 4px;
    margin: 5px 0;
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
}

.trade-result.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4caf50;
}

.trade-result.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.market-meta {
    color: #666;
    font-size: 14px;
}

.market-meta p {
    margin: 5px 0;
}

/* Modal Position Display */
.modal-position {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
}

.modal-position-info h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.position-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 8px;
    background: white;
    border-radius: 4px;
}

.sell-btn {
    padding: 6px 12px;
    margin-left: 8px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.sell-btn:hover {
    background: #ff5252;
}

.modal-position .invested {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-weight: bold;
    color: #666;
}

/* Resolution History */
.resolution-log {
    max-height: 600px;
    overflow-y: auto;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-top: 10px;
}

.resolution-entry {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.resolution-entry.error {
    border-left-color: #ff6b6b;
}

.resolution-entry h5 {
    margin-top: 0;
    color: #333;
    font-size: 16px;
}

.resolution-details {
    margin: 10px 0;
    color: #666;
}

.llm-prompt, .llm-response {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.llm-prompt strong, .llm-response strong {
    display: block;
    margin-bottom: 5px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
}

/* Positions Section */
.positions-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.positions-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

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

.no-positions {
    color: #999;
    text-align: center;
    padding: 20px;
    margin: 0;
}

.position-item {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e0e0e0;
}

.position-item:hover {
    background: #ebebeb;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.position-question {
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.position-details {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 5px;
    font-size: 14px;
}

.yes-position {
    color: #4CAF50;
    font-weight: 500;
}

.no-position {
    color: #f44336;
    font-weight: 500;
}

.invested {
    color: #666;
}

.position-probability {
    font-size: 13px;
    color: #777;
}

.profile-position-item.error {
    background: #ffebeb;
    cursor: default;
}

.profile-position-item .error-message {
    color: #d32f2f;
    font-weight: bold;
    padding: 10px 0;
}