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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --special: #f59e0b;
    --bg: #0f0f23;
    --surface: #1a1a2e;
    --surface-light: #252542;
    --text: #fff;
    --text-muted: #666;
    --card-back: linear-gradient(145deg, #1a1a4e 0%, #2d1b4e 50%, #1a1a4e 100%);
    --card-border: #4a4a8a;
    --card-special: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --glow-primary: rgba(99, 102, 241, 0.4);
    --glow-success: rgba(16, 185, 129, 0.4);
}

body {
    font-family: 'Noto Sans SC', -apple-system, sans-serif;
    background: var(--bg);
    background-image: 
        radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
}

.app {
    max-width: 420px;
    margin: 0 auto;
    height: 100vh;
}

.view {
    display: none;
    height: 100vh;
    padding: 20px;
    flex-direction: column;
}

.view.active {
    display: flex;
}

/* Buttons */
.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
}

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

.btn-primary {
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px var(--glow-primary), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px var(--glow-primary), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(145deg, var(--success) 0%, #059669 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px var(--glow-success), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-success:hover {
    box-shadow: 0 6px 25px var(--glow-success), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-text:hover {
    color: var(--text);
}

.btn-add {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 15px var(--glow-primary);
    transition: all 0.15s;
}

.btn-add:hover {
    transform: scale(1.05);
}

.btn-add:active {
    transform: scale(0.95);
}

/* Main View */
#main-view {
    justify-content: space-between;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.archive {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.05);
}

.archive:hover {
    background: var(--surface-light);
    transform: scale(1.02);
}

.archive-icon {
    font-size: 18px;
}

.archive-count {
    font-size: 16px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.center-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.current-task {
    display: none;
    width: 100%;
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.current-task.active {
    display: block;
    animation: taskAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes taskAppear {
    0% { opacity: 0; transform: scale(0.9) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.current-task-content {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 20px;
    line-height: 1.4;
}

.deck-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.tagline {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Deck - Balatro Style */
.deck {
    width: 120px;
    height: 170px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.deck:hover {
    transform: scale(1.05) rotate(-1deg);
}

.deck:hover .deck-card {
    box-shadow: 0 8px 40px rgba(99, 102, 241, 0.5);
}

.deck:active {
    transform: scale(0.95);
}

.deck.empty {
    opacity: 0.3;
    cursor: default;
}

.deck.empty:hover {
    transform: none;
}

.deck.shuffling .deck-card {
    animation: shuffleCard 0.15s ease infinite alternate;
}

@keyframes shuffleCard {
    0% { transform: translateX(-2px) rotate(-1deg); }
    100% { transform: translateX(2px) rotate(1deg); }
}

.deck-cards {
    width: 100%;
    height: 100%;
    position: relative;
}

.deck-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--card-back);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    border: 2px solid var(--card-border);
    transition: all 0.2s ease;
    /* Card pattern */
    background-image: 
        var(--card-back),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255,255,255,0.02) 10px,
            rgba(255,255,255,0.02) 20px
        );
}

.deck-card::before {
    content: '✦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: rgba(255,255,255,0.15);
}

.deck-card:nth-child(1) { top: 0; left: 0; z-index: 3; }
.deck-card:nth-child(2) { top: 4px; left: 4px; z-index: 2; }
.deck-card:nth-child(3) { top: 8px; left: 8px; z-index: 1; }

.deck-info {
    font-size: 14px;
    color: var(--text-muted);
}

#deck-count {
    color: var(--text);
    font-weight: 600;
}

.bottom-section {
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.add-task-form {
    display: flex;
    gap: 12px;
    width: 100%;
}

#new-task-input {
    flex: 1;
    padding: 15px 18px;
    border: 1px solid var(--surface-light);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

#new-task-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--glow-primary);
}

#new-task-input::placeholder {
    color: var(--text-muted);
}

/* Archive View */
.archive-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0 24px;
    font-size: 16px;
}

.archive-header span {
    flex: 1;
}

.btn-clear {
    font-size: 18px;
    opacity: 0.6;
    transition: all 0.15s;
}

.btn-clear:hover {
    opacity: 1;
    transform: scale(1.1);
}

.archive-list {
    flex: 1;
    overflow-y: auto;
}

.archive-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 8px;
    gap: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.archive-item-icon {
    color: var(--success);
}

.archive-item-text {
    flex: 1;
    color: var(--text-muted);
}

.archive-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* Spread View - Card Selection */
#spread-view {
    justify-content: center;
    align-items: center;
}

.spread-container {
    text-align: center;
    width: 100%;
}

.spread-title {
    font-size: 20px;
    color: var(--text-muted);
    margin-bottom: 48px;
}

.cards-spread {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 48px;
    perspective: 1000px;
}

.spread-card {
    width: 60px;
    height: 86px;
    border-radius: 10px;
    background: var(--card-back);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(40px) rotateX(20deg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    font-size: 20px;
    border: 2px solid var(--card-border);
    position: relative;
    /* Card pattern */
    background-image: 
        var(--card-back),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 8px,
            rgba(255,255,255,0.02) 8px,
            rgba(255,255,255,0.02) 16px
        );
}

