:root {
    --primary-bg: #F0F2F5; /* Light grey background */
    --chat-bg: #FFFFFF; /* White chat background */
    --gf-bubble: #FEE500; /* Kakao yellow for GF */
    --player-bubble: #B2EBFB; /* Light blue for player */
    --text-color: #1A1A1A;
    --border-color: #E0E0E0;
    --header-bg: #FFFFFF;
    --option-btn-bg: #F0F0F0;
    --option-btn-hover: #E0E0E0;
    --game-win-color: #28A745; /* Green for win */
    --game-lose-color: #DC3545; /* Red for lose */
    --font-family: 'Noto Sans KR', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--primary-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    color: var(--text-color);
}

.game-container {
    width: 100%;
    max-width: 400px;
    height: 90vh; /* Make it feel like a phone screen */
    background-color: var(--chat-bg);
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    padding: 15px 20px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    font-size: 1.2em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}

#gf-status {
    font-size: 0.9em;
    font-weight: 500;
    color: #666;
}

.chat-messages {
    flex-grow: 1;
    padding: 10px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Scrollbar styles for modern browsers */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 5px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

.message-gf {
    align-self: flex-start;
    background-color: var(--gf-bubble);
    border-bottom-left-radius: 2px; /* Pointy bubble effect */
}

.message-player {
    align-self: flex-end;
    background-color: var(--player-bubble);
    border-bottom-right-radius: 2px; /* Pointy bubble effect */
}

.player-options {
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    background-color: var(--header-bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-button {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--option-btn-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-family: var(--font-family);
    font-size: 1em;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    text-align: left;
}

.option-button:hover {
    background-color: var(--option-btn-hover);
    border-color: #B0B0B0;
}

.option-button:disabled {
    background-color: #EFEFEF;
    color: #999;
    cursor: not-allowed;
    border-color: #E0E0E0;
}

.restart-button:hover {
    filter: brightness(0.9);
}

/* --- Story Submission Modal Styles --- */

.story-submit-container {
    text-align: center;
}

#open-story-modal {
    background: none;
    border: none;
    color: var(--secondary-text-color, #666);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9em;
    padding: 5px;
}
.game-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background-color: var(--header-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.restart-button {
    width: 100%;
    padding: 12px 15px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 1em;
    cursor: pointer;
    display: none; /* Hidden by default */
    transition: background-color 0.2s;
}

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

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2em;
    line-height: 1;
    cursor: pointer;
    color: #aaa;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
}

.modal-content p {
    margin-bottom: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

#story-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#story-form label {
    font-weight: 500;
    font-size: 0.9em;
}

#story-form textarea, #story-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 1em;
}

#story-form textarea {
    resize: vertical;
}

.submit-button {
    padding: 12px 15px;
    background-color: var(--gf-bubble);
    border: none;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-button:hover {
    filter: brightness(0.95);
}