/* Joy Mini App Styles */
:root {
    --bg: #01061C;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --text: #F9FAFF;
    --text-secondary: rgba(249, 250, 255, 0.5);
    --accent: #75A49A;
    --accent-light: rgba(117, 164, 154, 0.15);
    --danger: #E85A5A;
    --danger-light: rgba(232, 90, 90, 0.1);
    --success: #5AE89A;
    --border: rgba(255, 255, 255, 0.06);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* Loader */
.loader {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg);
    z-index: 1000;
}

.loader-spinner {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Navigation */
.nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 6px 12px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    background: rgba(1, 6, 28, 0.98);
    backdrop-filter: blur(24px);
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, transform 0.15s;
    border-radius: var(--radius-sm);
}

.nav-item:active { transform: scale(0.92); }

.nav-item.active { color: var(--accent); }

.nav-item svg {
    width: 22px;
    height: 22px;
}

/* Pages */
.pages {
    padding: 16px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
    max-width: 420px;
    margin: 0 auto;
}

.page {
    display: none;
    animation: fadeIn 0.25s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
}

/* Character Card */
.character-card {
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.character-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.character-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card-hover);
    border: 2px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.character-avatar:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

.character-avatar:active {
    transform: scale(0.95);
}

.character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Photo Modal */
.photo-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.photo-modal.hidden {
    display: none;
}

.photo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

.photo-modal-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.photo-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}

.photo-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.photo-modal-close:active {
    transform: scale(0.9);
}

.character-name {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    flex: 1;
}

