:root {
    --etude-pink: #FFB7C5;
    --etude-pink-dark: #FF5A8D;
    --etude-pink-light: #FFE5EA;
    --text-color: #4A4A4A;
    --gray-dark: #444;
    --shadow: 0 8px 32px 0 rgba(255, 183, 197, 0.3);
    --bg-stripes: repeating-linear-gradient(90deg, #FFB7C5, #FFB7C5 43px, #444 43px, #444 86px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    background-color: #FFF0F3;
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 430px;
    height: 100%;
    background: white;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0,0,0,0.1);
}

/* Home Screen */
.home-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #FFB7C5 0%, #FFFFFF 100%);
    z-index: 150;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.5s ease;
}

.home-screen.hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.home-content {
    text-align: center;
    padding: 30px;
}

.logo-preview-img {
    width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 25px;
    border: none;
    box-shadow: 0 10px 30px rgba(255, 90, 141, 0.3);
    overflow: hidden;
}

.home-title {
    font-size: 36px;
    color: var(--etude-pink-dark);
    margin-bottom: 50px;
}

.home-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.home-btn {
    border: none;
    padding: 18px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.home-btn.primary {
    background: linear-gradient(90deg, #FF8EAA, #FFB7C5);
    color: white;
    box-shadow: var(--shadow);
}

.home-btn.secondary {
    background: white;
    color: var(--etude-pink-dark);
    border: 2px solid var(--etude-pink);
}

.home-btn.text {
    background: none;
    color: #999;
    font-size: 14px;
    text-decoration: underline;
}

/* Header */
.game-header {
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    z-index: 10;
    height: 50px;
}

.logo-text { 
    font-size: 22px; 
    font-weight: 800; 
    color: var(--etude-pink-dark);
    font-family: 'Outfit', sans-serif;
}
.logo-text span { font-weight: 400; color: black; }
.back-btn, .next-btn { 
    background: none; 
    border: none; 
    font-size: 26px; 
    cursor: pointer; 
    color: black;
    padding: 0 10px;
}

/* Main Game Screen */
.game-content {
    background: var(--bg-stripes);
    position: relative;
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: calc(100% - 50px);
    overflow: hidden;
}

.character-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding-right: 70px;
    margin-top: 5px;
}

.oval-frame {
    width: 260px;
    height: 400px;
    background: radial-gradient(circle, #FFE5EA 0%, #FFFFFF 100%);
    border-radius: 50% / 50%;
    box-shadow: 0 10px 50px rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    border: 5px solid white;
}

.main-character-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.15) translateY(5%);
}

#makeup-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform: scale(1.15) translateY(5%);
}

.character-name-container {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 3px solid var(--etude-pink-dark);
    padding: 6px 20px;
    border-radius: 4px;
    box-shadow: var(--shadow);
    z-index: 10;
    min-width: 200px;
    text-align: center;
}

.character-name-container span { 
    font-weight: 900; 
    font-size: 15px; 
    color: black;
}

