  :root{
    --paper:#F6F3EC;
    --panel:#FFFFFF;
    --line:#E3DDCF;
    --line-strong:#CFC6AE;
    --ink:#33352F;
    --ink-soft:#6B6A5E;
    --ink-mute:#9B9887;
    --sage:#5C7C64;
    --sage-dark:#3F5B47;
    --sage-tint:#E7EEE5;
    --clay:#C97B54;
    --clay-tint:#F4E3D6;
    --amber-tint:#FBF0DD;
    --amber-ink:#8A5A16;
    --radius:14px;
    --radius-sm:8px;
    --shadow:0 1px 2px rgba(51,53,47,0.06), 0 8px 24px rgba(51,53,47,0.05);
  }
  *{box-sizing:border-box;}
  body{
    margin:0;
    background:#EAE6DA;
    font-family:'Noto Sans KR', sans-serif;
    color:var(--ink);
    display:flex;
    flex-direction:column;
    align-items:center;
    min-height:100vh;
  }
  h1,h2,h3{font-family:'Noto Serif KR', serif; font-weight:500; margin:0;}

  .landing-screen { width: 100%; display: flex; flex-direction: column; align-items: center; padding: 0 20px; }
  .hero { text-align: center; padding: 80px 20px 60px; max-width: 640px; }
  .hero .logo-icon { font-size: 56px; margin-bottom: 16px; }
  .hero h1 { font-size: 32px; color: var(--sage-dark); margin-bottom: 12px; letter-spacing: -0.02em; }
  .hero .description { font-size: 16px; color: var(--ink-soft); line-height: 1.7; margin-bottom: 32px; }
  .hero-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
  .btn-large { padding: 14px 32px; border-radius: 999px; font-size: 15px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; border: none; text-decoration: none; display: inline-block; min-width: 140px; }
  .btn-primary-large { background: var(--sage); color: #fff; }
  .btn-primary-large:hover { background: var(--sage-dark); }
  .btn-outline-large { background: transparent; border: 1.5px solid var(--sage); color: var(--sage-dark); }
  .btn-outline-large:hover { background: var(--sage-tint); }

  .features { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; max-width: 960px; width: 100%; padding: 40px 20px 60px; }
  .feature-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; flex: 1 1 240px; max-width: 280px; text-align: center; box-shadow: var(--shadow); transition: transform 0.2s ease, box-shadow 0.2s ease; }
  .feature-card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(51,53,47,0.08); }
  .feature-icon { font-size: 32px; margin-bottom: 16px; }
  .feature-card h3 { font-size: 16px; margin-bottom: 8px; color: var(--ink); }
  .feature-card p { font-size: 13px; color: var(--ink-mute); line-height: 1.6; }
  .landing-footer { text-align: center; padding: 20px; font-size: 12px; color: var(--ink-mute); border-top: 1px solid var(--line); width: 100%; max-width: 960px; }

  .auth-screen { display: none; align-items: center; justify-content: center; width: 100%; min-height: 100vh; padding: 40px 20px; }
  .auth-card { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 24px; box-shadow: var(--shadow); padding: 48px 40px; width: 100%; max-width: 420px; text-align: center; }
  .auth-card .logo { font-family: 'Noto Serif KR', serif; font-size: 28px; color: var(--sage-dark); margin-bottom: 8px; }
  .auth-card .subtitle { font-size: 13px; color: var(--ink-mute); margin-bottom: 32px; }
  .input-group { margin-bottom: 16px; text-align: left; }
  .input-group label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 500; }
  .input-group input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: 'Noto Sans KR', sans-serif; font-size: 14px; color: var(--ink); background: var(--paper); transition: border 0.15s; }
  .input-group input:focus { outline: none; border-color: var(--sage); background: #fff; }
  .auth-btn { display: block; width: 100%; padding: 14px; background: var(--sage); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 500; cursor: pointer; margin: 24px 0 16px; transition: background 0.15s; }
  .auth-btn:hover { background: var(--sage-dark); }
  .extra-links { display: flex; justify-content: center; gap: 16px; font-size: 12.5px; color: var(--ink-soft); }
  .extra-links a { color: var(--ink-soft); text-decoration: none; cursor: pointer; }
  .extra-links a:hover { color: var(--sage-dark); text-decoration: underline; }
  .divider { margin: 20px 0; border-top: 1px solid var(--line); }
  .demo-hint { font-size: 11.5px; color: var(--ink-mute); margin-top: 8px; }
  .back-link { margin-top: 16px; font-size: 13px; color: var(--sage-dark); cursor: pointer; text-decoration: underline; }

  .agree-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; text-align: left; }
  .agree-item { display: flex; gap: 8px; margin-bottom: 10px; font-size: 13px; color: var(--ink-soft); }
  .agree-item input[type="checkbox"] { margin-top: 3px; }

  .app-layout { display: none; width: 100%; max-width: 1040px; gap: 36px; align-items: flex-start; margin: 0 auto; padding: 32px 40px 80px; }
  .app-layout.visible { display: flex; }

  /* 💻 컴퓨터(데스크톱) 사이드바: 고정형 세로 배치 구조 유지 (스크롤 원천 방지) */
  .sidebar { width: 200px; flex-shrink: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 14px; box-shadow: var(--shadow); position: sticky; top: 32px; overflow: visible; }
  .sidebar-title { font-family: 'Noto Serif KR', serif; font-size: 18px; font-weight: 500; color: var(--sage-dark); margin-bottom: 16px; padding-left: 6px; letter-spacing: -0.02em; }
  .sidebar .navchip { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-soft); font-size: 13px; margin-bottom: 2px; transition: all 0.15s ease; cursor: pointer; }
  .sidebar .navchip:hover { background: var(--sage-tint); border-color: var(--line); color: var(--sage-dark); }
  .sidebar .navchip.active { background: var(--sage); border-color: var(--sage); color: #fff; font-weight: 500; }

  .app-container { flex: 1; min-width: 0; }
  
  /* 💻 컴퓨터 콘텐츠 영역: 충분한 세로 공간 고정 */
  .screen { display: none; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 24px; box-shadow: var(--shadow); padding: 36px 40px 40px; min-height: 500px; overflow-y: auto; }
  .screen.active { display: block; }

  .app-header{ display:flex; align-items:center; gap:10px; margin-bottom:18px; }
  .app-header .back{ width:32px;height:32px;border-radius:50%; display:flex;align-items:center;justify-content:center; background:var(--panel);border:1px solid var(--line); cursor:pointer; font-size:16px; color:var(--ink-soft); flex-shrink:0; }
  .app-header .back:hover{ border-color:var(--sage); color:var(--sage-dark); }
  .app-header .title{ font-size:17px; font-weight:500; font-family:'Noto Serif KR', serif; }
  .app-header .sub{ font-size:12px; color:var(--ink-mute); margin-top:2px; }

  .card{ background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:16px; }
  .btn{ display:block; width:100%; padding:13px; border-radius:var(--radius-sm); border:1px solid var(--line-strong); background:var(--panel); color:var(--ink); font-family:'Noto Sans KR', sans-serif; font-size:13.5px; cursor:pointer; text-align:center; transition:all .15s ease; }
  .btn:hover{ border-color:var(--sage); background:var(--sage-tint); }
  .btn.primary{ background:var(--sage); border-color:var(--sage); color:#fff; }
  .btn.primary:hover{ background:var(--sage-dark); border-color:var(--sage-dark);}
  .btn.ghost{ border-color:transparent; color:var(--ink-soft); }
  .btn.ghost:hover{ background:var(--sage-tint); border-color:var(--line); }

  .menu-item{ display:flex; align-items:center; gap:14px; width:100%; padding:16px; border-radius:var(--radius); border:1px solid var(--line); background:var(--panel); cursor:pointer; text-align:left; margin-bottom:12px; transition:all .15s ease; }
  .menu-item:hover{ border-color:var(--sage); box-shadow:var(--shadow); }
  .menu-item .icon{ width:42px;height:42px;border-radius:10px; background:var(--sage-tint); color:var(--sage-dark); display:flex;align-items:center;justify-content:center; font-size:18px; flex-shrink:0; }
  .menu-item .txt .t{ font-size:14px; font-weight:500; }
  .menu-item .txt .s{ font-size:12px; color:var(--ink-mute); margin-top:3px; }

  .dots{ display:flex; justify-content:center; gap:6px; margin-bottom:16px;}
  .dot{ width:6px; height:6px; border-radius:50%; background:var(--line-strong);}
  .dot.on{ background:var(--sage); }

  .chip-row{ display:flex; gap:8px; }
  .mc-chip{ flex:1; text-align:center; padding:10px 6px; border:1px solid var(--line); border-radius:var(--radius-sm); font-size:12px; color:var(--ink-soft); cursor:pointer; background:var(--panel); transition: all 0.15s ease; }
  .mc-chip:hover{ border-color:var(--sage); background:var(--sage-tint); }
  .mc-chip.sel{ border-color:var(--sage); background:var(--sage-tint); color:var(--sage-dark); font-weight:500;}

  .bubble{ max-width:78%; padding:10px 14px; border-radius:14px; font-size:13px; line-height:1.5;}
  .bubble.bot{ background:var(--panel); border:1px solid var(--line); align-self:flex-start;}
  .bubble.me{ background:var(--sage); color:#fff; align-self:flex-end;}

  .footnote{ font-size:12px; color:var(--ink-mute); line-height:1.6; }

  .modal { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.3); align-items:center; justify-content:center; z-index:10; }
  .modal-content { background: var(--panel); border-radius: 20px; padding: 28px; max-width: 400px; width: 90%; box-shadow: 0 20px 40px rgba(0,0,0,0.1); }
  .calendar-modal-content { max-width: 500px; max-height: 80vh; overflow-y: auto; }

  .tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
  .tab { padding: 8px 14px; font-size: 13px; color: var(--ink-soft); cursor: pointer; border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: all 0.15s; background: transparent; }
  .tab:hover { background: var(--sage-tint); }
  .tab.active { background: var(--panel); border: 1px solid var(--line); border-bottom-color: var(--panel); font-weight: 500; color: var(--sage-dark); }

  .calendar-table { width: 100%; border-collapse: collapse; text-align: center; font-size: 13px; }
  .calendar-table th { padding: 8px; color: var(--ink-soft); font-weight: 400; }
  .calendar-table td { padding: 8px 4px; height: 48px; vertical-align: middle; border: 1px solid var(--line); color: var(--ink); }
  .calendar-table td .mood-sticker { font-size: 20px; display: block; }
  .calendar-table td.today { background: var(--sage-tint); }

  .art-slide-container { text-align: center; margin-bottom: 16px; }
  .art-slide-image { width: 100%; max-height: 380px; object-fit: contain; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
  .slide-controls { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 12px; font-size: 20px; color: var(--ink-soft); }
  .slide-controls span { cursor: pointer; user-select: none; padding: 4px 8px; border-radius: 8px; transition: background 0.15s; }
  .slide-controls span:hover { background: var(--sage-tint); }
  .art-info { margin-top: 12px; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
  .art-info strong { color: var(--ink); font-weight: 500; }

  .music-list { list-style: none; padding: 0; margin: 0; }
  .music-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--panel); cursor: pointer; transition: all 0.15s; }
  .music-item:hover { border-color: var(--sage); background: var(--sage-tint); }
  .music-item.playing { border-color: var(--sage); background: var(--sage-tint); }
  .music-item .play-icon { font-size: 18px; width: 24px; text-align: center; }
  .music-item .track-info { flex: 1; }
  .music-item .track-title { font-size: 14px; font-weight: 500; }
  .music-item .track-artist { font-size: 12px; color: var(--ink-mute); }
  .now-playing-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 12px; font-size: 13px; color: var(--sage-dark); }
  
  #chat.active {
  display: flex;
  flex-direction: column;
  height: 600px; /* 기존 screen의 min-height에 맞춰 고정 높이 부여 */
  }
  /* 📱 모바일 환경 최적화 미디어 쿼리 (768px 이하 해상도 전용) */
  @media (max-width: 768px) {
    .hero h1 { font-size: 26px; }
    .hero .description { font-size: 15px; }
    .features { gap: 16px; padding: 20px 10px 40px; }
    .feature-card { max-width: 100%; flex: 1 1 100%; }
    
    .app-layout { flex-direction: column; gap: 16px; padding: 12px; align-items: stretch; }
    .app-container { width: 100%; }

    /* 1. 모바일에서만 네비게이션 탭이 한 줄로 정렬되며, 화면이 넘칠 때 터치 스크롤 활성화 */
    .sidebar { 
      width: 100%; 
      position: static; 
      display: flex; 
      flex-wrap: nowrap;    /* 한 줄 강제 정렬 */
      overflow-x: auto;     /* 가로 스크롤 허용 */
      gap: 6px; 
      padding: 12px 16px; 
      background: var(--panel);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      -webkit-overflow-scrolling: touch; 
      scrollbar-width: none;     /* 파이어폭스 스크롤바 바 숨김 */
      -ms-overflow-style: none; /* IE, 에지 스크롤바 바 숨김 */
    }
    
    /* 크롬, 사파리 브라우저의 지저분한 가로 스크롤바를 숨겨서 완전한 앱 칩 형태로 노출시킵니다 */
    .sidebar::-webkit-scrollbar {
      display: none;
    }
    
    .sidebar-title { display: none; }
    
    .sidebar .navchip { 
      display: inline-block; 
      width: auto; 
      padding: 8px 14px; 
      font-size: 12px; 
      flex-shrink: 0;       /* 자물쇠 역할: 좁은 화면에서도 글자 찌그러짐 원천 방지 */
      margin-bottom: 0;
    }

    /* 로그아웃 버튼을 한 줄 배치 흐름에 맞게 정렬 처리 */
    .sidebar > div[style*="margin-top"] {
      margin-top: 0 !important;
      border-top: none !important;
      padding-top: 0 !important;
      display: inline-block;
      flex-shrink: 0;
    }

    /* 2. 모바일 기능화면 세로 배치 최적화 (불필요한 공백 제거) */
    .screen { 
      padding: 24px 20px; 
      border-radius: 20px; 
      min-height: auto;     /* 데스크톱용 600px 최소높이를 리셋하여 여백을 타이트하게 맞춰줍니다 */
    }
    
    .auth-card { padding: 32px 24px; }
   
    #chat.active {
    display: flex;
    flex-direction: column;
    /* 모바일 화면 높이(100vh)에서 상단 여백을 뺀 만큼 높이를 강제로 고정합니다 */
    height: calc(100vh - 120px); 
    min-height: 400px;
    }
  }
