@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@400;600;800&family=Righteous&display=swap');

:root { --primary: #4f46e5; --primary-light: #6366f1; --primary-hover: #4338ca; --bg-color: #f8fafc; --panel-bg: #ffffff; --text-main: #1e293b; --text-muted: #64748b; --border: #e2e8f0; --success: #10b981; --danger: #ef4444; }
body { font-family: 'Pretendard', sans-serif; background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%); color: var(--text-main); display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; height: auto; margin: 0; padding: 40px 0; overflow-y: auto; box-sizing: border-box; }
.panel { background: var(--panel-bg); padding: 30px; border-radius: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.08), 0 0 0 1px rgba(255,255,255,0.5) inset; width: 650px; box-sizing: border-box; transition: all 0.3s ease; }
#login-screen { width: 420px; text-align: center; }

.logo-area { margin-bottom: 30px; }
.logo-area h1 { margin: 0; font-size: 32px; background: linear-gradient(135deg, var(--primary), #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-family: 'Righteous', sans-serif; font-weight: 400; line-height: 1.2; letter-spacing: 1px; }
.logo-area .logo-sub { font-size: 22px; margin-top: 5px; }
.logo-area p { margin: 10px 0 0; color: var(--text-muted); font-size: 14px; }

.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.4s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.form-group { display: flex; flex-direction: column; gap: 12px; }
.form-group label { font-size: 14px; font-weight: 600; color: var(--text-main); text-align: left; }
input { padding: 14px; border: 2px solid var(--border); border-radius: 12px; font-size: 15px; outline: none; transition: all 0.3s ease; font-family: inherit; background: #fcfcfc;}
input:focus { border-color: var(--primary-light); background: white; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); }
#nickname-input { font-size: 16px; font-weight: 600; text-align: center; letter-spacing: 0.5px; padding: 16px; transition: all 0.3s ease; }
#nickname-input::placeholder { color: #94a3b8; font-weight: 400; letter-spacing: normal; }
#nickname-input:focus { color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99, 102, 241, 0.12); border-color: var(--primary); }
button { padding: 14px 20px; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; font-family: inherit;}
button:active { transform: translateY(2px) !important; }
.primary-btn { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3); }
.primary-btn:hover { box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4); transform: translateY(-2px); }
.secondary-btn { background-color: white; border: 2px solid var(--border); color: var(--text-main); }
.secondary-btn:hover { background-color: #cbd5e1; }
.small-btn { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.header-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 2px solid var(--bg-color); padding-bottom: 15px;}
.header-info h2 { margin: 0; font-size: 20px; }
.user-badge { background: var(--bg-color); padding: 6px 14px; border-radius: 20px; font-size: 14px; font-weight: 600; color: var(--primary); }
.room-status { font-size: 13px; font-weight: 800; color: var(--primary); background: #e0e7ff; padding: 4px 10px; border-radius: 12px;}

.split-layout { display: flex; gap: 20px; }
.main-area { flex: 1.5; display: flex; flex-direction: column; gap: 15px; }
.side-area { flex: 1; display: flex; flex-direction: column; gap: 15px; }

.user-list-box, .room-list-box { background: var(--bg-color); border-radius: 12px; padding: 15px; flex: 1; display: flex; flex-direction: column; }
.user-list-box h3, .room-header h3 { margin: 0 0 10px 0; font-size: 14px; color: var(--text-muted); }
.room-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.room-header h3 { margin: 0; }

#lobby-user-list { list-style: none; padding: 0; margin: 0; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
#lobby-user-list li { background: white; padding: 8px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }

.room-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; max-height: 400px; }
.room-list li { background: white; padding: 12px; border-radius: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); display: flex; justify-content: space-between; align-items: center; font-size: 14px; border: 2px solid transparent; transition: all 0.2s ease; }
.room-list li:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.05); border-color: rgba(99, 102, 241, 0.3); }
.room-info { display: flex; flex-direction: column; gap: 4px; }
.room-list li .room-name { font-weight: 700; color: var(--text-main); font-size: 15px;}
.room-list li .room-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; align-items: center;}
.status-badge { padding: 3px 6px; border-radius: 4px; font-size: 11px; font-weight: 800; }
.status-playing { background: #fee2e2; color: #ef4444; }
.status-waiting { background: #d1fae5; color: #10b981; }

.room-settings-preview { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.preview-badge { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border); }

.ready-btn { background-color: var(--bg-color); color: var(--text-muted); border: 2px solid var(--border); width: 100px; }
.ready-btn.is-ready { background-color: var(--success); color: white; box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3); }

.game-rules-display { display: flex; gap: 8px; margin-bottom: 15px; justify-content: center; flex-wrap: wrap; }
.rule-badge { background: white; color: var(--primary); padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 700; border: 1px solid #c7d2fe; box-shadow: 0 2px 5px rgba(0,0,0,0.02);}
.opponent-badge { background: #fef08a; color: #854d0e; border-color: #fde047; } /* AI/사람 뱃지 특수색 */

.in-game-users-box { display: flex; gap: 8px; justify-content: center; margin-bottom: 15px; flex-wrap: wrap; background: white; padding: 12px; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.in-game-user-chip { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; background: var(--bg-color); padding: 6px 12px; border-radius: 20px; color: var(--text-muted); }
.in-game-user-chip.is-me { background: #e0e7ff; color: var(--primary); border: 1px solid #c7d2fe; }

/* --- 단어 흔적 (Trace) 디자인 --- */
.word-trace-container { background: #f8fafc; padding: 12px; border-radius: 12px; margin-bottom: 15px; overflow-x: auto; white-space: nowrap; border: 1px solid var(--border); }
.word-trace-container::-webkit-scrollbar { height: 6px; }
.word-trace-container::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 10px; }
.trace-scroll { display: inline-block; font-size: 15px; font-weight: 800; }
.trace-word { background: white; color: var(--primary); padding: 4px 12px; border-radius: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin: 0 2px; display: inline-block; border: 1px solid #e0e7ff; }
.trace-arrow { color: #94a3b8; font-size: 14px; margin: 0 6px; vertical-align: middle; }

.glass-select { padding: 8px 10px; border-radius: 8px; border: 2px solid var(--border); font-size: 13px; outline: none; background: white; cursor: pointer; font-family: inherit;}
.glass-select:disabled { background-color: #e2e8f0; cursor: not-allowed; color: #64748b; }
.type-select { width: 95px; border-color: var(--primary); color: var(--primary); font-weight: 600;}
.opponent-select { font-weight: 800; border-color: #f59e0b; color: #b45309; }

.timer-container { margin-bottom: 15px; background: var(--bg-color); padding: 10px; border-radius: 12px;}
.timer-text { font-size: 13px; font-weight: 600; margin-bottom: 5px; text-align: center; color: var(--danger);}
.timer-bar { height: 8px; background: #cbd5e1; border-radius: 4px; overflow: hidden; }
.timer-fill { height: 100%; background: linear-gradient(90deg, #f59e0b, var(--danger)); width: 100%; transition: width 1s linear; }

.chat-history { background: var(--bg-color); border-radius: 12px; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; height: 320px; }
.game-history-tall { height: 260px; } /* 흔적창이 생겨서 살짝 줄임 */
.chat-history::-webkit-scrollbar { width: 8px; }
.chat-history::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 10px; }

.msg-item { padding: 12px 16px; max-width: 80%; font-size: 14px; line-height: 1.4; word-break: break-all; animation: fadeIn 0.2s ease-out;}
.chat-msg { background-color: white; align-self: flex-start; border-radius: 16px 16px 16px 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);}
.my-chat-msg { background-color: #fef08a; align-self: flex-end; border-radius: 16px 16px 4px 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);}
.game-msg { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; align-self: center; font-weight: 800; font-size: 15px; padding: 10px 24px; border-radius: 30px; box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3); }
.system-msg { background-color: rgba(0,0,0,0.04); padding: 6px 12px; border-radius: 12px; color: var(--text-muted); font-size: 12px; align-self: center; text-align: center; font-weight: 600; }

.input-area { display: flex; gap: 8px; }
.input-area input { flex: 1; }
.turn-alert { text-align: center; padding: 12px; border-radius: 12px; margin-bottom: 15px; font-weight: 800; font-size: 14px; background: #fef3c7; color: #d97706; }
.my-turn { background: #d1fae5; color: #047857; }
.spectator-turn { background: #e2e8f0; color: #475569; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 35px; border-radius: 24px; width: 420px; box-shadow: 0 25px 50px rgba(0,0,0,0.2); animation: fadeIn 0.3s ease-out; max-height: 90vh; overflow-y: auto; }
.modal-content h2 { margin-top: 0; font-size: 20px; color: var(--primary); border-bottom: 2px solid var(--bg-color); padding-bottom: 15px; }
.modal-options { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 20px 0; }
.option-group { display: flex; flex-direction: column; gap: 5px; }
.option-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }

/* 테마(주제) 선택 디자인 */
.theme-list-box { border: 2px solid var(--border); border-radius: 8px; height: 110px; overflow-y: auto; padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: #f8fafc; }
.theme-item { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; color: var(--text-main); }

/* 모음 퀴즈 힌트 디자인 */
.quiz-hint-group { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; margin: 0 4px; vertical-align: bottom; }
.quiz-hint-ox { font-size: 12px; font-weight: 900; margin-bottom: 3px; }
.quiz-hint-ox.ox-o { color: var(--success); }
.quiz-hint-ox.ox-x { color: var(--danger); }
/* 사이트 안내 푸터 (게임 화면 하단) */
body { flex-wrap: wrap; align-content: flex-start; }
.site-foot { flex: 0 0 100%; margin: 28px auto 0; padding: 18px 20px 4px; max-width: 650px; box-sizing: border-box; border-top: 1px solid var(--border); text-align: center; }
.site-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-bottom: 8px; }
.site-foot a { font-size: 12px; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.site-foot a:hover { color: var(--primary); text-decoration: underline; }
