:root {
    --bg: #030711;
    --bg-soft: #07111f;
    --panel: rgba(8, 15, 28, .78);
    --panel-strong: rgba(12, 22, 38, .94);
    --panel-soft: rgba(19, 34, 55, .78);
    --ink: #f8fafc;
    --muted: #a9b4c5;
    --line: rgba(158, 178, 205, .28);
    --line-strong: rgba(95, 232, 238, .56);
    --primary: #09b7bd;
    --primary-dark: #067f86;
    --gold: #f7c948;
    --danger: #e05252;
    --success: #09a77f;
    --shadow: 0 22px 70px rgba(0, 0, 0, .46);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background-color: var(--bg);
    background-image: url("../images/cinema-backdrop.png");
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0;
}

body::before,
body::after {
    position: fixed;
    inset: 0;
    content: "";
    pointer-events: none;
}

body::before {
    z-index: -2;
    background-image: url("../images/cinema-left-backdrop.png");
    background-repeat: no-repeat;
    background-size: clamp(520px, 54vw, 820px) auto;
    background-position: left top;
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 54%, rgba(0, 0, 0, .78) 68%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 54%, rgba(0, 0, 0, .78) 68%, transparent 100%);
}

body::after {
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(3, 7, 17, .22) 0%, rgba(3, 7, 17, .52) 42%, rgba(3, 7, 17, .92) 100%),
        linear-gradient(90deg, rgba(3, 7, 17, .42) 0%, rgba(3, 7, 17, .74) 18%, rgba(3, 7, 17, .58) 45%, rgba(3, 7, 17, .76) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
    align-items: center;
    gap: 18px;
    min-height: 76px;
    padding: 14px 36px;
    background: rgba(3, 7, 17, .76);
    border-bottom: 1px solid rgba(255, 255, 255, .15);
    backdrop-filter: blur(18px);
}

.brand {
    grid-column: 1;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    justify-self: start;
    min-width: 0;
    font-size: 18px;
    font-weight: 900;
}

.brand-cinema-icon {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: #ffffff;
    filter: drop-shadow(0 0 12px rgba(9, 183, 189, .35));
}

.brand-cinema-icon svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.3;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #ffffff;
    background: linear-gradient(135deg, #0dc1c5, #09646e);
    border: 1px solid rgba(115, 255, 255, .34);
    border-radius: 8px;
    box-shadow: 0 0 24px rgba(9, 183, 189, .36);
    font-size: 13px;
}

.primary-nav {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    justify-self: center;
}

.top-actions {
    grid-column: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    justify-self: end;
}

.nav-link,
.locale-switch a,
.icon-text-button,
.secondary-button,
.primary-button,
.favorite-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 8px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.nav-link {
    position: relative;
    padding: 11px 13px;
    color: #e5edf7;
    font-weight: 800;
}

.nav-link::after {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -17px;
    height: 3px;
    content: "";
    background: transparent;
    border-radius: 999px;
}

.nav-link.active {
    color: #ffffff;
    text-shadow: 0 0 16px rgba(95, 232, 238, .86);
}

.nav-link.active::after {
    background: #5fe8ee;
    box-shadow: 0 0 18px rgba(95, 232, 238, .9);
}

.locale-switch {
    display: inline-flex;
    padding: 4px;
    background: rgba(4, 8, 18, .62);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 8px;
}

.locale-switch a {
    min-height: 32px;
    padding: 5px 12px;
    color: #d6deeb;
    font-size: 13px;
    font-weight: 900;
}

