:root {
    --bg-dark: #151925;
    --card-bg: #1e2433;
    --primary: #ff6b00;
    /* Orange */
    --text-main: #ffffff;
    --text-sub: #8a93a8;
}

* {
    box-sizing: border-box;
    /* Global fix for width/padding calculations */
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
    position: relative;
}

header h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.2;
}

header p {
    color: var(--text-sub);
    margin-top: 8px;
    font-size: 14px;
}

/* Language Switch */
.powered-by {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    display: block;
    margin-top: 10px;
    margin-bottom: 20px;
    transition: opacity 0.2s;
}

.powered-by:hover {
    opacity: 0.8;
}

.lang-switch {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
    width: 100%;
}

.lang-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-sub);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
}

.screen {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
}

.screen.active {
    display: flex;
}

/* Dashboard */
.upload-area {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    position: relative;
    cursor: pointer;
}

input[type="file"] {
    display: none;
}

.upload-btn {
    text-align: center;
}

.upload-btn .icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.upload-btn span {
    font-weight: bold;
    opacity: 0.6;
}

.settings-panel {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.settings-header h2 {
    margin: 0;
    font-size: 18px;
}

/* Toggles */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-item h3 {
    font-size: 16px;
    margin: 0 0 4px 0;
}

.setting-item p {
    font-size: 11px;
    color: var(--text-sub);
    margin: 0;
}

.setting-item.special {
    background: rgba(255, 107, 0, 0.1);
    /* Subtle orange tint */
    margin: -10px -10px 10px -10px;
    padding: 10px;
    border-radius: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4a5568;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

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

/* Buttons */
.btn-sm {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.status-on {
    background: var(--primary);
    color: white;
}

.status-off {
    background: #4a5568;
    color: white;
}

.actions {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-block {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 16px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    /* Reset margins/paddings that might differ between a and button */
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

.btn-block.white {
    background: white;
    color: black;
}

.btn-block .icon {
    font-size: 20px;
}

/* Process Screen with Ads */
.loading-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.loading-state {
    text-align: center;
    width: 100%;
}

.spinner-lg {
    font-size: 60px;
    animation: spin 2s infinite linear;
    margin-bottom: 20px;
    display: inline-block;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    margin: 20px 0;
    overflow: hidden;
}

#progress-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

/* Promo Card */
.promo-card {
    background: #23222b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    /* Matched Action width */
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.promo-card:active {
    transform: scale(0.98);
}

.promo-label {
    color: #ccc;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.promo-btn {
    background: white;
    color: black;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.promo-btn .ext-icon {
    font-size: 12px;
}

.promo-btn.inverted {
    background: var(--primary);
    color: white;
}

.promo-sub {
    color: #888;
    font-size: 12px;
    margin-top: 12px;
}

.promo-sub strong {
    color: #ff6b00;
    font-weight: bold;
    font-size: 13px;
}

/* Deepit Promo Specifics */
.promo-card.promo-deepit {
    position: relative;
    padding: 0;
    overflow: hidden;
    height: 200px;
    /* Fixed height for image area */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    background-image: url('https://dartspropower.com/deepit/images/logo2.jpg');
    background-size: cover;
    background-position: center;
}

.promo-card.promo-deepit::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.9) 100%);
    z-index: 1;
}

.promo-content-overlay {
    position: relative;
    z-index: 2;
    padding: 16px;
    width: 100%;
    height: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.promo-deepit-title {
    font-size: 24px;
    font-weight: 800;
    margin: 4px 0 0 0;
    /* Added top margin for CTA */
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}

.promo-deepit-desc {
    font-size: 14px;
    color: white;
    /* Changed from Gold to White */
    margin: 0;
    /* Removed bottom margin since it is now top */
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    line-height: 1.5;
}

.promo-deepit-btn {
    background: #ff6b00;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Result Screen */
.result-mode {
    margin-bottom: 30px;
    border-color: var(--primary);
}

.confetti {
    font-size: 40px;
    margin-bottom: 0px;
}

.result-title {
    font-size: 24px;
    margin: 10px 0 0 0;
}

.preview-area {
    width: 100%;
    background: black;
    border-radius: 12px;
    overflow: hidden;
    /* Clips anything outside border radius */
    max-width: 600px;
    aspect-ratio: 16/9;
    /* Force container to be 16:9 box */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensures the whole video is visible inside the box, adding black bars if needed */
}

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

/* Onboarding Popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.popup-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.popup-content h2 {
    margin: 0 0 20px 0;
    font-size: 24px;
}

.popup-content ul {
    text-align: left;
    padding-left: 20px;
    margin: 0 0 10px 0;
}

.popup-content li {
    margin-bottom: 12px;
    line-height: 1.5;
    color: var(--text-sub);
}

/* Dynamic Promo Styles (Custom type) */
.promo-card.promo-custom {
    position: relative;
    padding: 0;
    overflow: hidden;
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #23222b;
    /* Fallback color while image loads */
}

.promo-card.promo-custom::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.9) 100%);
    z-index: 1;
}

.promo-card.promo-custom .promo-content-overlay {
    position: relative;
    z-index: 2;
    /* Above the gradient overlay */
}

.promo-custom-title {
    font-size: 18px;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    margin-bottom: 4px;
}

.promo-custom-desc {
    font-size: 14px;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    margin-bottom: 8px;
}

.promo-custom-cta {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Dynamic promo container */
.promo-card.promo-dynamic {
    min-height: 200px;
}

/* Result title (simple text) */
.result-title {
    text-align: center;
    font-size: 24px;
    margin: 0 0 20px 0;
    color: var(--text-main);
}