  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');
  
  :root {
    --gap: 1.2rem;
    --radius: 12px;
    --primary: #D63031;
    --primary-light: #FF6B6B;
    --primary-dark: #A52A2A;
    --secondary: #0984e3;
    --accent: #FD79A8;
    --bg: linear-gradient(135deg, #f8f9ff 0%, #fff5f5 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --border: rgba(214, 48, 49, 0.2);
    --shadow: 0 8px 32px rgba(214, 48, 49, 0.1);
    --shadow-hover: 0 12px 40px rgba(214, 48, 49, 0.15);
    --korean-pattern: url("data:image/svg+xml,%3csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3e%3cg fill='none' fill-rule='evenodd'%3e%3cg fill='%23D63031' fill-opacity='0.03'%3e%3cpath d='M30 0c16.569 0 30 13.431 30 30s-13.431 30-30 30S0 46.569 0 30 13.431 0 30 0zm0 10c11.046 0 20 8.954 20 20s-8.954 20-20 20-20-8.954-20-20 8.954-20 20-20z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e");
  }

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

  body {
    font-family: 'Noto Sans KR', system-ui, sans-serif;
    background: var(--bg);
    background-image: var(--korean-pattern);
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
    animation: fadeIn 1s ease-out;
  }

  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes slideInFromLeft {
    from { 
      opacity: 0;
      transform: translateX(-30px);
    }
    to { 
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes slideInFromRight {
    from { 
      opacity: 0;
      transform: translateX(30px);
    }
    to { 
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes bounceIn {
    0% { 
      opacity: 0;
      transform: scale(0.3);
    }
    50% { 
      opacity: 1;
      transform: scale(1.05);
    }
    70% { 
      transform: scale(0.9);
    }
    100% { 
      opacity: 1;
      transform: scale(1);
    }
  }

  @keyframes pulse {
    0%, 100% { 
      transform: scale(1);
      box-shadow: 0 0 0 0 rgba(214, 48, 49, 0.4);
    }
    50% { 
      transform: scale(1.05);
      box-shadow: 0 0 0 10px rgba(214, 48, 49, 0);
    }
  }

  @keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
  }

  @keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
  }

  #left-panel {
    width: 780px;
    min-width: 780px;
    max-width: 600px;
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    animation: slideInFromLeft 0.8s ease-out;
  }

  #right-panel {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    animation: slideInFromRight 0.8s ease-out;
  }

  h1 {
    margin: 0 0 2rem;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    position: relative;
    animation: bounceIn 1s ease-out 0.3s both;
  }

  #chatbox {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--gap);
    overflow-y: auto;
    min-height: 100px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
    backdrop-filter: blur(5px);
  }

  .msg {
    margin-bottom: 1rem;
    line-height: 1.6;
    word-wrap: break-word;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-left: 4px solid var(--primary);
    animation: slideInFromLeft 0.5s ease-out;
    transition: all 0.3s ease;
  }

  .msg:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
  }

  .msg strong {
    color: var(--primary);
    font-weight: 600;
  }

  .msg img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin-top: 0.8rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
  }

  .msg img:hover {
    transform: scale(1.02);
  }

  .selection-container {
    width: 100%;
    margin-bottom: 1.2rem;
    padding: 1.2rem;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    animation: bounceIn 0.8s ease-out 0.5s both;
  }

  .selection-container:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
  }

  .selection-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1rem;
  }

  .selection-group:last-child {
    margin-bottom: 0;
  }

  .selection-group strong {
    font-size: 1rem;
    font-weight: 600;
    margin-right: 0.8rem;
    color: var(--text-primary);
    position: relative;
  }

  .selection-group strong::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
    border-radius: 1px;
  }

  .selection-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid var(--border);
    border-radius: 25px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }

  .selection-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
  }

  .selection-btn:hover::before {
    left: 100%;
  }

  .selection-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
  }

  .selection-btn.selected {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-color: var(--primary);
    color: white;
    font-weight: 600;
    animation: pulse 2s infinite;
    box-shadow: var(--shadow-hover);
  }

  form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    max-width: 600px;
    animation: slideInFromLeft 0.8s ease-out 0.7s both;
  }

  .selection-group input {
    flex: 1;
    min-width: 0;
  }

  input#userInput {
    flex: 1;
    width: auto;
    min-width: 0;
    padding: 1rem 1.2rem;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
  }

  input#userInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(214, 48, 49, 0.1);
    transform: translateY(-1px);
  }

  button {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }

  button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
  }

  button:hover::before {
    left: 100%;
  }

  button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
  }

  button:active {
    transform: translateY(0);
  }

  button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
  }

  button:disabled:hover {
    transform: none;
    box-shadow: none;
  }

  #preview-area {
    width: 100%;
    padding: 0 0.8rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
  }

  #preview-area img {
    max-height: 100px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
  }

  #preview-area img:hover {
    transform: scale(1.05);
  }

  #preview-area button#remove-preview-btn {
    background: var(--primary);
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 0.3rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
  }

  #preview-area button#remove-preview-btn:hover {
    background: var(--primary-dark);
    transform: rotate(90deg);
  }

  #form-controls {
    display: flex;
    gap: 0.8rem;
    width: 100%;
    align-items: center;
    margin-bottom: 1.5rem;
    min-width: 0;
  }

  #captionInput {  
    padding-right: 3rem; 
    position: relative; /* 추가해도 무방 */
    z-index: 2;
    flex: 1;
    width: 100%;
    display: block;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5rem;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    padding: 1rem;
    resize: none;
    overflow-y: hidden;
    max-height: calc(1.5rem * 6);
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    padding-right: 3rem;
  }

  #captionInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(214, 48, 49, 0.1);
    transform: translateY(-1px);
  }

  #sttBtn, #generateImageBtn, #addFileBtn {
    width: 3rem;
    height: 3rem;
    font-size: 1.2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  #generateImageBtn {
    background: linear-gradient(135deg, var(--secondary), #74b9ff);
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.5rem;
  }

  #addFileBtn {
    background: linear-gradient(135deg, var(--secondary), #74b9ff);
    width: 3.5rem;              /* 🚀 버튼과 동일하게 */
    height: 3.5rem;
    font-size: 2rem;            /* + 아이콘 크게 */
    line-height: 1;             /* 정렬 보정 */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  }

    #sttBtn {
    z-index: 3;
    background: none;
    color: var(--dark-gray);
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%); /* 세로 중앙 정렬 */
    }


  #extras {
    width: 100%;
    max-width: 780px;
    margin: 0 auto; /* 가운데 정렬 */
  }


  #extras button:hover {
    background: linear-gradient(135deg, var(#ff85c1), #ff85c1);
    color: white; /* 글자색 반전 */
    border-color: transparent;
  }

  @media (max-width: 999px) {
    body {
      flex-direction: column-reverse;
      align-items: center;
    }

    #left-panel {
      width: 780px !important;
      max-width: 100%;
      height: auto !important;
      border-right: none;
      border-top: 1px solid var(--border);
    }

    #right-panel {
      width: 780px !important;
      max-width: 100%;
      height: 60vh !important;
      max-height: 70vh !important;
    }
  }

  body.stacked {
    flex-direction: column-reverse;
    align-items: center;
  }

  body.stacked #left-panel {
    width: 780px !important;
    max-width: 100%;
    height: auto !important;
    border-right: none;
    border-top: 1px solid var(--border);
  }

  body.stacked #right-panel {
    width: 780px !important;
    max-width: 100%;
    height: 60vh !important;
    max-height: 70vh !important;
  }

  .prompt-details {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    margin-top: 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    overflow: hidden;
    transition: all 0.3s ease;
  }

  .prompt-details:hover {
    box-shadow: var(--shadow);
  }

  .prompt-details summary {
    padding: 1rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    color: var(--primary);
    background: linear-gradient(135deg, rgba(214, 48, 49, 0.05), rgba(253, 121, 168, 0.05));
    transition: all 0.3s ease;
    position: relative;
  }

  .prompt-details summary::after {
    content: '▼';
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
  }

  .prompt-details[open] summary::after {
    transform: translateY(-50%) rotate(180deg);
  }

  .prompt-details summary:hover {
    background: linear-gradient(135deg, rgba(214, 48, 49, 0.1), rgba(253, 121, 168, 0.1));
  }

  .prompt-details .prompt-content {
    padding: 1.2rem;
    border-top: 1px solid var(--border);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
    white-space: pre-wrap;
    line-height: 1.6;
  }

  body.mobile {
    flex-direction: column-reverse;
    align-items: center;
  }

  body.mobile #left-panel {
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 1rem;
  }

  body.mobile #right-panel {
    width: 100%;
    height: 60vh;
    max-height: 70vh;
    padding: 1rem;
  }

  body.mobile #chatbox {
    max-height: 100%;
    overflow-y: auto;
  }

  /* 로딩 애니메이션 */
  .loading {
    position: relative;
    overflow: hidden;
  }

  .loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -200px;
    width: 200px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
  }

  /* 성공 애니메이션 */
  .success-flash {
    animation: successFlash 0.6s ease-out;
  }

  @keyframes successFlash {
    0% { background-color: rgba(0, 184, 148, 0.1); }
    50% { background-color: rgba(0, 184, 148, 0.3); }
    100% { background-color: transparent; }
  }

  /* 스크롤바 스타일링 */
  ::-webkit-scrollbar {
    width: 8px;
  }

  ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
  }

  ::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 4px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  }

  /* 포커스 지시자 */
  .focus-indicator {
    position: relative;
  }

  .focus-indicator::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid var(--primary);
    border-radius: calc(var(--radius) + 2px);
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .focus-indicator:focus-within::after {
    opacity: 1;
  }

  /* 한국 전통 패턴 장식 */
  .korean-decoration {
    position: relative;
  }

  .korean-decoration::before {
    content: '◆';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    opacity: 0.3;
    font-size: 0.8rem;
  }
  #chat-form {
    width: 100%;
    max-width: 780px;
    margin: 0 auto; /* 가운데 정렬 */
  }
#extras {
  display: flex;
  gap: 0.5rem; /* 버튼 사이 간격 */
  margin-top: 1rem;
}

#extras button {
  flex: 1; /* 버튼을 동일 비율로 분배 */
  font-size: 1rem;
  border-radius: 0.5rem;
  white-space: nowrap; /* 한 줄 유지 */
  overflow: hidden;
  text-overflow: ellipsis; /* 너무 길면 ... 처리 */
}
.title-icon {
  width: 2rem;
  height: 2rem;
  margin-right: 0.5rem;
  vertical-align: middle;
  animation: float 3s ease-in-out infinite;
}