:root {
    --primary-color: #2c3e50;
    --secondary-color: #95a5a6;
    --accent-color: #e67e22;
    --bg-color: #ecf0f1;
    --slot-bg: #dfe6e9;
    --block-era: #3498db;
    --block-role: #2ecc71;
    --block-item: #9b59b6;
    --text-color: #2c3e50;
    --success-color: #27ae60;
    --fail-color: #c0392b;
}

body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

header h1 { margin: 0; color: var(--primary-color); }
header p { margin: 5px 0; color: var(--secondary-color); }

.game-layout {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 20px;
    flex-grow: 1;
    height: calc(100% - 120px);
}

/* 사이드바 블록 */
.sidebar {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.block-category h3 {
    font-size: 0.9rem;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 5px;
    margin-top: 15px;
}

.draggable-blocks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.block {
    padding: 8px 12px;
    border-radius: 6px;
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: grab;
    user-select: none;
    transition: transform 0.2s, opacity 0.2s;
}

.block:active { cursor: grabbing; }
.block.era { background-color: var(--block-era); }
.block.role { background-color: var(--block-role); }
.block.item { background-color: var(--block-item); }
.block.dragging { opacity: 0.5; transform: scale(0.95); }

/* 조립 영역 */
.assembly-area {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

.assembly-header {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.drop-zones {
    display: flex;
    gap: 20px;
}

.drop-zone {
    width: 140px;
    height: 140px;
    border: 3px dashed var(--secondary-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--slot-bg);
    transition: all 0.3s;
    position: relative;
}

.drop-zone.drag-over {
    border-color: var(--accent-color);
    background-color: #fff3e0;
}

.drop-zone .label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    pointer-events: none;
}

.drop-zone .block {
    width: 80%;
    text-align: center;
    cursor: default;
}

/* 인터뷰 섹션 */
.interview-section {
    background: #2d3436;
    color: #dfe6e9;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.interview-header {
    font-weight: bold;
    padding-bottom: 10px;
    border-bottom: 1px solid #636e72;
    margin-bottom: 10px;
    text-align: center;
}

.interview-log {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 5px;
}

.message {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    max-width: 90%;
    line-height: 1.4;
}

.message.system { background: #636e72; align-self: center; text-align: center; font-style: italic; font-size: 0.8rem; }
.message.question { background: #0984e3; align-self: flex-start; color: white; border-bottom-left-radius: 0; }
.message.answer { background: #fdcb6e; color: #2d3436; align-self: flex-end; border-bottom-right-radius: 0; font-weight: bold; }

.final-result {
    margin-top: 15px;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1rem;
    animation: pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.final-result.success { background: var(--success-color); color: white; }
.final-result.fail { background: var(--fail-color); color: white; }

.hidden { display: none; }

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.stamp-collection {
    width: 100%;
    border-top: 2px solid var(--bg-color);
    padding-top: 15px;
    margin-top: 20px;
}

.stamp-collection h3 {
    font-size: 1rem;
    text-align: center;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.stamp-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* 모달 스타일 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fdfaf0;
    padding: 30px;
    border-radius: 15px;
    width: 80%;
    max-width: 500px;
    border: 5px double #8d6e63;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #8d6e63;
}

#modal-body h2 {
    color: #5d4037;
    border-bottom: 2px solid #8d6e63;
    padding-bottom: 10px;
    margin-top: 0;
}

#modal-body p {
    line-height: 1.8;
    color: #3e2723;
}

.stamp {
    width: 80px;
    height: 80px;
    background: white;
    border: 2px solid var(--slot-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--secondary-color);
    text-align: center;
    padding: 5px;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
    cursor: not-allowed;
    transition: all 0.2s;
}

.stamp.collected {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: #fff3e0;
    box-shadow: 0 4px 8px rgba(230, 126, 34, 0.2);
    cursor: pointer;
}

.stamp.collected:hover {
    transform: scale(1.1) rotate(5deg);
    background: #ffe0b2;
}

.stamp.collected::after {
    content: '★';
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes stamp-active {
    0% { transform: scale(2); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.stamp.new-stamp {
    animation: stamp-active 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
