/* ===========================================================
   BASE
=========================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
    background: #f3f3f3;
    color: #111827;
}

body {
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.hidden {
    display: none !important;
}

#app-root {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

/* Mobile “frame” look */

.mobile-frame {
    max-width: 430px;
    margin: 16px auto 24px;
    background: #f5f5f5;
    border-radius: 32px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
    padding: 20px 18px 24px;
}

/* ===========================================================
   AUTH VIEW
=========================================================== */

.auth-view {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 40px 16px;
}

.auth-card {
    background: #fff;
    border-radius: 24px;
    padding: 24px 24px 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.app-title {
    font-size: 26px;
    margin: 0 0 4px;
}

.app-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 14px;
}

.auth-tabs {
    display: inline-flex;
    border-radius: 999px;
    background: #f3f4f6;
    padding: 4px;
    margin-bottom: 16px;
}

.auth-tab {
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    color: #6b7280;
}

.auth-tab.active {
    background: #fff;
    color: #111827;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.auth-form {
    display: block;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #d4d4d8;
    font-size: 13px;
    background: #f9fafb;
}

.form-group textarea {
    resize: vertical;
}

.form-message {
    font-size: 12px;
    min-height: 16px;
    margin-top: 6px;
}

/* ===========================================================
   BUTTONS
=========================================================== */

.btn {
    border-radius: 999px;
    border: none;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 500;
}

.primary-btn {
    background: #111827;
    color: #f9fafb;
}

.primary-btn:hover {
    opacity: 0.93;
}

.subtle-btn {
    background: #e5e7eb;
    color: #111827;
}

.subtle-btn:hover {
    background: #d1d5db;
}

.danger-btn {
    background: #fee2e2;
    color: #b91c1c;
}

.small {
    padding: 6px 10px;
    font-size: 12px;
}

.tiny-btn {
    padding: 3px 8px;
    font-size: 11px;
}

.full-width {
    width: 100%;
}

.icon-btn {
    border-radius: 999px;
    width: 32px;
    height: 32px;
    border: none;
    background: #e5e7eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn.danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* ===========================================================
   MAIN VIEW / HEADER
=========================================================== */

.main-view {
    width: 100%;
    max-width: 1200px;
    padding: 12px 16px 24px;
}

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

.app-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo-mark {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: radial-gradient(circle at 30% 20%, #f97316, #111827);
}

.app-header-title {
    font-size: 16px;
    font-weight: 600;
}

.app-header-subtitle {
    font-size: 11px;
    color: #6b7280;
}

.app-header-right {
    display: flex;
    gap: 6px;
}

/* ===========================================================
   GAMIFICATION
=========================================================== */

.gamification-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 20px;
    background: #f9fafb;
    margin-bottom: 10px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.points-level {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.level-label {
    font-size: 12px;
    font-weight: 600;
}

.points-label {
    font-size: 11px;
    color: #6b7280;
}

.progress-wrapper {
    min-width: 160px;
}

.progress-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    margin-bottom: 2px;
}

.progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #111827, #4b5563);
    transition: width 0.25s ease;
}

.progress-caption {
    font-size: 10px;
    color: #6b7280;
}

.gamification-side {
    display: flex;
    align-items: center;
    gap: 6px;
}

.badges-label {
    font-size: 11px;
    color: #6b7280;
}

.badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.badge-pill {
    border-radius: 999px;
    padding: 2px 6px;
    font-size: 10px;
    background: #f3f4ff;
    color: #4338ca;
}

/* ===========================================================
   HOME VIEW
=========================================================== */

.screen-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 6px;
}

.home-search-row {
    margin-bottom: 10px;
}

.search-input-wrapper {
    position: relative;
    background: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.search-input-wrapper input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-size: 13px;
    padding: 6px 4px;
}

.search-icon {
    font-size: 13px;
    margin-right: 6px;
}

