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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    padding: 20px 16px;
    max-width: 100vw;
}

/* Typography */
.title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.greeting {
    font-size: 16px;
    text-align: center;
    color: var(--tg-theme-hint-color, #999999);
    margin-bottom: 32px;
}

.subtitle {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #999999);
    text-align: center;
    margin-bottom: 16px;
}

h2 {
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
}

/* Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
    background-color: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #ffffff);
}

.btn-secondary {
    background-color: var(--tg-theme-secondary-bg-color, #f0f0f0);
    color: var(--tg-theme-text-color, #000000);
}

.btn-outline {
    background: transparent;
    color: var(--tg-theme-link-color, #3390ec);
    border: 1.5px solid var(--tg-theme-link-color, #3390ec);
}

.btn-small {
    padding: 10px 16px;
    font-size: 14px;
    width: auto;
    min-width: 44px;
    border-radius: 10px;
}

.btn-emoji {
    font-size: 20px;
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Player List */
.player-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 12px;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.player-name {
    font-size: 15px;
    font-weight: 500;
}

.player-host-badge {
    margin-left: auto;
    font-size: 12px;
    color: var(--tg-theme-hint-color, #999999);
}

/* Question */
.question-header {
    text-align: center;
    margin-bottom: 12px;
}

.question-counter {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #999999);
    font-weight: 500;
}

.question-text {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.4;
}

.question-input {
    margin-bottom: 16px;
}

/* Choice buttons */
.choice-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-btn {
    padding: 14px 16px;
    border: 2px solid var(--tg-theme-secondary-bg-color, #e0e0e0);
    border-radius: 12px;
    background: transparent;
    font-size: 15px;
    cursor: pointer;
    text-align: left;
    color: var(--tg-theme-text-color, #000000);
    transition: all 0.2s;
}

.choice-btn.selected {
    border-color: var(--tg-theme-button-color, #3390ec);
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #ffffff);
}

/* Scale slider */
.scale-container {
    text-align: center;
}

.scale-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--tg-theme-button-color, #3390ec);
    margin-bottom: 8px;
}

.scale-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--tg-theme-secondary-bg-color, #e0e0e0);
    border-radius: 3px;
    outline: none;
}

.scale-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--tg-theme-button-color, #3390ec);
    cursor: pointer;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--tg-theme-hint-color, #999999);
    margin-top: 4px;
}

/* Text input */
.text-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--tg-theme-secondary-bg-color, #e0e0e0);
    border-radius: 12px;
    font-size: 15px;
    background: transparent;
    color: var(--tg-theme-text-color, #000000);
    outline: none;
}

.text-input:focus {
    border-color: var(--tg-theme-button-color, #3390ec);
}

.waiting-text {
    text-align: center;
    font-size: 14px;
    color: var(--tg-theme-hint-color, #999999);
    margin-top: 12px;
}

/* Predictions */
.predictions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 16px;
}

.prediction-card {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 12px;
    padding: 16px;
}

.prediction-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}

/* Reveal */
.reveal-content {
    margin-bottom: 20px;
}

.reveal-question {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}

.reveal-group {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 12px;
}

.reveal-group-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.reveal-group-names {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #999999);
}

.knowledge-section {
    margin-top: 16px;
}

.knowledge-item {
    padding: 8px 0;
    font-size: 14px;
}

.correct {
    color: #34c759;
}

.incorrect {
    color: #ff3b30;
}

/* Results */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 12px;
}

.result-rank {
    font-size: 24px;
    width: 36px;
    text-align: center;
}

.result-info {
    flex: 1;
}

.result-name {
    font-size: 15px;
    font-weight: 600;
}

.result-subtitle {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #999999);
}

.result-score {
    font-size: 18px;
    font-weight: 700;
    color: var(--tg-theme-button-color, #3390ec);
}

/* Detective (Mode 2) */
.detective-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding-bottom: 0;
}

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

.detective-header h2 {
    margin-bottom: 0;
    font-size: 18px;
}

.detective-chat {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-bubble.host {
    align-self: flex-start;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-bottom-left-radius: 4px;
}

.chat-bubble.anon {
    align-self: flex-end;
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #ffffff);
    border-bottom-right-radius: 4px;
}

.chat-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--tg-theme-link-color, #3390ec);
}

.chat-bubble.anon .chat-sender {
    color: rgba(255, 255, 255, 0.7);
}

.detective-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--tg-theme-secondary-bg-color, #e0e0e0);
}

.detective-input-area .text-input {
    flex: 1;
}

.detective-controls {
    display: flex;
    gap: 8px;
    padding-bottom: 16px;
}

.detective-controls .btn {
    flex: 1;
}

.guess-result {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
}

/* Stats */
.stats-content {
    margin-bottom: 20px;
}

.stat-card {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--tg-theme-button-color, #3390ec);
}

.stat-label {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #999999);
    margin-top: 4px;
}

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

.modal-content {
    background: var(--tg-theme-bg-color, #ffffff);
    border-radius: 16px;
    padding: 24px 20px;
    width: 85%;
    max-width: 320px;
    text-align: center;
}

.modal-content h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px 0;
    color: var(--tg-theme-hint-color, #999999);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--tg-theme-hint-color, #999999);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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