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

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    padding: 20px;
    color: #e0d5c1;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #c9a84c;
    text-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
    letter-spacing: 4px;
}

.subtitle {
    font-size: 1.2em;
    color: #8a7d6b;
    letter-spacing: 2px;
}

.screen {
    display: none;
    background: rgba(20, 20, 30, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(201, 168, 76, 0.15);
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

.menu-content h2 {
    text-align: center;
    color: #c9a84c;
    margin-bottom: 30px;
    font-size: 2em;
    letter-spacing: 3px;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.level-card {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(201, 168, 76, 0.2);
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(201, 168, 76, 0.25);
    border-color: #c9a84c;
}

.level-card.completed {
    background: linear-gradient(135deg, #1a2e1a 0%, #0f4630 100%);
    border-color: #4caf50;
}

.level-card.completed::after {
    content: '✓ 已破局';
    position: absolute;
    top: 10px;
    right: 10px;
    color: #4caf50;
    font-size: 12px;
    font-weight: bold;
    background: rgba(76, 175, 80, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.level-number {
    font-size: 0.85em;
    color: #c9a84c;
    font-weight: bold;
    margin-bottom: 5px;
}

.level-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #e0d5c1;
    margin-bottom: 10px;
}

.level-preview {
    font-size: 0.85em;
    color: #8a7d6b;
    line-height: 1.5;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(201, 168, 76, 0.2);
}

.btn-back {
    background: rgba(100, 100, 120, 0.4);
    color: #8a7d6b;
    border: 1px solid rgba(100, 100, 120, 0.4);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(100, 100, 120, 0.6);
    color: #e0d5c1;
}

.level-info {
    font-size: 1.3em;
    font-weight: bold;
    color: #c9a84c;
}

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

.scenario-panel, .chat-panel {
    background: rgba(15, 15, 25, 0.8);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(201, 168, 76, 0.1);
}

.scenario-panel h3, .chat-panel h3 {
    color: #c9a84c;
    margin-bottom: 15px;
    font-size: 1.2em;
    letter-spacing: 2px;
}

#scenario-text {
    line-height: 1.8;
    color: #c8bda8;
    margin-bottom: 20px;
    font-size: 1.05em;
}

.hint-box {
    background: rgba(201, 168, 76, 0.08);
    border-left: 3px solid #c9a84c;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-top: 15px;
}

.hint-box strong {
    color: #c9a84c;
}

.hint-box span {
    color: #a89878;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(10, 10, 18, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(201, 168, 76, 0.08);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(201, 168, 76, 0.3);
    border-radius: 3px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 10px;
    max-width: 85%;
    line-height: 1.7;
    animation: slideIn 0.3s ease-out;
    white-space: pre-line;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.message.user {
    background: rgba(201, 168, 76, 0.15);
    color: #e0d5c1;
    margin-left: auto;
    text-align: right;
    border: 1px solid rgba(201, 168, 76, 0.2);
}

.message.ai {
    background: rgba(30, 30, 50, 0.8);
    color: #c8bda8;
    border: 1px solid rgba(100, 100, 120, 0.2);
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 12px;
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    resize: none;
    min-height: 60px;
    background: rgba(10, 10, 18, 0.6);
    color: #e0d5c1;
}

#user-input:focus {
    outline: none;
    border-color: #c9a84c;
    box-shadow: 0 0 10px rgba(201, 168, 76, 0.15);
}

#user-input::placeholder {
    color: #5a5548;
}

.btn-send {
    background: linear-gradient(135deg, #c9a84c, #a08030);
    color: #1a1a2e;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-send:hover {
    box-shadow: 0 0 15px rgba(201, 168, 76, 0.4);
}

.btn-send:disabled {
    background: #3a3a3a;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}

.action-panel {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding-top: 20px;
    border-top: 1px solid rgba(201, 168, 76, 0.15);
}

.btn-complete {
    background: linear-gradient(135deg, #c9a84c, #a08030);
    color: #1a1a2e;
    border: none;
    padding: 15px 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s;
    letter-spacing: 2px;
}

.btn-complete:hover {
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
    transform: scale(1.05);
}

.btn-secondary {
    background: rgba(100, 100, 120, 0.3);
    color: #8a7d6b;
    border: 1px solid rgba(100, 100, 120, 0.3);
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(100, 100, 120, 0.5);
    color: #e0d5c1;
}

.btn-primary {
    background: linear-gradient(135deg, #c9a84c, #a08030);
    color: #1a1a2e;
    border: none;
    padding: 15px 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: rgba(20, 20, 30, 0.98);
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease-out;
    border: 1px solid rgba(201, 168, 76, 0.2);
}

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

.modal-content.celebration {
    text-align: center;
}

.modal-content.celebration h2 {
    color: #c9a84c;
    font-size: 2.2em;
    margin-bottom: 20px;
    letter-spacing: 3px;
}

.modal-content.celebration p {
    font-size: 1.1em;
    color: #8a7d6b;
    margin-bottom: 30px;
}

.modal-content.celebration button {
    margin: 10px;
}

.modal-content h3 {
    color: #c9a84c;
    margin-bottom: 15px;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #5a5548;
    cursor: pointer;
}

.close:hover {
    color: #c9a84c;
}

.chapter-text {
    line-height: 2;
    color: #c8bda8;
    font-size: 1.05em;
    white-space: pre-line;
    background: rgba(10, 10, 18, 0.5);
    padding: 20px;
    border-radius: 10px;
    border-left: 3px solid #c9a84c;
}

@media (max-width: 768px) {
    .game-content {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.6em;
    }

    .levels-grid {
        grid-template-columns: 1fr;
    }
}