.locale-switch a.active {
    color: #ffffff;
    background: linear-gradient(135deg, #0dbfc4, #087f86);
    box-shadow: 0 0 16px rgba(9, 183, 189, .55);
}

.icon-text-button,
.secondary-button {
    padding: 9px 18px;
    color: #ffffff;
    background: rgba(5, 9, 18, .56);
    border-color: rgba(255, 255, 255, .28);
}

.secondary-button:hover,
.icon-text-button:hover {
    border-color: var(--line-strong);
    box-shadow: 0 0 18px rgba(9, 183, 189, .28);
}

.primary-button {
    gap: 10px;
    padding: 10px 22px;
    color: #ffffff;
    background: linear-gradient(135deg, #0fb7b7, #067c82);
    border-color: rgba(95, 232, 238, .42);
    box-shadow: 0 16px 28px rgba(0, 113, 124, .28);
    font-weight: 900;
}

.primary-button:hover {
    background: linear-gradient(135deg, #13ccd0, #078b92);
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 44px 0 72px;
}

.notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 16px;
    margin-bottom: 18px;
    color: #f8fafc;
    background: rgba(11, 18, 32, .84);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.notice.success {
    border-color: rgba(24, 215, 158, .44);
    background: rgba(7, 78, 60, .62);
}

.notice.danger {
    border-color: rgba(255, 132, 132, .58);
    background: rgba(102, 26, 30, .68);
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 52px;
    align-items: center;
    min-height: calc(100vh - 188px);
}

.login-copy h1,
.section-header h1,
.detail-content h1 {
    margin: 0;
    color: #ffffff;
    font-size: 52px;
    line-height: 1.08;
    text-shadow: 0 12px 32px rgba(0, 0, 0, .56);
}

.login-copy p,
.hero-copy p,
.detail-subtitle {
    max-width: 560px;
    margin: 16px 0 0;
    color: #d4d9e3;
    font-size: 18px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.login-panel,
.search-bar,
.detail-content,
.empty-state {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.login-panel {
    display: grid;
    gap: 12px;
    padding: 28px;
}

.login-panel label,
.search-field label {
    color: #c2cad8;
    font-size: 13px;
    font-weight: 900;
}

.login-panel input,
.search-field input,
.search-field select {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    color: #ffffff;
    background: rgba(11, 18, 32, .76);
    border: 1px solid rgba(173, 190, 214, .38);
    border-radius: 8px;
    outline: none;
}

.login-panel input::placeholder,
.search-field input::placeholder {
    color: #c3ccda;
}

.login-panel input:focus,
.search-field input:focus,
.search-field select:focus {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 3px rgba(9, 183, 189, .16), 0 0 20px rgba(9, 183, 189, .18);
}

.search-field select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #d9e2ef 50%),
        linear-gradient(135deg, #d9e2ef 50%, transparent 50%);
    background-position:
        calc(100% - 20px) 20px,
        calc(100% - 14px) 20px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.input-wrap {
    position: relative;
    display: block;
}

.input-wrap input {
    padding-left: 44px;
}

.field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    color: #d9e2ef;
    transform: translateY(-50%);
    pointer-events: none;
}

.field-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.field-error {
    margin: -4px 0 4px;
    color: #ffaaa5;
    font-size: 13px;
}

.credential-note {
    display: grid;
    gap: 4px;
    margin-top: 4px;
    padding-top: 14px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.cinema-hero {
    min-height: 198px;
    align-items: center;
    padding-top: 4px;
}

.compact-hero {
    min-height: 128px;
}

.hero-favorite-button {
    gap: 10px;
    min-width: 172px;
    font-weight: 900;
    border-color: rgba(95, 232, 238, .54);
    box-shadow: 0 0 22px rgba(9, 183, 189, .28);
}

.button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    min-width: 20px;
    font-weight: 900;
}

.clapper-small {
    position: relative;
    width: 18px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 3px;
}

.clapper-small::before {
    position: absolute;
    left: -2px;
    top: -7px;
    width: 20px;
    height: 7px;
    content: "";
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 3px 3px 0 0;
    transform: rotate(-10deg);
    transform-origin: left bottom;
}

.search-bar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 220px 190px auto;
    gap: 14px 18px;
    align-items: end;
    padding: 20px 22px;
    margin-bottom: 26px;
}

.search-field {
    display: grid;
    gap: 7px;
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
    gap: 22px;
}

.result-note {
    margin: 0 0 14px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
}

.movie-card {
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    min-height: 100%;
    color: #ffffff;
    background: linear-gradient(180deg, rgba(12, 28, 48, .88), rgba(7, 17, 31, .94));
    border: 1px solid rgba(116, 151, 183, .26);
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .46);
}

.movie-card:hover {
    border-color: rgba(95, 232, 238, .52);
    box-shadow: 0 22px 48px rgba(0, 0, 0, .54), 0 0 24px rgba(9, 183, 189, .16);
}

.poster-shell {
    position: relative;
    overflow: hidden;
    background: #08111f;
}

.poster-link {
    display: block;
    overflow: hidden;
}

.poster-shell::after {
    position: absolute;
    inset: auto 0 0;
    height: 34%;
    content: "";
    background: linear-gradient(180deg, transparent, rgba(5, 11, 21, .86));
    pointer-events: none;
}

.poster {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    transition: transform .28s ease;
}

.movie-card:hover .poster {
    transform: scale(1.035);
}

.poster-empty {
    display: grid;
    place-items: center;
    min-height: 315px;
    padding: 20px;
    color: var(--muted);
    background: linear-gradient(145deg, #101929, #0a111d);
    text-align: center;
}

.year-badge,
.favorite-corner {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 8px;
    color: #ffffff;
    background: rgba(7, 15, 28, .72);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, .24);
}

.year-badge {
    left: 12px;
    top: 12px;
    min-width: 58px;
    padding: 0 11px;
    font-size: 13px;
    font-weight: 900;
}

.favorite-corner-form {
    margin: 0;
}

.favorite-corner {
    right: 12px;
    top: 12px;
    width: 36px;
    padding: 0;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.favorite-corner.is-added {
    color: var(--primary);
    border-color: rgba(95, 232, 238, .7);
    box-shadow: 0 0 16px rgba(9, 183, 189, .36);
}

.favorite-corner:disabled {
    cursor: default;
}

.favorite-corner:not(:disabled):hover {
    color: #ffffff;
    border-color: rgba(95, 232, 238, .82);
    background: rgba(9, 183, 189, .36);
    box-shadow: 0 0 18px rgba(9, 183, 189, .42);
}

.movie-card-body {
    display: grid;
    gap: 4px;
    align-content: start;
    min-height: 104px;
    padding: 15px 16px 18px;
}

.movie-card h2 {
    min-height: 44px;
    margin: 4px 0 0;
    font-size: 17px;
    line-height: 1.25;
}

.movie-card h2 a:hover {
    color: #8df5f8;
}

.movie-meta {
    margin: 0;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.movie-card-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 24px;
}

.movie-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    padding: 3px 8px;
    color: #ffe08a;
    background: rgba(122, 78, 12, .28);
    border: 1px solid rgba(247, 201, 72, .4);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.favorite-button,
.danger-button {
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    font-weight: 900;
}

.favorite-button {
    color: #6ff5f7;
    background: rgba(5, 117, 124, .14);
    border-color: rgba(28, 212, 218, .75);
}

.favorite-button:hover {
    color: #ffffff;
    background: linear-gradient(135deg, #0fb7b7, #067c82);
}

.favorite-button.is-added,
.favorite-button:disabled {
    color: #ffffff;
    background: linear-gradient(135deg, #0fb7b7, #067c82);
    border-color: rgba(95, 232, 238, .72);
    cursor: default;
}

.danger-button {
    color: #ffffff;
    background: rgba(224, 82, 82, .18);
    border-color: rgba(255, 132, 132, .62);
}

.danger-button:hover {
    background: rgba(224, 82, 82, .44);
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 260px;
    padding: 32px;
    color: var(--muted);
    text-align: center;
    border-style: dashed;
}

.empty-state h2 {
    margin: 0 0 8px;
    color: #ffffff;
    font-size: 24px;
}

.empty-state p {
    margin: 0;
}

.loader {
    margin: 26px auto 0;
    padding: 10px 16px;
    width: fit-content;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.sentinel {
    height: 1px;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: #7af5f8;
    font-weight: 900;
}

.detail-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 34px;
    align-items: start;
}

.detail-poster {
    position: sticky;
    top: 104px;
}

.detail-poster .poster,
.detail-poster .poster-empty {
    border: 1px solid rgba(95, 232, 238, .32);
    border-radius: 8px;
    box-shadow: var(--shadow), 0 0 28px rgba(9, 183, 189, .16);
}

.detail-year {
    z-index: 3;
}

.detail-content {
    min-width: 0;
    padding: 28px;
}

.detail-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 22px 0 24px;
    flex-wrap: wrap;
}

.detail-actions form {
    width: min(230px, 100%);
}

.rating {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 9px 13px;
    color: #ffe08a;
    background: rgba(122, 78, 12, .28);
    border: 1px solid rgba(247, 201, 72, .46);
    border-radius: 8px;
    font-weight: 900;
}

.facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 24px;
}

.facts div {
    padding: 13px;
    background: var(--panel-soft);
    border: 1px solid rgba(173, 190, 214, .12);
    border-radius: 8px;
}

.facts dt {
    color: #b7c2d2;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.facts dd {
    margin: 5px 0 0;
    color: #ffffff;
}

.plot-section,
.ratings-section {
    margin-top: 24px;
}

.plot-section h2,
.ratings-section h2 {
    margin: 0 0 9px;
    color: #ffffff;
    font-size: 22px;
}

.plot-section p {
    margin: 0;
    color: #d5dce8;
}

.rating-list {
    display: grid;
    gap: 10px;
}

.rating-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    color: #ffffff;
    background: var(--panel-soft);
    border: 1px solid rgba(173, 190, 214, .12);
    border-radius: 8px;
}

@media (max-width: 980px) {
    .topbar {
        grid-template-columns: 1fr;
        align-items: start;
        padding: 14px 20px 18px;
    }

    .brand,
    .primary-nav,
    .top-actions {
        grid-column: auto;
        justify-self: stretch;
    }

    .primary-nav {
        justify-content: flex-start;
        order: 3;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .top-actions {
        justify-content: flex-start;
        order: 2;
    }

    .nav-link::after {
        bottom: -6px;
    }

    .login-layout,
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .login-copy h1,
    .section-header h1,
    .detail-content h1 {
        font-size: 40px;
    }

    .search-bar {
        grid-template-columns: 1fr 1fr;
    }

    .search-field.keyword {
        grid-column: 1 / -1;
    }

    .search-bar .primary-button {
        grid-column: 1 / -1;
    }

    .detail-poster {
        position: static;
        max-width: 320px;
    }
}

@media (max-width: 640px) {
    body::before {
        background-size: 260px auto;
        background-position: -110px top;
    }

    body {
        background-position: 68% top;
    }

    .topbar {
        min-height: auto;
    }

    .brand {
        gap: 9px;
        font-size: 16px;
    }

    .brand-cinema-icon {
        display: none;
    }

    .top-actions {
        flex-wrap: wrap;
    }

    .page-shell {
        width: min(100% - 28px, 1180px);
        padding-top: 28px;
    }

    .login-copy h1,
    .section-header h1,
    .detail-content h1 {
        font-size: 34px;
    }

    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .cinema-hero {
        min-height: 170px;
    }

    .hero-copy p,
    .login-copy p,
    .detail-subtitle {
        font-size: 16px;
    }

    .search-bar,
    .facts {
        grid-template-columns: 1fr;
    }

    .login-panel,
    .detail-content,
    .search-bar {
        padding: 18px;
    }

    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
        gap: 16px;
    }

    .movie-card h2 {
        min-height: 48px;
        font-size: 15px;
    }

    .favorite-button,
    .danger-button {
        min-height: 40px;
        padding: 8px 10px;
        font-size: 14px;
    }

    .year-badge {
        height: 32px;
        min-width: 52px;
        padding: 0 8px;
    }

    .favorite-corner {
        width: 32px;
        height: 32px;
        font-size: 22px;
    }
}

@media (max-width: 420px) {
    .movie-grid {
        grid-template-columns: 1fr 1fr;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .locale-switch a {
        padding-inline: 10px;
    }

    .icon-text-button {
        width: 100%;
    }
}
