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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* Import Screen */
#import-screen {
    justify-content: center;
    align-items: center;
}

.import-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
}

h1 {
    font-size: 2.5rem;
    color: #e94560;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #888;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #ccc;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #333;
    border-radius: 8px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.95rem;
    font-family: 'Consolas', 'Courier New', monospace;
    resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: #e94560;
}

/* Resume Banner */
.resume-banner {
    background: #0f3460;
    border: 1px solid #e94560;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.resume-banner.hidden {
    display: none;
}

.resume-banner p {
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    color: #ccc;
}

.resume-actions {
    display: flex;
    gap: 0.75rem;
}

.resume-actions .btn-primary {
    padding: 0.5rem 1.5rem;
    font-size: 0.95rem;
    margin-top: 0;
}

/* URL Import */
.url-input-row {
    display: flex;
    gap: 0.5rem;
}

.url-input-row input {
    flex: 1;
}

.import-divider {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    color: #666;
    font-size: 0.85rem;
}

.import-divider::before,
.import-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #333;
}

.import-divider span {
    padding: 0 0.75rem;
}

/* Options row (exclude basics + sort) */
.options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ccc;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #e94560;
    cursor: pointer;
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ccc;
    font-size: 0.9rem;
}

.sort-group select {
    padding: 0.35rem 0.5rem;
    border: 1px solid #333;
    border-radius: 6px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
}

.sort-group select:focus {
    outline: none;
    border-color: #e94560;
}

/* Commander Picker */
.commander-picker {
    margin-top: 1.5rem;
}

.commander-picker.hidden {
    display: none;
}

.commander-picker h2 {
    color: #e94560;
    margin-bottom: 0.25rem;
}

/* Commander compact view */
.commander-compact.hidden {
    display: none;
}

.commander-compact-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #0f3460;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.commander-compact-label {
    color: #888;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.commander-compact-name {
    flex: 1;
    font-weight: 600;
    color: #e94560;
    font-size: 0.95rem;
}

/* Full picker */
.commander-full-picker.hidden {
    display: none;
}

.picker-hint {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.picker-search-group {
    margin-bottom: 0.75rem;
}

.commander-card-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 1rem;
    border: 1px solid #333;
    border-radius: 8px;
    background: #16213e;
}

.commander-card-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #1a1a2e;
    transition: background 0.15s;
    gap: 0.5rem;
}

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

.commander-card-item:hover {
    background: #0f3460;
}

.commander-card-item.selected {
    background: #0f3460;
    outline: 2px solid #e94560;
    outline-offset: -2px;
}

.commander-card-item.candidate {
    border-left: 3px solid #e94560;
}

.commander-card-item .card-item-name {
    flex: 1;
    font-size: 0.9rem;
}

.commander-card-item .card-item-tag {
    font-size: 0.7rem;
    color: #e94560;
    font-weight: 600;
    text-transform: uppercase;
}


/* Buttons */
.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

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

.btn-primary {
    background: #e94560;
    color: white;
    font-size: 1.1rem;
    padding: 0.8rem 2.5rem;
    margin-top: 0.5rem;
}

.btn-small {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    background: #333;
    color: #ccc;
}

.btn-keep {
    background: #2ecc71;
    color: white;
    font-size: 1.1rem;
    padding: 0.7rem 2rem;
    min-width: 100px;
}

.btn-cut {
    background: #e74c3c;
    color: white;
    font-size: 1.1rem;
    padding: 0.7rem 2rem;
    min-width: 100px;
}

/* Swipe Screen Layout */
#swipe-screen {
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.swipe-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
    justify-content: center;
}

/* Floating commander panel */
.commander-panel {
    position: fixed;
    z-index: 100;
    background: #16213e;
    border: 1px solid #444;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    cursor: grab;
    /* default size — JS will enforce min */
    width: 240px;
    top: 80px;
    left: 20px;
}

.commander-panel:active {
    cursor: grabbing;
}

.commander-panel.hidden {
    display: none;
}

.commander-drag-handle {
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: #0f3460;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: #e94560;
    user-select: none;
}

.commander-panel img {
    width: 100%;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
}

.commander-name {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    width: 100%;
    background: #16213e;
}

.commander-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #e94560 50%);
    border-radius: 0 0 10px 0;
    opacity: 0.6;
}

.commander-resize-handle:hover {
    opacity: 1;
}

.swipe-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1rem 1.5rem;
    max-width: 600px;
}

/* Progress */
.progress-bar-container {
    width: 100%;
    max-width: 500px;
    height: 28px;
    background: #16213e;
    border-radius: 14px;
    position: relative;
    margin-bottom: 1rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #0f3460);
    border-radius: 14px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Swipe Area */
.swipe-area {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 488 / 680;
    margin-bottom: 1rem;
    user-select: none;
}

.swipe-hint {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    font-weight: 900;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 1;
    pointer-events: none;
}

.hint-cut {
    left: 10px;
    color: #e74c3c;
}

.hint-keep {
    right: 10px;
    color: #2ecc71;
}

.card-container {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 2;
}

.card-container.dragging {
    transition: none;
    cursor: grabbing;
}

.card-container.swiping-left {
    transform: translateX(-150%) rotate(-20deg);
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.card-container.swiping-right {
    transform: translateX(150%) rotate(20deg);
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.card-container.entering {
    transform: scale(0.8);
    opacity: 0;
}

.card-img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.card-loading {
    display: none;
    color: #888;
    font-size: 1.1rem;
}

.card-loading.visible {
    display: block;
}

.card-img.hidden {
    display: none;
}

/* Swipe Controls */
.swipe-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.controls-hint {
    display: flex;
    gap: 1.5rem;
    color: #666;
    font-size: 0.8rem;
}

.controls-hint kbd {
    background: #333;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.8rem;
}

/* Results Screen */
#results-screen {
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
}

.results-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.results-columns {
    display: flex;
    gap: 2rem;
    margin: 1.5rem 0;
}

.result-col {
    flex: 1;
    position: relative;
}

.result-col h2 {
    margin-bottom: 0.5rem;
}

.keep-header {
    color: #2ecc71;
}

.cut-header {
    color: #e74c3c;
}

.copy-btn {
    margin-bottom: 0.75rem;
}

.result-list {
    background: #16213e;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: pre-wrap;
    min-height: 200px;
    max-height: 60vh;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
}

/* Responsive */
@media (max-width: 768px) {
    .results-columns {
        flex-direction: column;
    }

    .swipe-area {
        max-width: 300px;
    }

    .commander-panel {
        width: 160px;
    }
}
