:root {
    --bg-main: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.6);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent-primary: #334155;
    --accent-secondary: #475569;
    --border-color: rgba(15, 23, 42, 0.1);
    --glow-color: rgba(51, 65, 85, 0.05);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px; /* 헤더 높이를 고려한 여백 */
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 15% 50%, rgba(51, 65, 85, 0.03), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(71, 85, 105, 0.03), transparent 25%);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.app-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    animation: fadeInDown 0.8s ease-out;
}

.header-content h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #0f172a, #334155);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.05em;
}

.header-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

.navigation-bar {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.breadcrumb {
    font-size: 1.25rem;
    font-weight: 600;
    color: #334155;
}

.back-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

.back-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateX(-2px);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.root-section-wrapper {
    margin-bottom: 3rem;
}

.root-section-wrapper:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 1.5rem;
    padding-left: 0.5rem;
    border-left: 4px solid var(--accent-primary);
    text-transform: capitalize;
}

.folder-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    height: auto;
    min-height: 200px;
    padding-bottom: 1.5rem;
}

.folder-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, var(--glow-color) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.folder-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.folder-card:hover::before {
    opacity: 1;
}
.folder-card.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary), 0 10px 30px rgba(37, 99, 235, 0.15);
    padding-bottom: 3.5rem;
}

.folder-icon, .folder-logo {
    width: 96px;
    height: 96px;
    margin-bottom: 1.25rem;
    z-index: 1;
    transition: transform 0.3s ease;
}

.folder-logo {
    object-fit: contain;
    border-radius: 8px;
}

.folder-card:hover .folder-icon,
.folder-card:hover .folder-logo {
    transform: scale(1.1) rotate(-3deg);
}

.folder-name {
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-main);
    margin-bottom: 14px; /* 간격을 더 여유 있게 조정 */
    line-height: 1.4;
    z-index: 1;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.action-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    display: flex;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
    background: linear-gradient(to top, var(--bg-card-hover) 60%, transparent);
    
    /* 포커스 스크롤 방지 및 애니메이션 최적화 */
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    visibility: hidden;
}

.folder-card.selected .action-container {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
}

.move-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.move-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

.move-btn:active {
    transform: translateY(0);
}

.loading, .empty, .error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.error {
    color: #ef4444;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* --- Showroom Section moved and consolidated below --- */

@media (max-width: 900px) {
    .showroom-section {
        flex-direction: column;
    }
    .showroom-image-container {
        width: 100%;
    }
    .showroom-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .showroom-controls .bubble-btn {
        width: calc(50% - 6px);
    }
}

@media (max-width: 600px) {
    .showroom-controls .bubble-btn {
        width: 100%;
    }
}

/* --- Responsive Design --- */

/* Tablet & Smaller Desktops (1024px or less) */
@media (max-width: 1024px) {
    .app-container {
        padding: 1.5rem;
    }
    .header-content h1 {
        font-size: 2.5rem;
    }
}

/* Mobile (768px or less) */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }
    
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1rem;
    }
    
    .folder-card {
        padding: 1.5rem 1rem 1rem;
        height: auto;
        min-height: 180px;
    }

    .folder-card.selected {
        padding-bottom: 3.5rem;
    }

    /* Scale down the entire character container for consistent relative positioning */
    #character-container .AITalk_floating {
        transform: scale(0.65);
        transform-origin: bottom right;
    }
    #character-container {
        bottom: 0 !important;
        right: 0 !important;
    }
}

/* Small Mobile (480px or less) */
@media (max-width: 480px) {
    .app-header {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }
    
    .header-content h1 {
        font-size: 1.75rem;
    }
    
    .header-content p {
        font-size: 0.95rem;
    }
    
    .grid-container {
        grid-template-columns: 1fr;
    }
    
    .folder-card {
        height: auto;
        min-height: 140px;
        padding: 1.2rem;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 0.5rem;
    }
    
    .folder-icon, .folder-logo {
        width: 72px;
        height: 72px;
        margin-bottom: 0;
    }
    
    .folder-name {
        text-align: center;
        margin-bottom: 0.5rem;
        width: 100%;
    }

    .folder-card.selected {
        padding-bottom: 1rem;
    }

    .folder-card.selected .action-container {
        position: static;
        transform: none;
        opacity: 1;
        background: none;
        padding: 0;
        width: 100%;
        display: flex;
        justify-content: center;
        pointer-events: auto;
        visibility: visible;
        margin-top: 0.2rem;
    }

    .folder-card:hover .folder-icon,
    .folder-card:hover .folder-logo {
        transform: scale(1.1);
    }
    
    /* Further scale down the entire container */
    #character-container .AITalk_floating {
        transform: scale(0.55);
        transform-origin: bottom right;
    }
    #character-container {
        bottom: 0 !important;
        right: 0 !important;
    }
}

/* Character Container */
#character-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: auto;
    height: auto;
    z-index: 9999;
    pointer-events: none; /* Let clicks pass through to background unless hitting character */
    transition: right 0.3s ease;
}

/* Remove internal margins globally for precision */
#character-container .AITalk_floating {
    right: 0 !important;
    margin-right: 0 !important;
}

/* Align to the edge of the 1200px container on large screens */
@media (min-width: 1240px) {
    #character-container {
        right: calc(50% - 600px + 10px);
    }
}

