* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, 'Pretendard', 'Noto Sans KR', sans-serif;
  background: #f0f2f5;
  color: #222;
  min-height: 100vh;
}

/* 인증 페이지 */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.auth-card h1 { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: #888; font-size: 0.85rem; margin-bottom: 24px; }
.auth-card label { display: block; font-size: 0.8rem; font-weight: 600; color: #555; margin: 16px 0 6px; }
.auth-card input {
  width: 100%; padding: 12px 14px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 0.95rem; outline: none; transition: border 0.15s;
}
.auth-card input:focus { border-color: #4a90d9; }
.auth-card button {
  width: 100%; padding: 12px; background: #4a90d9; color: #fff; border: none;
  border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  margin-top: 20px; transition: background 0.15s;
}
.auth-card button:hover { background: #3a7bc8; }
.err { color: #e44; font-size: 0.8rem; margin-top: 10px; text-align: center; }
.guide { text-align: center; color: #555; font-size: 0.85rem; line-height: 1.5; margin-bottom: 16px; }
#qrWrap { text-align: center; margin-bottom: 12px; }
#qrWrap img { width: 200px; height: 200px; }
.secret-text { text-align: center; font-size: 0.75rem; color: #999; margin-bottom: 16px; word-break: break-all; }
.secret-text code { background: #f0f0f0; padding: 2px 6px; border-radius: 4px; }

/* 스튜디오 레이아웃 */
.studio-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.studio-wrap header {
  background: #fff; border-bottom: 1px solid #e0e0e0; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.studio-wrap header h1 { font-size: 1.15rem; font-weight: 700; }
.btn-logout {
  background: none; border: 1px solid #ddd; border-radius: 6px;
  padding: 6px 14px; font-size: 0.8rem; color: #666; cursor: pointer;
}
.btn-logout:hover { background: #f0f0f0; }
.btn-back {
  text-decoration: none; border: 1px solid #4a90d9; border-radius: 6px;
  padding: 6px 14px; font-size: 0.8rem; color: #4a90d9; margin-right: 8px;
}
.btn-back:hover { background: #f0f6ff; }

/* 패널 */
.panels {
  flex: 1; padding: 16px; max-width: 800px; margin: 0 auto; width: 100%;
  display: flex; flex-direction: column; gap: 12px;
}
.panel {
  background: #fff; border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06); overflow: hidden;
}
.panel h2 {
  font-size: 0.9rem; font-weight: 700; padding: 14px 16px;
  background: #fafafa; border-bottom: 1px solid #eee; color: #333;
}
.panel-body { padding: 16px; }
.panel-body input[type="text"],
.panel-body input[type="password"],
.panel-body textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 0.88rem; outline: none; margin-bottom: 8px; font-family: inherit;
  transition: border 0.15s;
}
.panel-body input:focus,
.panel-body textarea:focus { border-color: #4a90d9; }
.panel-body textarea { resize: vertical; line-height: 1.6; }
.panel-body label { display: block; font-size: 0.78rem; font-weight: 600; color: #666; margin: 10px 0 4px; }

.input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.input-row input { flex: 1; margin-bottom: 0; }
.input-row button {
  padding: 10px 18px; background: #4a90d9; color: #fff; border: none;
  border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.input-row button:hover { background: #3a7bc8; }
.input-row button:disabled { background: #aaa; cursor: not-allowed; }

.panel-note { font-size: 0.75rem; color: #999; margin-bottom: 10px; }

.btn-gen {
  width: 100%; padding: 11px; background: #5b6abf; color: #fff; border: none;
  border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.btn-gen:hover { background: #4a5aae; }
.btn-gen:disabled { background: #aaa; cursor: not-allowed; }

.progress {
  text-align: center; color: #4a90d9; font-size: 0.85rem;
  padding: 12px; background: #f0f6ff; border-radius: 8px; margin: 8px 0;
}

.todo-msg {
  text-align: center; color: #bbb; font-size: 0.9rem;
  padding: 30px 0; line-height: 1.6;
}

/* 업로드 영역 */
.upload-area {
  border: 2px dashed #ddd; border-radius: 10px; padding: 20px;
  text-align: center; cursor: pointer; position: relative; margin-bottom: 8px;
  transition: border-color 0.15s;
}
.upload-area:hover { border-color: #4a90d9; }
.upload-area input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
}
.upload-area p { color: #999; font-size: 0.85rem; pointer-events: none; }

/* 클립 목록 */
.clip-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.clip-item {
  display: flex; align-items: center; gap: 10px;
  background: #fafafa; border-radius: 8px; padding: 8px 10px;
}
.clip-thumb {
  width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: #ddd;
}
.clip-info { flex: 1; min-width: 0; }
.clip-name {
  display: block; font-size: 0.8rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.clip-meta { font-size: 0.72rem; color: #999; }
.clip-del {
  background: none; border: 1px solid #ddd; border-radius: 6px;
  padding: 4px 10px; font-size: 0.75rem; color: #e44; cursor: pointer;
}
.clip-del:hover { background: #fee; }

/* 제품 미리보기 */
.prod-preview { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.prod-preview img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.prod-preview span { font-size: 0.85rem; font-weight: 600; }

/* 설정 */
.settings-main { flex: 1; padding: 16px; max-width: 600px; margin: 0 auto; width: 100%; }
.settings-card {
  background: #fff; border-radius: 12px; padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.settings-card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.settings-desc { font-size: 0.8rem; color: #888; margin-bottom: 20px; }
.key-group { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid #f0f0f0; }
.key-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.key-group label { font-size: 0.85rem; font-weight: 600; color: #333; margin-bottom: 8px; display: block; }
.key-row { display: flex; gap: 8px; }
.key-row input {
  flex: 1; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 0.85rem; outline: none;
}
.key-row button {
  padding: 10px 18px; background: #4a90d9; color: #fff; border: none;
  border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.key-row button:hover { background: #3a7bc8; }
.key-status { font-size: 0.75rem; color: #999; margin-top: 4px; display: inline-block; }
.key-status.set { color: #2a9d2a; }
.key-desc { font-size: 0.72rem; color: #aaa; margin-top: 4px; }

/* 푸터 */
.studio-wrap footer {
  background: #fafafa; border-top: 1px solid #e0e0e0;
  padding: 12px; text-align: center;
}
.notice { font-size: 0.7rem; color: #999; }

/* 스크립트/제목 영역 */
.script-area, .title-area { margin-top: 12px; }
.tts-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.btn-tts {
  padding: 8px 16px; background: #e67e22; color: #fff; border: none;
  border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.btn-tts:hover { background: #d35400; }
.btn-tts:disabled { background: #aaa; cursor: not-allowed; }
.tts-row audio { flex: 1; height: 36px; }
.btn-find-voice {
  background: #eee; border: 1px solid #ddd; border-radius: 4px;
  padding: 2px 8px; font-size: 0.72rem; cursor: pointer; color: #555;
}
.btn-find-voice:hover { background: #ddd; }