.character-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.character-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.character-detail:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.character-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.character-with-you {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

/* Status Dashboard */
.status-dashboard {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}

/* Main Chart Container */
.main-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

/* Donut Charts */
.donut-chart {
    position: relative;
}

.donut-lg {
    width: 140px;
    height: 140px;
}

.donut-sm {
    width: 80px;
    height: 80px;
}

.donut-svg {
    width: 100%;
    height: 100%;
}

.donut-ring {
    transition: stroke 0.3s;
}

.donut-segment {
    transition: stroke-dasharray 0.6s ease-out;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-value {
    font-weight: 700;
    color: var(--text);
}

.donut-value-lg {
    font-size: 32px;
}

.donut-value-sm {
    font-size: 18px;
}

.mood-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-transform: lowercase;
    text-align: center;
    max-width: 80px;
    line-height: 1.2;
}

.chart-legend {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
    font-weight: 500;
}

/* Secondary Charts */
.secondary-charts {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-bottom: 20px;
}

.chart-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.location-info {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.location-label {
    color: var(--text-secondary);
    margin-right: 6px;
}

.location-value {
    color: var(--accent);
    font-weight: 600;
}

/* Tokens Section */
.tokens-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.tokens-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tokens-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.tokens-balance {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.tokens-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}

.btn-primary:hover { background: #8AB5AB; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover { background: var(--bg-card); }

.btn-danger { 
    color: var(--danger); 
    border-color: rgba(232, 90, 90, 0.3);
}

.btn-danger:hover {
    background: var(--danger-light);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 15px;
}

/* Subscription Page */
.current-plan {
    text-align: center;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.plan-badge {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent);
    color: var(--bg);
    font-size: 16px;
    font-weight: 700;
    border-radius: 24px;
    margin-bottom: 8px;
}

.plan-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Plan Progress */
.plan-progress-container {
    margin-top: 16px;
    width: 100%;
}

.plan-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.plan-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.plan-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(117, 164, 154, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.plan-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Limits */
.limits-block {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}

.limit-item {
    margin-bottom: 16px;
}

.limit-item:last-child { margin-bottom: 0; }

.limit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.limit-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.limit-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.limit-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.limit-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Plans List */
.plans-block {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
}

.plans-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.plan-card {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.plan-card:hover:not(.disabled) { 
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.1);
}

.plan-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.plan-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.plan-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.plan-card-name {
    font-size: 15px;
    font-weight: 600;
}

.plan-card-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.plan-card-features {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plan-feature {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-feature::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Settings */
.settings-group {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}

.settings-group-danger {
    border-color: rgba(232, 90, 90, 0.2);
}

.settings-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.setting-item:last-child { border-bottom: none; }

.setting-label {
    font-size: 14px;
    font-weight: 500;
}

.settings-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 12px;
}

/* Toggle */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 13px;
    transition: 0.25s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--text);
    border-radius: 50%;
    transition: 0.25s;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Select */
.select {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.select-sm {
    padding: 8px 12px;
    font-size: 12px;
}

.time-range {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.adult-warning {
    padding: 12px;
    background: var(--danger-light);
    border-radius: var(--radius-xs);
    margin-top: 12px;
}

.adult-warning p {
    font-size: 12px;
    color: var(--danger);
}

/* Gallery */
.gallery-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.gallery-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.gallery-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-card);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.gallery-empty p { 
    margin-bottom: 16px; 
    font-size: 14px;
}

.gallery-empty .btn { width: auto; }

/* Setup Screen / Constructor */
#setup-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 200;
    overflow-y: auto;
}

.constructor {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
    max-width: 420px;
    margin: 0 auto;
}

/* Progress */
.constructor-progress {
    margin-bottom: 32px;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    margin-bottom: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Steps */
.constructor-steps {
    flex: 1;
}

.step {
    display: none;
    animation: fadeIn 0.25s ease;
}

.step.active {
    display: block;
}

.step-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.step-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Input */
.input {
    width: 100%;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.input:focus {
    border-color: var(--accent);
}

.input::placeholder {
    color: var(--text-secondary);
}

.input-mt {
    margin-top: 16px;
}

/* Age Slider */
.age-slider-container {
    text-align: center;
}

.age-slider {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 16px;
}

.age-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.age-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.age-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.option-btn:active {
    transform: scale(0.98);
}

.option-btn.selected {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.option-btn.sm {
    padding: 10px 14px;
    font-size: 13px;
}

.option-btn.lg {
    padding: 16px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-title {
    font-size: 15px;
    font-weight: 600;
}

.option-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.option-btn.lg.selected .option-desc {
    color: var(--accent);
    opacity: 0.8;
}

.option-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Appearance Fields */
.appearance-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Constructor Navigation */
.constructor-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 12px;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    background: rgba(1, 6, 28, 0.98);
    backdrop-filter: blur(24px);
    border-top: 1px solid var(--border);
    max-width: 420px;
    margin: 0 auto;
}

.constructor-nav .btn {
    flex: 1;
}

.constructor-nav .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Plans in constructor */
.plans-list-constructor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.plan-card-constructor {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.plan-card-constructor:hover:not(.disabled) { 
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.1);
}

.plan-card-constructor.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.plan-card-constructor.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.plan-card-constructor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.plan-card-constructor-name {
    font-size: 15px;
    font-weight: 600;
}

.plan-card-constructor-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.plan-card-constructor-features {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plan-feature-constructor {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-feature-constructor::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Success Screen */
#success-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 300;
}

.success-content {
    text-align: center;
    padding: 40px 24px;
    max-width: 420px;
}

.success-photo-container {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.success-reference-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 20px rgba(117, 164, 154, 0.3);
}

.success-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.success-desc {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.shake {
    animation: shake 0.4s ease;
}

.input.shake {
    border-color: var(--danger);
}

/* Photo Generation */
.photo-generation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin: 32px 0;
}

.progress-circle-container {
    position: relative;
    width: 140px;
    height: 140px;
}

.progress-circle {
    width: 100%;
    height: 100%;
}

.progress-circle-bg {
    transition: stroke 0.3s;
}

.progress-circle-fill {
    transition: stroke-dasharray 0.3s ease;
}

.progress-circle-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-circle-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.progress-status {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

/* Generated photo in progress circle */
.generated-photo-container {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 20px rgba(117, 164, 154, 0.3);
}

.generated-reference-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Sleep overlay */
.sleep-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(1, 6, 28, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 10;
}

.sleep-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 20px;
}

.sleep-icon {
    font-size: 48px;
    line-height: 1;
}

.sleep-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-wake-up {
    background: linear-gradient(135deg, #6B5B95, #8B7BAF);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(107, 91, 149, 0.3);
}

.btn-wake-up:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 91, 149, 0.4);
}

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

/* Make character-info relative for overlay positioning */
.character-info {
    position: relative;
}

/* Market Page */
.market-message {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 24px;
}

.market-message-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
}

.market-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.market-category {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    text-align: left;
    width: 100%;
}

.market-category:not(.disabled):hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.market-categories.hidden,
.market-message.hidden {
    display: none;
}

.market-category.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.market-category-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    color: var(--accent);
}

.market-category-icon svg {
    width: 32px;
    height: 32px;
}

.market-category-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.market-category-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.market-category-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Page header with back button */
.page-header-with-back {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.back-btn-header {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.back-btn-header:hover {
    background: var(--bg-tertiary);
}

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

.page-header-with-back .page-title {
    margin: 0;
    flex: 1;
}

/* Clothing List */
.clothing-list {
    margin-top: 20px;
}

.clothing-list.hidden {
    display: none;
}

.clothing-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.clothing-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.clothing-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.clothing-item-purchased {
    opacity: 0.5;
    pointer-events: auto;
}

.clothing-item-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(117, 164, 154, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clothing-item-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.clothing-item-image-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 48px;
}

.clothing-item-info {
    padding: 12px;
}

.clothing-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clothing-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.clothing-item-category-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 11px;
    font-weight: 500;
    border-radius: 12px;
    text-transform: capitalize;
}

.clothing-item-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    margin: 0;
    white-space: nowrap;
}

/* Empty state message */
.market-empty-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.market-empty-message.hidden {
    display: none;
}

.market-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.market-empty-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
}

.market-category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    background: var(--accent);
    color: var(--bg);
    font-size: 10px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Safe area for bottom nav */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .nav {
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
    .pages {
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }
}


/* Clothing Detail Modal */
.clothing-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.clothing-detail-modal.active {
    opacity: 1;
    pointer-events: all;
}

.clothing-detail-overlay {
    position: absolute;
    inset: 0;
    background: rgba(1, 6, 28, 0.9);
    backdrop-filter: blur(8px);
}

.clothing-detail-card {
    position: relative;
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    z-index: 1;
}

.clothing-detail-modal.active .clothing-detail-card {
    transform: scale(1) translateY(0);
}

.clothing-detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(1, 6, 28, 0.8);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
}

.clothing-detail-close:hover {
    background: rgba(1, 6, 28, 0.95);
    border-color: var(--accent);
}

.clothing-detail-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background: var(--bg-card);
}

.clothing-detail-image-placeholder {
    width: 100%;
    height: 240px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 64px;
}

.clothing-detail-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 240px);
}