/* Interaction Bubble Buttons (Menu above character) */
.bubble-btn-group {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 500;
  width: max-content;
  pointer-events: none;
}

.bubble-btn-group.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -100%) scale(1.0);
  pointer-events: auto;
}

@media (max-width: 768px) {
  .bubble-btn-group {
    left: 50%;
    right: auto;
    transform: translate(-50%, -100%);
  }
  .bubble-btn-group.show {
    transform: translate(-50%, -100%) scale(1.0);
  }
}

.bubble-btn {
  background: white;
  border: 2px solid #334155;
  border-radius: 40px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(51, 65, 85, 0.1);
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px !important;
}

.bubble-btn:last-child {
  margin-bottom: 0 !important;
}

.bubble-btn:hover {
  background: #334155;
  color: white;
  border-color: #334155;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 15px rgba(51, 65, 85, 0.2);
}

.bubble-btn i {
  font-size: 14px;
}
/* --- Manual View --- */
.manual-view {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    animation: fadeIn 0.6s ease-out;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

.manual-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.manual-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: calc(66.6% - 12px);
    width: 100%;
}

.manual-selector-wrapper label {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.manual-select {
    background: white;
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    border-radius: 16px;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.manual-select:hover {
    border-color: var(--accent-primary);
}

.manual-body {
    display: flex;
    gap: 2rem;
}

.manual-display {
    flex: 2;
}

.manual-image-container {
    width: 100%;
    height: 500px;
    background: #1a1a1a;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.manual-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.5s ease-in-out; /* 트랜지션 시간 및 효과 최적화 */
}

.smooth-fade {
    opacity: 0 !important;
}

/* 쇼룸 섹션 레이아웃 */
.showroom-section {
    display: flex;
    gap: 2.5rem;
    align-items: stretch;
    margin-bottom: 4rem;
    animation: fadeIn 1s ease-out;
}

.showroom-image-container {
    flex: 2;
    background: #1a1a1a;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

#showroom {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.6s ease-in-out;
}

.showroom-controls {
    flex: 0.8;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    justify-content: center;
}

.showroom-controls .bubble-btn {
    width: 100%;
    padding: 1.1rem 1.8rem;
    justify-content: flex-start;
    border-radius: 20px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    color: var(--text-main);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    margin-bottom: 0 !important;
    backdrop-filter: blur(8px);
}

.showroom-controls .bubble-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateX(8px);
}

.manual-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.manual-item-btn {
    background: white;
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.manual-item-btn:hover {
    transform: translateX(5px);
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
}

.manual-item-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 8px 20px rgba(51, 65, 85, 0.3);
}

@media (max-width: 768px) {
    .manual-view {
        padding: 1.5rem;
    }
    
    .manual-selector-wrapper {
        max-width: 100%;
        margin-bottom: 1.5rem;
    }

    .manual-body {
        flex-direction: column;
        gap: 1.5rem;
    }

    .manual-image-container {
        height: 250px;
    }

    .manual-items {
        flex-direction: column;
        width: 100%;
    }

    .manual-item-btn {
        flex: none;
        width: 100%;
        padding: 1.2rem;
        font-size: 1.1rem;
        border-radius: 16px;
    }
}

/* --- Main Navigation (Header) --- */
.main-nav {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(241, 245, 249, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.logo i {
    color: var(--accent-primary);
    font-size: 1.25rem;
}

.logo span {
    color: var(--text-muted);
    font-weight: 400;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    margin-left: auto;
    margin-right: 2.5rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-menu a:hover, .nav-menu a.active {
    color: var(--accent-primary);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after, .nav-menu a.active::after {
    width: 100%;
}

.contact-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact-btn:hover {
    background: #0f172a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- Main Footer --- */
.main-footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 5rem 0 2rem;
    margin-top: 5rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.5fr;
    gap: 4rem;
}

.footer-col h4 {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 0.8rem;
}

.footer-col ul a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.9rem;
}

.footer-col ul a:hover {
    color: white;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    text-decoration: none;
}

.footer-logo span {
    color: #64748b;
    font-weight: 400;
}

.footer-col p {
    line-height: 1.6;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--accent-primary);
    transform: translateY(-3px);
}

.subscribe-form {
    display: flex;
    gap: 0.5rem;
}

.subscribe-form input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    color: white;
    flex: 1;
    font-family: inherit;
    outline: none;
}

.subscribe-form button {
    background: white;
    color: #0f172a;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.subscribe-form button:hover {
    background: #cbd5e1;
}

.footer-bottom {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-bottom-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.footer-legal {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.footer-legal a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-legal a:hover {
    color: white;
}

/* Responsive Showroom */
@media (max-width: 768px) {
    .showroom-section {
        flex-direction: column;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .showroom-image-container {
        height: 250px;
        flex: none;
    }

    .showroom-controls {
        flex: none;
        width: 100%;
        gap: 10px;
    }

    .showroom-controls .bubble-btn {
        padding: 1.2rem;
        font-size: 1.1rem;
        border-radius: 16px;
    }
}

/* Responsive Footer */
@media (max-width: 1024px) {
    .footer-inner {
        grid-template-columns: repeat(2, 1fr);
        gap: 3rem;
    }
}

@media (max-width: 768px) {
    .nav-menu, .nav-actions {
        display: none;
    }
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    .footer-bottom-inner {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    .footer-legal {
        justify-content: center;
    }
}
