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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #CBBAED 0%, #D6D6B1 50%, #EF8354 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 900px;
}

.auth-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    margin: 0 auto;
}

.auth-box h1 {
    text-align: center;
    color: #386150;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: #EF8354;
    color: white;
}

.auth-form input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: #386150;
}

.auth-form button {
    width: 100%;
    padding: 15px;
    background: #EF8354;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-form button:hover {
    background: #e36d3d;
}

.error-message {
    color: #e74c3c;
    text-align: center;
    margin-top: 10px;
    min-height: 20px;
}

.village-header {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.village-header h1 {
    color: #386150;
}

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

.logout-btn:hover {
    background: #c0392b;
}

.village-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.village-intro {
    text-align: center;
    font-size: 1.2em;
    color: #666;
    margin-bottom: 30px;
}

.npc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.npc-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.npc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-color: #386150;
}

.npc-shape {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
}

.npc-shape.square {
    background: #0F0326;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Cig's angry eyes and eyebrows */
.npc-shape.square::before {
    content: '╲  ╱';
    position: absolute;
    color: white;
    font-size: 20px;
    font-weight: bold;
    top: 20px;
    letter-spacing: 8px;
}

/* Cig's frown */
.npc-shape.square::after {
    content: '⌢';
    position: absolute;
    color: white;
    font-size: 30px;
    top: 60px;
    transform: rotate(180deg);
}

.npc-shape.circle {
    background: #CBBAED;
    border-radius: 50%;
    position: relative;
}

/* Twila's gentle eyes */
.npc-shape.circle::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: #333;
    border-radius: 50%;
    top: 35px;
    left: 25px;
    box-shadow: 40px 0 0 #333;
}

/* Twila's warm smile */
.npc-shape.circle::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 20px;
    border: 3px solid #333;
    border-top: none;
    border-radius: 0 0 40px 40px;
    top: 55px;
    left: 30px;
}

.npc-shape.triangle {
    width: 100px;
    height: 100px;
    position: relative;
    margin-left: auto;
    margin-right: auto;
}

/* Triangle base */
.npc-shape.triangle::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid #386150;
    top: 0;
    left: 0;
}

/* Slippy's confused eyes and wavy mouth */
.npc-shape.triangle::after {
    content: '◉ ◉\A  ～';
    position: absolute;
    font-size: 18px;
    color: white;
    top: 45px;
    left: 18px;
    letter-spacing: 18px;
    white-space: pre;
    line-height: 1.3;
}

.npc-card h2 {
    color: #333;
    margin-bottom: 10px;
}

.npc-description {
    color: #666;
    font-style: italic;
    margin-bottom: 15px;
}

.npc-stats {
    display: flex;
    justify-content: space-around;
    font-size: 0.9em;
    color: #999;
}

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

.modal.active {
    display: flex;
}

.chat-container {
    background: white;
    width: 90%;
    max-width: 600px;
    height: 80vh;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.chat-header {
    background: #386150;
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.close-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
    border-radius: 8px;
    cursor: pointer;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.message.npc {
    background: #EF8354;
    color: white;
    margin-right: auto;
}

.message.user {
    background: #e0e0e0;
    color: #333;
    margin-left: auto;
}

.message-sender {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-radius: 0 0 15px 15px;
    display: flex;
    gap: 10px;
}

.chat-input-container input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.chat-input-container input:focus {
    outline: none;
    border-color: #386150;
}

.chat-input-container button {
    padding: 12px 24px;
    background: #EF8354;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}

.chat-input-container button:hover {
    background: #e36d3d;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}