.clothing-detail-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px 0;
}

.clothing-detail-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 20px 0;
}

.clothing-detail-situations {
    margin-bottom: 20px;
}

.clothing-detail-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 12px 0;
}

.clothing-detail-situations-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.clothing-detail-situation-tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

.clothing-detail-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.clothing-detail-price {
    display: flex;
    align-items: center;
    gap: 4px;
}

.clothing-detail-price-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.clothing-detail-buy-btn {
    flex: 1;
    padding: 14px 24px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.clothing-detail-buy-btn:not(:disabled):hover {
    background: var(--accent);
    opacity: 0.9;
    transform: translateY(-2px);
}

.clothing-detail-buy-btn:disabled {
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}


.clothing-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.clothing-category-filter-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.clothing-category-filter-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--text);
}

.clothing-category-filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

/* Wardrobe */
.wardrobe-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px;
}

.wardrobe-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wardrobe-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wardrobe-item-current {
    border: 2px solid var(--accent);
}

.wardrobe-item-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent);
    color: var(--bg);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wardrobe-item-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.wardrobe-item-image-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 48px;
}

.wardrobe-item-info {
    padding: 12px;
}

.wardrobe-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wardrobe-item-category {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    text-transform: capitalize;
}

.wardrobe-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.wardrobe-empty.hidden {
    display: none;
}

.wardrobe-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.wardrobe-empty-text {
    font-size: 16px;
    color: var(--text);
    margin: 0 0 8px 0;
    font-weight: 600;
}

.wardrobe-empty-hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.section-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 16px 0;
}
