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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #2E3440;
    color: #D8DEE9;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

.container {
    max-width: 600px;
    width: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 0.75rem;
}

header h1 {
    font-size: 1.6rem;
    margin-bottom: 0.2rem;
    color: #ECEFF4;
}

.subtitle {
    color: #81A1C1;
    font-size: 0.9rem;
}

.subtitle strong {
    color: #88C0D0;
}

/* ===== SWIPE ROW ===== */

#vote-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.swipe-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 340px;
}

/* Zones left/right */
.zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    user-select: none;
    min-width: 60px;
    height: 80%;
    font-size: 0.85rem;
}

.zone-left {
    background: #3B4252;
    border: 2px dashed #4C566A;
    color: #BF616A;
}

.zone-right {
    background: #3B4252;
    border: 2px dashed #4C566A;
    color: #A3BE8C;
}

.zone.zone-active-left {
    background: #4a1e1e;
    border-color: #BF616A;
    border-style: solid;
    transform: scale(1.05);
}

.zone.zone-active-right {
    background: #1e4a1e;
    border-color: #A3BE8C;
    border-style: solid;
    transform: scale(1.05);
}

.zone-label {
    font-weight: 600;
    font-size: 0.85rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.zone-arrow {
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.zone.zone-active-left .zone-arrow {
    transform: translateX(-4px);
}

.zone.zone-active-right .zone-arrow {
    transform: translateX(4px);
}

/* ===== CARD STACK ===== */

.card-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    position: relative;
    min-height: 0;
}

.item-card {
    background: #3B4252;
    border: 2px solid #434C5E;
    border-radius: 0.85rem;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: grab;
    transition: box-shadow 0.2s, opacity 0.25s ease;
    user-select: none;
    touch-action: none;
    will-change: transform;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.item-card:active {
    cursor: grabbing;
}

.item-card.dragging {
    box-shadow: 0 8px 32px rgba(136, 192, 208, 0.25);
    z-index: 10;
    border-color: #88C0D0;
}

.item-card.swipe-right {
    border-color: #A3BE8C;
    box-shadow: 0 0 24px rgba(163, 190, 140, 0.25);
}

.item-card.swipe-left {
    border-color: #BF616A;
    box-shadow: 0 0 24px rgba(191, 97, 106, 0.25);
}

.item-card.swipe-away-right {
    transition: transform 0.2s ease-in, opacity 0.15s;
    transform: translateX(120%) rotate(6deg) scale(0.5);
    opacity: 0;
}

.item-card.swipe-away-left {
    transition: transform 0.2s ease-in, opacity 0.15s;
    transform: translateX(-120%) rotate(-6deg) scale(0.5);
    opacity: 0;
}

.item-card.fade-in {
    animation: fadeInCard 0.25s ease forwards;
}

@keyframes fadeInCard {
    0% { opacity: 0; transform: scale(0.92); }
    100% { opacity: 1; transform: scale(1); }
}

.item-name {
    font-size: 1.4rem;
    font-weight: 600;
    color: #ECEFF4;
    pointer-events: none;
}

/* ===== STATS BAR ===== */

#stats-bar {
    text-align: center;
    margin-top: 0.75rem;
    padding: 0.7rem;
    background: #3B4252;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    color: #81A1C1;
}

#stats-bar a {
    color: #88C0D0;
    text-decoration: none;
}

#stats-bar a:hover {
    text-decoration: underline;
    color: #8FBCBB;
}

.hidden {
    display: none !important;
}

#loading {
    text-align: center;
    padding: 2rem;
    color: #88C0D0;
    font-size: 1.1rem;
}

/* ===== RANKING CHART ===== */

.ranking-chart { margin-top: 1.5rem; }

.rank-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.rank-bar-label {
    min-width: 140px;
    font-size: 1rem;
    font-weight: 500;
    color: #D8DEE9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.rank-bar-track {
    flex: 1;
    height: 28px;
    background: #3B4252;
    border-radius: 6px;
    overflow: hidden;
}

.rank-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
    min-width: 6px;
}

.rank-loading {
    text-align: center;
    padding: 2rem;
    color: #81A1C1;
    font-size: 1rem;
}

@media (max-width: 500px) {
    .rank-bar-label { min-width: 90px; font-size: 0.85rem; }
    .rank-bar-track { height: 22px; }
}

/* ===== OLD RANKING (admin) ===== */

.ranking-list { list-style: none; }

.rank-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #3B4252;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid #434C5E;
}

.rank-position {
    font-size: 1.2rem;
    font-weight: 700;
    color: #88C0D0;
    min-width: 3rem;
    text-align: center;
}

.rank-name {
    flex: 1;
    font-size: 1.1rem;
    margin: 0 1rem;
    color: #D8DEE9;
}

.rank-rating {
    color: #81A1C1;
    font-size: 0.9rem;
    margin-right: 1rem;
}

.rank-stats {
    color: #4C566A;
    font-size: 0.8rem;
}

/* ===== ADMIN ===== */

.admin-section { margin-top: 2rem; }

.admin-section input,
.admin-section button,
.btn-secondary {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #434C5E;
    background: #3B4252;
    color: #D8DEE9;
    font-size: 1rem;
}

.admin-section input { width: 100%; margin-bottom: 0.5rem; }
.admin-section input::placeholder { color: #4C566A; }

.admin-section button {
    background: #5E81AC;
    color: #ECEFF4;
    cursor: pointer;
    border: none;
    font-weight: 600;
}

.admin-section button:hover { background: #81A1C1; }

.btn-secondary { cursor: pointer; transition: background 0.2s; }
.btn-secondary:hover { background: #4C566A; }

/* ===== RESPONSIVE ===== */

@media (max-width: 500px) {
    .container { padding: 0.5rem; }
    header h1 { font-size: 1.3rem; }
    .swipe-row { height: 280px; gap: 0.3rem; }
    .zone { min-width: 44px; padding: 0.4rem; }
    .zone-label { font-size: 0.75rem; }
    .item-name { font-size: 1.1rem; }
    .item-card { padding: 1rem; }
}

@media (max-height: 700px) {
    .swipe-row { height: 240px; }
    .item-card { padding: 0.8rem; }
    .item-name { font-size: 1rem; }
}