.spread-card.show {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

.spread-card:hover {
    transform: translateY(-20px) scale(1.1) rotateZ(-2deg);
    box-shadow: 0 20px 50px rgba(99, 102, 241, 0.5);
    border-color: var(--primary);
    z-index: 10;
}

.spread-card:active {
    transform: translateY(-10px) scale(1.05);
}

/* Result View - Card Reveal */
#result-view {
    justify-content: center;
    align-items: center;
}

.result-container {
    text-align: center;
    width: 100%;
}

.result-card {
    width: 180px;
    height: 260px;
    margin: 0 auto 48px;
    perspective: 1200px;
}

.result-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1.1);
}

.result-card.flipped .result-card-inner {
    transform: rotateY(180deg);
}

.result-card-back,
.result-card-front {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.result-card-back {
    background: var(--card-back);
    font-size: 48px;
    color: rgba(255,255,255,0.2);
    border: 3px solid var(--card-border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    /* Card pattern */
    background-image: 
        var(--card-back),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255,255,255,0.02) 10px,
            rgba(255,255,255,0.02) 20px
        );
}

.result-card-front {
    background: linear-gradient(145deg, #1f1f3a 0%, #15152a 100%);
    border: 3px solid var(--primary);
    transform: rotateY(180deg);
    padding: 24px;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
}

.result-card.flipped .result-card-front {
    animation: cardRevealGlow 0.5s ease 0.3s;
}

@keyframes cardRevealGlow {
    0%, 100% { box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 10px 60px rgba(99, 102, 241, 0.6), 0 0 30px rgba(99, 102, 241, 0.4); }
}

/* Special card styling */
.result-card.special .result-card-front {
    border-color: var(--special);
    background: linear-gradient(145deg, #2a1f1a 0%, #1a1510 100%);
    box-shadow: 0 10px 40px rgba(245, 158, 11, 0.3);
}

.result-card.special.flipped .result-card-front {
    animation: cardRevealGlowSpecial 0.5s ease 0.3s;
}

@keyframes cardRevealGlowSpecial {
    0%, 100% { box-shadow: 0 10px 40px rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 10px 60px rgba(245, 158, 11, 0.6), 0 0 30px rgba(245, 158, 11, 0.4); }
}

.result-task {
    font-size: 20px;
    font-weight: 500;
    line-height: 1.5;
}

.result-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 12px;
    display: none;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 200px;
    margin: 0 auto;
}

/* Manage View */
.manage-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0 24px;
    font-size: 16px;
}

.task-list {
    flex: 1;
    overflow-y: auto;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.15s;
}

.task-item:hover {
    background: var(--surface-light);
}

.task-item-text {
    flex: 1;
}

.task-item-delete {
    background: none;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.15s;
}

.task-item-delete:hover {
    color: #ef4444;
    transform: scale(1.1);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* Celebrate View */
#celebrate-view {
    justify-content: center;
    align-items: center;
    background: var(--bg);
}

.celebrate-container {
    text-align: center;
}

.celebrate-emoji {
    font-size: 80px;
    animation: celebratePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes celebratePop {
    0% { transform: scale(0) rotate(-20deg); }
    60% { transform: scale(1.4) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.celebrate-text {
    font-size: 28px;
    font-weight: 700;
    margin: 24px 0 48px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #ec4899, #8b5cf6);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: celebrateText 0.5s ease 0.2s both, gradientShift 2s ease infinite;
}

@keyframes celebrateText {
    0% { opacity: 0; transform: translateY(20px) scale(0.8); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Super celebration for easter eggs */
.celebrate-container.super .celebrate-emoji {
    animation: superPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes superPop {
    0% { transform: scale(0) rotate(-180deg); }
    50% { transform: scale(1.6) rotate(20deg); }
    70% { transform: scale(0.9) rotate(-10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Flying Cards */
.flying-cards-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
}

.flying-card {
    position: absolute;
    width: 50px;
    height: 72px;
    background: var(--card-back);
    border-radius: 8px;
    border: 2px solid var(--card-border);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.completed-flying-card {
    position: fixed;
    background: var(--surface);
    border: 2px solid var(--success);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    z-index: 1000;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 150px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 4px 20px var(--glow-success);
}

/* Confetti - Enhanced */
.confetti {
    position: fixed;
    top: -20px;
    z-index: 2000;
    animation: confettiFall linear forwards;
    pointer-events: none;
}

.confetti.square {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.confetti.circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.confetti.star {
    width: 0;
    height: 0;
    background: transparent !important;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid var(--confetti-color, #fbbf24);
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

/* Screen flash for big moments */
.screen-flash {
    position: fixed;
    inset: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 3000;
    animation: flash 0.3s ease;
}

@keyframes flash {
    0% { opacity: 0.3; }
    100% { opacity: 0; }
}