/* Sidebar Navigation */
.category-sidebar {
    position: absolute;
    right: 5px;
    top: 20px;
    width: 75px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-tab {
    background: white;
    border: 2px solid var(--etude-pink-dark);
    padding: 14px 5px;
    text-align: center;
    color: var(--etude-pink-dark);
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    border-radius: 2px;
}

.sidebar-tab.active { background: var(--etude-pink-dark); color: white; }

.sub-menu-list {
    background: rgba(255, 255, 255, 0.95);
    display: none;
    flex-direction: column;
    font-size: 12px;
    padding: 5px 0;
    margin-bottom: 2px;
}

.sidebar-tab.active + .sub-menu-list { display: flex; }
.sub-menu-item { padding: 5px 0; color: var(--etude-pink-dark); font-weight: 700; text-align: center; cursor: pointer; opacity: 0.5; transition: opacity 0.2s; }
.sub-menu-item:hover { opacity: 1; }
.sub-menu-item.active { opacity: 1; text-decoration: underline; }

/* Bottom Panel */
.bottom-panel {
    background: white;
    padding: 15px 12px;
    border-top: 3px solid var(--etude-pink-dark);
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px;
}

.side-actions { display: flex; flex-direction: column; gap: 8px; }

.action-btn {
    background: white;
    border: 2px solid var(--etude-pink-dark);
    padding: 10px 5px;
    font-size: 13px;
    font-weight: 800;
    color: var(--etude-pink-dark);
    border-radius: 6px;
}

.carousel-container {
    border: 3px solid var(--etude-pink-dark);
    border-radius: 4px;
    overflow-x: auto;
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
}

.product-list { display: flex; gap: 10px; }

.palette-item {
    width: 30px;
    height: 45px;
    border-radius: 50% 50% 50% 10%; /* Teardrop swatch */
    transform: rotate(-45deg); 
    background-size: cover;
    background-position: center;
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    cursor: pointer;
    margin: 5px;
}

.palette-item.selected { 
    border: 3px solid var(--etude-pink-dark); 
    box-shadow: 0 0 10px var(--etude-pink-dark);
}

.tone-toggle-group {
    grid-column: 1 / span 2;
    display: flex;
    gap: 12px;
    margin-top: 5px;
}

.tone-btn {
    flex: 1;
    padding: 15px;
    border-radius: 40px;
    border: none;
    font-weight: 900;
    color: white;
    font-size: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.tone-btn.warm { background: linear-gradient(180deg, #FF7E5F, #FEB47B); }
.tone-btn.cool { background: linear-gradient(180deg, #6A11CB, #2575FC); }
.tone-btn.active { 
    box-shadow: 0 0 0 4px white, 0 4px 15px rgba(0,0,0,0.4);
    transform: scale(1.02);
}

/* Extra Screens (Finish, Gallery) */
.finish-screen, .gallery-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.finish-screen.hidden, .gallery-screen.hidden {
    transform: translateY(100%);
}

.screen-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--etude-pink-light);
}

.screen-header h2 {
    font-size: 18px;
    color: var(--etude-pink-dark);
}

.finish-back-btn, .gallery-back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.finish-content {
    flex: 1;
    padding: 30px 20px;
    background: var(--bg-stripes);
    display: flex;
    justify-content: center;
    align-items: center;
}

.result-card {
    background: white;
    width: 100%;
    max-width: 320px;
    border-radius: 30px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    text-align: center;
}

.result-view {
    width: 240px;
    height: 340px;
    background: radial-gradient(circle, #FFE5EA 0%, #FFFFFF 100%);
    border-radius: 50% / 50%;
    margin: 0 auto 20px;
    overflow: hidden;
    position: relative;
    border: 3px solid var(--etude-pink);
}

.result-view img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.15) translateY(5%);
}

.result-view canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#princess-name-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--etude-pink-light);
    border-radius: 10px;
    text-align: center;
    font-size: 16px;
    font-family: inherit;
}

.save-final-btn {
    background: linear-gradient(90deg, #FF5A8D, #FF8EAA);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 15px;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 90, 141, 0.4);
}

/* Gallery Styles */
.gallery-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
    background: #FFF0F3;
}

.gallery-item {
    background: white;
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid transparent;
}

.gallery-item:hover {
    transform: scale(1.05);
    border-color: var(--etude-pink);
}

.gallery-thumb {
    width: 100%;
    height: 160px;
    background: radial-gradient(circle, #FFE5EA 0%, #FFFFFF 100%);
    border-radius: 15px;
    object-fit: contain;
    margin-bottom: 10px;
}

.gallery-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--etude-pink-dark);
}

.gallery-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    text-align: center;
}

.hidden { display: none !important; }

.post-save-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}


.invitation-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: center;
}

.invitation-content {
    position: relative;
    width: 90%;
    max-width: 380px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(255,183,197,0.5);
}

.invitation-img {
    width: 100%;
    height: auto;
    display: block;
}

.invitation-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: white;
    border: 2px solid var(--etude-pink-dark);
    border-radius: 50%;
    color: var(--etude-pink-dark);
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 510;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

