:root {
    --bg: #ffffff;
    --card-bg: #f8f9fa;
    --text: #1a1a1a;
    --sub-text: #555555;
    --accent: #000000;
    --btn-text: #ffffff;
    --neon: #39FF14;
    --purple: #9D00FF;
    --mint: #00FFD1;
    --border: #e9ecef;
    --chip-bg: #f0f0f0;
    --legal-text: #868e96;
    --trust-color: #2d7a00;
    --btn-shadow: rgba(57, 255, 20, 0.25);
}

body.dark-mode {
    --bg: #0a1128;
    --card-bg: #111827;
    --text: #EAEAEA;
    --sub-text: #A8A8A8;
    --accent: #39FF14;
    --btn-text: #000000;
    --neon: #39FF14;
    --border: #1e293b;
    --chip-bg: #111827;
    --legal-text: #94a3b8;
    --trust-color: #39FF14;
    --btn-shadow: rgba(57, 255, 20, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    overflow: hidden;
    height: 100svh;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.4s ease;
    height: 100svh;
    display: flex;
    justify-content: center;
    overflow: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body::-webkit-scrollbar {
    display: none;
}

.app-container {
    width: 100%;
    max-width: 420px;
    height: 100svh;
    display: flex;
    flex-direction: column;
    padding: 0 20px;
    padding-top: env(safe-area-inset-top);
    position: relative;
    z-index: 1;
}

/* Light Mode Segmented Control & Tab Contrast */
body:not(.dark-mode) .segmented-control,
body.light-mode .segmented-control,
body.light-theme .segmented-control {
    background: #f1f3f5 !important;
    border: 1px solid #dee2e6 !important;
}

body:not(.dark-mode) .segment-btn,
body.light-mode .segment-btn,
body.light-theme .segment-btn {
    color: #495057;
}

body:not(.dark-mode) .segment-btn.active,
body.light-mode .segment-btn.active,
body.light-theme .segment-btn.active {
    background: #39FF14 !important;
    color: #000000 !important;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(57, 255, 20, 0.35);
}

body:not(.dark-mode) .shimmer,
body.light-mode .shimmer,
body.light-theme .shimmer {
    background: linear-gradient(90deg, #f1f3f5 25%, #e9ecef 50%, #f1f3f5 75%) !important;
    background-size: 200% 100% !important;
}

/* TOP 10 GRID */
.main {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 60px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.main::-webkit-scrollbar {
    display: none;
}

.top10-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    padding: 16px 0 24px;
}

.ticket,
.top10-item,
.rank-card {
    background: #f8f9fa;
    border-radius: 24px;
    display: flex;
    overflow: hidden;
    position: relative;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.08);
    min-height: 176px;
    height: auto;
    color: #1a1a1a;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ticket:hover {
    transform: translateY(-4px);
}

body:not(.dark-mode) .ticket,
body:not(.dark-mode) .top10-item,
body:not(.dark-mode) .rank-card,
body.light-mode .ticket,
body.light-theme .ticket {
    background: #f8f9fa !important;
    color: #1a1a1a !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08) !important;
}

body.dark-mode .ticket {
    background: rgba(17, 24, 39, 0.9);
    color: #eee;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(57, 255, 20, 0.15);
}

.ticket-rank {
    position: absolute;
    top: -10px;
    left: -10px;
    font-size: 52px;
    font-weight: 950;
    font-style: italic;
    color: var(--neon);
    z-index: 20;
    text-shadow: 
        2px 2px 0px #000,
        -1px -1px 0px #000,
        1px -1px 0px #000,
        -1px 1px 0px #000,
        1px 1px 0px #000;
    line-height: 1;
    pointer-events: none;
    font-family: "Arial Black", Gadget, sans-serif;
}

.ticket-content-wrapper {
    display: flex;
    width: 100%;
    min-height: 176px;
    align-items: stretch;
}

.ticket-poster {
    width: 120px;
    min-height: 176px;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    background: #000;
}

.ticket-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.play-hint {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.3s;
}

.ticket-poster:hover .play-hint {
    opacity: 1;
}

/* [Step 1] 카드 내 제목 상단 잘림 방지를 위한 상단 여백 및 정렬 안전성 확보 */
.ticket-info {
    flex-grow: 1;
    padding: 14px 16px 14px 18px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: visible;
    min-width: 0;
}

.ticket-title,
.title {
    font-size: 16.5px;
    font-weight: 800;
    margin-top: 2px;
    margin-bottom: 5px;
    padding-top: 2px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.ticket-title a,
.title a {
    text-decoration: none;
    color: inherit;
    display: inline;
    line-height: 1.35;
}

.ticket-title a:hover,
.title a:hover {
    text-decoration: underline;
    color: var(--accent);
}

.ticket-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.star-icon {
    color: #f59f00;
}

body.dark-mode .star-icon {
    color: #ffcc00;
}

body:not(.dark-mode) .ticket-details,
body.light-mode .ticket-details,
body.light-theme .ticket-details {
    color: #495057 !important;
}

body:not(.dark-mode) .ticket-details p:last-child,
body.light-mode .ticket-details p:last-child,
body.light-theme .ticket-details p:last-child {
    color: #212529 !important;
    opacity: 0.92 !important;
}

/* Trailer Styles */
.trailer-area {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 30;
    background: #000;
}

.trailer-area iframe {
    width: 100%;
    height: 100%;
}

.close-trailer {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    transition: background 0.2s;
}

.close-trailer:hover {
    background: rgba(255,255,255,0.4);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 4px 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg);
}

.logo {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -1px;
    cursor: pointer;
    color: var(--text);
    display: inline-block;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), text-shadow 0.2s ease;
    transform-origin: left center;
    user-select: none;
    -webkit-user-select: none;
}

.logo:hover {
    transform: scale(1.08) translateY(-1px);
    text-shadow:
        0 0 8px rgba(57, 255, 20, 0.9),
        0 0 20px rgba(157, 0, 255, 0.5);
    color: var(--text);
}

.logo.clicked {
    transform: scale(0.96) translateY(1px);
    text-shadow:
        0 0 12px rgba(57, 255, 20, 1),
        0 0 28px rgba(157, 0, 255, 0.7);
    transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1), text-shadow 0.1s ease;
}

.controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border-radius: 10px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

body:not(.dark-mode) .icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.top10-header-btn {
    text-decoration: none;
    color: var(--neon);
    border: 1.5px solid var(--neon);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 900;
    transition: all 0.2s;
    white-space: nowrap;
}

body:not(.dark-mode) .top10-header-btn,
body.light-mode .top10-header-btn,
body.light-theme .top10-header-btn {
    color: #1a1a1a;
    background-color: #39FF14;
    border-color: #2eb800;
}

.top10-header-btn:hover {
    background-color: var(--neon);
    color: #000;
}

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

/* Language Dropdown */
.lang-dropdown {
    position: relative;
    display: inline-block;
}

.lang-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--card-bg);
    min-width: 160px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    border-radius: 16px;
    z-index: 1000;
    margin-top: 10px;
    border: 1px solid var(--border);
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
    animation: dropdownFade 0.2s ease;
    padding: 6px;
}

body.dark-mode .lang-menu {
    background: #1a1a1a;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.lang-menu::-webkit-scrollbar {
    display: none;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.lang-menu.show {
    display: block;
}

.lang-item {
    padding: 8px 14px !important;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.lang-item span {
    font-size: 18px;
}

.lang-item:hover {
    background-color: rgba(57, 255, 20, 0.08);
    color: var(--neon);
}

.lang-item.active {
    color: var(--neon);
    background-color: rgba(57, 255, 20, 0.1);
}

body:not(.dark-mode) .lang-item:hover,
body:not(.dark-mode) .lang-item.active {
    color: #1a5e00;
    background-color: rgba(57, 255, 20, 0.16);
}

/* RTL Support */
[dir="rtl"] .lang-menu {
    right: auto;
    left: 0;
}

[dir="rtl"] .lang-item {
    flex-direction: row;
    text-align: right;
}

/* Person Link Styles */
.person-link {
    text-decoration: none;
    color: inherit;
}
.person-link:hover {
    text-decoration: underline;
}

/* Mobile Pinpoint Fix */
@media (max-width: 768px) {
    .app-container { padding: 0 16px; }
    .header { padding: 10px 0 2px 0 !important; }
    .top10-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .ticket {
        height: auto !important;
        min-height: 184px;
    }
    .ticket-poster {
        width: 120px !important;
        min-height: 184px !important;
        height: auto !important;
        border-radius: 8px;
    }
    .ticket-poster img {
        object-fit: cover !important;
    }
    .ticket-info {
        padding: 14px 16px !important;
        justify-content: flex-start !important;
    }
    .ticket-title,
    .title {
        font-size: 16px;
        margin-top: 2px !important;
        padding-top: 2px !important;
        line-height: 1.35 !important;
    }
}