.artist-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.artist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.artist-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
    background: #fdfdfd;
}

.artist-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    overflow: hidden;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
    flex-shrink: 0;
}

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

.artist-meta {
    display: flex;
    flex-direction: column;
}

.artist-meta-title {
    font-size: 14px;
    font-weight: 600;
}

.artist-meta-sub {
    font-size: 11px;
    color: #6b7280;
}

.home-empty {
    text-align: center;
    padding: 40px 0 10px;
}

.home-empty h3 {
    margin: 0 0 4px;
}

.home-empty p {
    margin: 0 0 8px;
    font-size: 13px;
    color: #6b7280;
}

/* ===========================================================
   ARTIST EDITOR
=========================================================== */

.screen {
    display: block;
}

.artist-section .mobile-frame {
    padding-bottom: 18px;
}

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

.artist-header-label {
    font-size: 13px;
    color: #6b7280;
}

.artist-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: #ffffff;
    border-radius: 22px;
    padding: 14px 14px 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
}

.artist-portrait-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.artist-portrait {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.artist-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.artist-heading h2 {
    margin: 0;
    font-size: 18px;
}

/* form layout */

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

.form-field {
    flex: 1;
}

.two-columns {
    display: flex;
    gap: 6px;
}

.image-upload-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.image-preview {
    margin-top: 6px;
    border-radius: 10px;
    overflow: hidden;
}

.image-preview.hidden {
    display: none;
}

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

.form-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

/* artworks */

.artworks-card {
    margin-top: 4px;
}

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

.artworks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.artwork-card {
    padding: 10px 10px 10px;
    border-radius: 14px;
    background: #f9fafb;
    cursor: pointer;
}

.artwork-card img {
    margin-top: 6px;
    border-radius: 10px;
}

/* artwork editor inside card */

.artwork-editor {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

/* ===========================================================
   PROFILE / LEADERBOARD
=========================================================== */

.profile-view .mobile-frame {
    padding-bottom: 18px;
}

.profile-inner {
    margin-top: 8px;
}

.profile-name {
    font-size: 16px;
    font-weight: 600;
    margin: 6px 0 0;
}

.profile-email {
    font-size: 12px;
    color: #6b7280;
    margin: 0 0 14px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.profile-stat {
    padding: 8px 10px;
    border-radius: 14px;
    background: #f3f4f6;
}

.profile-stat-label {
    font-size: 11px;
    color: #6b7280;
}

.profile-stat-value {
    font-size: 16px;
    font-weight: 600;
}

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.profile-subheading {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
}

.ranking-list {
    margin-top: 6px;
    border-top: 1px solid #e5e7eb;
}

.ranking-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f4f4f5;
    font-size: 12px;
}

.ranking-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ranking-pos {
    width: 18px;
    text-align: right;
    font-weight: 600;
    color: #9ca3af;
}

.ranking-name {
    font-weight: 500;
}

.ranking-points {
    font-variant-numeric: tabular-nums;
    color: #4b5563;
}

/* ===========================================================
   LIGHTBOX
=========================================================== */

.lightbox {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.lightbox.hidden {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
}

.lightbox-content {
    position: relative;
    z-index: 51;
    background: #111827;
    border-radius: 24px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 80vw;
    max-height: 80vh;
    border-radius: 18px;
}

.lightbox-nav {
    background: transparent;
    border: none;
    color: #f9fafb;
    font-size: 22px;
    cursor: pointer;
    padding: 0 6px;
}

.lightbox-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* ===========================================================
   RESPONSIVE (larger screens)
=========================================================== */

@media (min-width: 1024px) {
    .main-view {
        padding-top: 24px;
    }

    .app-header {
        margin-bottom: 14px;
    }

    .gamification-bar {
        margin-bottom: 18px;
    }

    .artist-layout {
        flex-direction: row;
    }

    .artist-card,
    .artworks-card {
        flex: 1;
    }
}
