/* Mind Chess - Minimalist UI */

:root {
    --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --text-color: rgb(25, 25, 24);
    --text-muted: rgba(25, 25, 24, 0.6);
    --text-subtle: rgba(25, 25, 24, 0.4);
    --bg-color: #fafafa;
    --surface-color: #ffffff;
    --border-color: rgba(55, 53, 47, 0.12);
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-32: 32px;
}

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

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: var(--space-32) var(--space-24);
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: var(--space-24);
    padding: var(--space-16) var(--space-24);
    margin: calc(-1 * var(--space-32)) calc(-1 * var(--space-24)) var(--space-24);
}

.app-header__title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text-color);
    margin: 0;
    padding-bottom: var(--space-16);
}

.app-header__title::after {
    content: "";
    display: block;
    width: 40%;
    height: 1px;
    background: var(--border-color);
    margin: var(--space-16) auto 0;
}

/* Start Screen */
.start-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.start-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.chess-icon {
    font-size: 72px;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.start-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
}

.start-description {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.start-hints {
    margin-top: 24px;
}

.start-hints p {
    font-size: 13px;
    color: var(--text-subtle);
    margin-bottom: 6px;
}

/* Primary Button */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 50px;
    background: #000000;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
}

.btn-primary:active {
    background: #333333;
    transform: translateY(0);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* Game Screen */
.game-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* Move History */
.move-history {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.move-entry {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.move-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.move-number {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-subtle);
    min-width: 32px;
    padding-top: 10px;
}

.move-bubble {
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 500;
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    max-width: 200px;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.move-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.move-bubble.user {
    background: #2383E2;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.move-bubble.user:hover {
    box-shadow: 0 6px 20px rgba(35, 131, 226, 0.25);
}

.move-bubble.ai {
    background: #f3f3f2;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.system-message {
    text-align: center;
    padding: 16px 20px;
    animation: fadeIn 0.3s ease;
}

.system-message.welcome {
    color: var(--text-muted);
    font-size: 14px;
}

.system-message.error {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 10px;
    color: #dc2626;
    font-size: 15px;
}

.system-message.info {
    color: var(--text-subtle);
    font-size: 14px;
    font-style: italic;
}

.system-message.game-end {
    background: rgba(55, 53, 47, 0.06);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 16px;
    font-weight: 500;
}

/* Thinking indicator */
.thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(55, 53, 47, 0.04);
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-subtle);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.thinking-text {
    font-size: 14px;
    color: var(--text-subtle);
}

/* Input Area */
.input-area {
    padding: 16px 20px 20px;
    background: #f8f8f7;
    border-top: 1px solid var(--border-color);
}

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

#moveInput {
    flex: 1;
    padding: 14px 18px;
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-color);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
}

#moveInput:focus {
    border-color: #2383E2;
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.1);
}

#moveInput::placeholder {
    color: var(--text-subtle);
    font-weight: 400;
}

.send-btn {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2383E2;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover:not(:disabled) {
    background: #1B6DC1;
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.send-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

.input-help {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-subtle);
    text-align: center;
}

/* Game Over Screen */
.game-over-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-over-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    max-width: 450px;
    width: 100%;
}

.result-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.result-icon.win {
    animation: celebrate 0.5s ease;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.result-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.result-title.win { color: #16a34a; }
.result-title.loss { color: #dc2626; }
.result-title.draw { color: #d97706; }

.result-message {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.final-moves {
    background: #f8f8f7;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 28px;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
}

.final-moves-list {
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.8;
}

.final-moves-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-subtle);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Scrollbar styling */
.move-history::-webkit-scrollbar,
.final-moves::-webkit-scrollbar {
    width: 6px;
}

.move-history::-webkit-scrollbar-track,
.final-moves::-webkit-scrollbar-track {
    background: transparent;
}

.move-history::-webkit-scrollbar-thumb,
.final-moves::-webkit-scrollbar-thumb {
    background: rgba(55, 53, 47, 0.15);
    border-radius: 3px;
}

.move-history::-webkit-scrollbar-thumb:hover,
.final-moves::-webkit-scrollbar-thumb:hover {
    background: rgba(55, 53, 47, 0.25);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: var(--space-24) var(--space-16);
    }

    .app-header {
        padding: var(--space-12) var(--space-16);
        margin: calc(-1 * var(--space-24)) calc(-1 * var(--space-16)) var(--space-20);
    }

    .app-header__title {
        font-size: 28px;
    }
    
    .start-card,
    .game-over-card {
        padding: 32px 24px;
    }
    
    .chess-icon {
        font-size: 56px;
    }
    
    .start-title,
    .result-title {
        font-size: 24px;
    }
    
    .move-bubble {
        font-size: 16px;
        padding: 8px 14px;
    }
    
    #moveInput {
        font-size: 16px;
        padding: 12px 14px;
    }
    
    .send-btn {
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 28px;
    }
    
    .start-description {
        font-size: 14px;
    }
    
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}
