:root {
    --color-bg: #f5f6fa;
    --color-surface: #ffffff;
    --color-ink: #17171c;
    --color-muted: #6b6873;
    --color-border: #e5e5ec;
    --color-accent: #1fa8e0;
    --color-accent-dark: #0d84b8;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--color-bg);
    color: var(--color-ink);
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
    min-height: 80vh;
}

a {
    color: var(--color-accent-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 1.8rem;
    letter-spacing: -0.01em;
}

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1.3rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn--primary {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 2px 10px rgba(31, 168, 224, 0.35);
}

.btn--primary:hover {
    background: var(--color-accent-dark);
}

.btn--ghost {
    background: transparent;
    color: var(--color-ink);
    border: 1.5px solid var(--color-border);
}

.btn--ghost:hover {
    border-color: var(--color-accent);
    color: var(--color-accent-dark);
}

.site-header .btn--ghost,
.site-header .btn--primary {
    padding: 0.4rem 1.1rem;
    font-size: 0.9rem;
}

.site-header .btn--ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.7);
    text-shadow: none;
}

.site-header .btn--ghost:hover {
    color: var(--color-accent-dark);
    background: #fff;
}

.btn--danger {
    background: transparent;
    color: #c0392b;
    border: 1.5px solid #c0392b;
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
}

.btn--danger:hover {
    background: #c0392b;
    color: #fff;
}

form button[type="submit"]:not(.btn):not(.like-btn):not(.admin__logout) {
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.4rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
}

form button[type="submit"]:not(.btn):not(.like-btn):not(.admin__logout):hover {
    background: var(--color-accent-dark);
}

/* --- Header --- */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.5rem;
    background-image: url("../assets/ph-manga-1.png");
    background-size: cover;
    background-position: center;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header__brand img {
    display: block;
    height: 96px;
    width: auto;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.site-header__nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    max-width: 100%;
    padding: 0.3rem 0.6rem;
    background: rgba(10, 10, 16, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.site-header__user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-right: 0.25rem;
    color: #fff;
}

.site-header__user:hover {
    text-decoration: none;
    opacity: 0.85;
}

.site-header__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #fff;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
}

.site-header__link:hover {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.12);
}

.site-header__link--youtube:hover {
    color: #ff4d4d;
}

.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: #fff;
    font-weight: 700;
}

.avatar--small { width: 24px; height: 24px; font-size: 0.75rem; }
.avatar--normal { width: 32px; height: 32px; }
.avatar--large { width: 96px; height: 96px; font-size: 2.5rem; }

.site-header__logout-form {
    display: inline-flex;
    background-color: transparent;
    border: none;
}

/* --- Footer --- */

.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
    padding: 2.5rem 1rem;
    color: rgba(255, 255, 255, 0.75);
    background-image: linear-gradient(180deg, rgba(14, 14, 22, 0.55) 0%, rgba(14, 14, 22, 0.7) 100%), url("../assets/ph-manga-1.png");
    background-size: cover;
    background-position: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer a {
    color: #fff;
}

.site-footer__logo {
    height: 80px;
    width: auto;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    margin-bottom: 0.5rem;
}

.site-footer__tagline {
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.site-footer__copy {
    font-size: 0.85rem;
    margin: 0;
}

/* --- Forms --- */

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
}

form input,
form textarea {
    font-size: 1rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-ink);
    font-weight: 400;
}

form input:focus,
form textarea:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

form input[type="file"] {
    padding: 0;
    border: none;
    background: none;
}

form input[type="file"]::file-selector-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1.3rem;
    margin-right: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--color-accent);
    cursor: pointer;
    transition: background 0.15s ease;
}

form input[type="file"]::file-selector-button:hover {
    background: var(--color-accent-dark);
}

.auth-page__error {
    color: #c0392b;
    font-weight: 600;
}

/* --- Exercise gallery --- */

.exercise-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
}

.exercise-list__item a {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem;
    color: var(--color-ink);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.exercise-list__item a:hover {
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(23, 23, 28, 0.08);
    transform: translateY(-2px);
}

/* --- Drawings --- */

.drawings {
    margin-top: 2.5rem;
}

.drawings h2 {
    font-size: 1.3rem;
}

.drawing-upload {
    max-width: 520px;
    margin-bottom: 1.5rem;
}

.drawings__cta,
.drawings__empty {
    color: var(--color-muted);
}

.drawing-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
}

.drawing-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.drawing-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.drawing-card__author {
    color: var(--color-ink);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.like-form {
    display: contents;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    color: var(--color-muted);
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.like-btn:hover {
    color: #e0245e;
    border-color: #e0245e;
}

.like-btn--active {
    color: #e0245e;
    border-color: #e0245e;
    background: rgba(224, 36, 94, 0.08);
}

.like-btn--static {
    cursor: default;
}

/* --- Uniform media frames (A4-ish ratio) --- */

.media-frame {
    display: block;
    aspect-ratio: 210 / 297;
    object-fit: cover;
    border-radius: 8px;
    background: var(--color-bg);
}

.media-frame--thumb {
    width: 100%;
}

/* exercise reference images use the YouTube long-video ratio */
.media-frame--video {
    width: 100%;
    aspect-ratio: 16 / 9;
}

.media-frame--video-lg {
    flex: 1 1 420px;
    max-width: 720px;
    border-radius: 12px;
}

.media-frame--hero {
    height: 400px;
    width: calc(400px * 210 / 297);
    max-width: 100%;
    margin: 0 auto;
}

.js-zoomable {
    cursor: zoom-in;
}

/* --- Lightbox --- */

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(10, 10, 14, 0.9);
    z-index: 1000;
    cursor: zoom-out;
}

.lightbox-overlay--open {
    display: flex;
}

.lightbox-overlay__img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

body.lightbox-open {
    overflow: hidden;
}

/* --- Admin --- */

.admin-nav {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table__thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.admin-table__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-table__actions form {
    max-width: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.site-header__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(10, 10, 16, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
}

.site-header__burger span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.notice-bar {
    display: block;
    padding: 0.6rem 1rem;
    background: #fff4e0;
    color: #8a5a00;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid #f3d9a4;
}

.notice-bar:hover {
    text-decoration: none;
    background: #ffedcc;
}

@media (max-width: 720px) {
    .site-header {
        padding: 0.75rem 1rem;
        justify-content: space-between;
    }

    .site-header__brand img {
        height: 56px;
        border-radius: 12px;
    }

    .site-header__burger {
        display: flex;
    }

    .site-header__nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        padding: 0.75rem;
        border-radius: 16px;
        margin-top: 0.5rem;
    }

    .site-header__toggle:checked ~ .site-header__nav {
        display: flex;
    }

    .site-header__toggle:checked ~ .site-header__burger span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .site-header__toggle:checked ~ .site-header__burger span:nth-child(2) {
        opacity: 0;
    }

    .site-header__toggle:checked ~ .site-header__burger span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .site-header__nav .btn,
    .site-header__link,
    .site-header__user {
        justify-content: center;
        width: 100%;
        padding: 0.7rem 1rem;
        margin: 0;
    }

    .site-header__logout-form {
        display: flex;
    }

    .site-header__logout-form .btn {
        flex: 1;
    }

    .lang-menu {
        margin: 0.25rem 0 0;
        padding: 0.5rem 0 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .lang-menu__toggle {
        width: 100%;
        justify-content: center;
    }

    .lang-menu__list {
        position: static;
        transform: none;
        margin-top: 0.5rem;
        box-shadow: none;
    }
}

/* --- Home --- */

.home {
    max-width: 1080px;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, #17171c 0%, #23233a 60%, var(--color-accent-dark) 100%);
    color: #fff;
    border-radius: 20px;
}

.hero__text {
    min-width: 0;
    max-width: 100%;
}

.hero__kicker {
    margin: 0 0 0.5rem;
    font-weight: 600;
    opacity: 0.8;
}

.hero h1 {
    margin: 0 0 1rem;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    overflow-wrap: anywhere;
}

.hero__lead {
    max-width: 560px;
    line-height: 1.55;
    opacity: 0.92;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.hero__logo {
    height: 180px;
    width: auto;
    flex-shrink: 0;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.4));
}

.btn--youtube {
    background: #ff0000;
    color: #fff;
    gap: 0.5rem;
    box-shadow: 0 2px 12px rgba(255, 0, 0, 0.35);
}

.btn--youtube:hover {
    background: #cc0000;
}

.icon-youtube {
    flex-shrink: 0;
}

.home-section {
    margin-top: 3rem;
}

.home-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.home-section__head h2 {
    margin: 0;
    font-size: 1.4rem;
}

.video-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
}

.video-card a {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--color-ink);
}

.video-card a:hover {
    text-decoration: none;
}

.video-card__thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
}

.video-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.video-card a:hover .video-card__thumb img {
    transform: scale(1.04);
}

.video-card__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.video-card a:hover .video-card__play {
    opacity: 1;
}

.video-card__badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #ff0000;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.video-card__title {
    font-weight: 600;
    line-height: 1.3;
}

.video-card__date {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.drawing-list--compact {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.cta-band {
    margin-top: 3rem;
    padding: 2rem;
    text-align: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
}

.cta-band h2 {
    margin-top: 0;
}

.cta-band p {
    color: var(--color-muted);
}

/* --- Exercise page --- */

.exercise-brief {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

.video-link {
    position: relative;
    display: block;
    flex: 1 1 420px;
    max-width: 720px;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.video-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.video-link:hover img {
    transform: scale(1.04);
}

.video-link__play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.3rem;
    border-radius: 999px;
    background: #ff0000;
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.video-link:hover {
    text-decoration: none;
}

.exercise-brief .media-frame--video-lg {
    margin: 0;
}

.exercise-description {
    max-width: 720px;
    line-height: 1.55;
}

/* --- Profile --- */

.profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.profile__name {
    margin: 0 0 0.25rem;
}

.profile__stats {
    margin: 0;
    color: var(--color-muted);
}

.site-footer__youtube {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

@media (max-width: 720px) {
    .hero {
        flex-direction: column-reverse;
        text-align: center;
        padding: 2rem 1.25rem;
    }

    .hero__actions {
        justify-content: center;
    }

    .hero__logo {
        height: 120px;
    }
}

/* --- Home: steps & about --- */

.home-section__title {
    font-size: 1.4rem;
    margin: 0 0 1rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.step {
    position: relative;
    padding: 1.5rem 1.5rem 1.5rem 1.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.step::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    top: -0.75rem;
    left: 1rem;
    width: 1.75rem;
    height: 1.75rem;
    display: grid;
    place-items: center;
    background: var(--color-accent);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}

.step__icon {
    font-size: 1.6rem;
    display: block;
    margin-bottom: 0.5rem;
}

.step h3 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
}

.step p {
    margin: 0;
    color: var(--color-muted);
    line-height: 1.5;
}

.about {
    display: flex;
    gap: 2rem;
    align-items: center;
    padding: 2rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
}

.about h2 {
    margin-top: 0;
}

.about p {
    line-height: 1.55;
    color: var(--color-muted);
}

.about__logo {
    flex-shrink: 0;
    width: 140px;
}

.about__logo img {
    width: 100%;
}

.empty-state {
    padding: 1.5rem;
    text-align: center;
    color: var(--color-muted);
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    list-style: none;
    grid-column: 1 / -1;
}

.page-intro {
    color: var(--color-muted);
    max-width: 640px;
}

/* --- Language switcher --- */

.lang-menu {
    position: relative;
    margin-left: 0.25rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.lang-menu__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0.4rem 0.8rem;
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    user-select: none;
}

.lang-menu__toggle::-webkit-details-marker {
    display: none;
}

.lang-menu__toggle:hover,
.lang-menu[open] .lang-menu__toggle {
    border-color: var(--color-accent);
}

.lang-menu__chevron {
    transition: transform 0.15s ease;
}

.lang-menu[open] .lang-menu__chevron {
    transform: rotate(180deg);
}

.lang-menu__list {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 190px;
    margin: 0;
    padding: 0.4rem;
    list-style: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    z-index: 20;
}

.lang-menu__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    color: var(--color-ink);
    font-weight: 500;
    white-space: nowrap;
}

.lang-menu__item:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.lang-menu__item--active {
    font-weight: 700;
    color: var(--color-accent-dark);
}

.lang-menu__item--active::after {
    content: "\2713";
    margin-left: auto;
}

.flag {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* --- Profile avatar editor --- */

.avatar-editor {
    margin-top: 0.75rem;
}

.avatar-editor summary {
    cursor: pointer;
    color: var(--color-accent-dark);
    font-weight: 600;
}

.avatar-editor form {
    margin-top: 0.75rem;
}

.table-scroll {
    overflow-x: auto;
}

@media (max-width: 640px) {
    .about {
        flex-direction: column;
        text-align: center;
    }
}

/* --- Forms: hints, info boxes, recovery code --- */

.field-hint {
    font-weight: 400;
    color: var(--color-muted);
    font-size: 0.8rem;
}

.form-link {
    font-size: 0.9rem;
}

.form--bare {
    max-width: none;
    padding: 0;
    background: none;
    border: none;
}

.info-box {
    padding: 0.9rem 1.1rem;
    border-radius: 10px;
    background: #eaf6fc;
    border: 1px solid #c6e6f5;
    color: #0b4f6e;
    font-size: 0.92rem;
    line-height: 1.5;
    margin: 0;
}

.info-box p {
    margin: 0 0 0.6rem;
}

.info-box p:last-child {
    margin-bottom: 0;
}

.info-box--warning {
    background: #fff7e6;
    border-color: #f3d9a4;
    color: #7a4b00;
}

.info-box--success {
    background: #eaf8ee;
    border-color: #bfe5c9;
    color: #1d5d2f;
}

.auth-page .info-box {
    margin-top: 1rem;
}

.recovery-code {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.recovery-code__value {
    flex: 1 1 auto;
    padding: 0.9rem 1.1rem;
    background: #17171c;
    color: #fff;
    border-radius: 10px;
    font-size: 1.25rem;
    letter-spacing: 0.08em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow-wrap: anywhere;
    user-select: all;
}

.input--code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* --- Recovery method choice --- */

.choice {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    border: none;
}

.choice legend {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    padding: 0;
}

.choice__option {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
}

.choice__option:has(input:checked) {
    border-color: var(--color-accent);
    background: #eaf6fc;
}

.choice__option input {
    margin-top: 0.2rem;
}

.choice__option span {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.choice__option small {
    font-weight: 400;
    color: var(--color-muted);
    line-height: 1.4;
}

.auth-page--wide form {
    max-width: none;
}

.forgot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.forgot-option {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
}

.forgot-option h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}

.forgot-option form {
    border: none;
    padding: 0;
    background: none;
}

.forgot-option .muted {
    margin: 0 0 1rem;
    color: var(--color-muted);
    font-size: 0.92rem;
}

[hidden] {
    display: none !important;
}

/* --- Avatar picker --- */

.avatar-picker {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.avatar-picker__editor {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.avatar-picker.is-ready .avatar-picker__editor {
    display: flex;
}

.avatar-picker__stage {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-bg);
    box-shadow: 0 0 0 3px var(--color-accent), 0 8px 24px rgba(0, 0, 0, 0.15);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.avatar-picker__stage:active {
    cursor: grabbing;
}

.avatar-picker__stage img {
    position: absolute;
    top: 0;
    left: 0;
    max-width: none;
    transform-origin: 0 0;
    pointer-events: none;
}

.avatar-picker__zoom {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    width: 200px;
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
}

.avatar-picker__zoom input[type="range"] {
    flex: 1;
    padding: 0;
    border: none;
    background: none;
    accent-color: var(--color-accent);
}

.drawing-card--mine {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(31, 168, 224, 0.25);
}

.drawing-card__delete {
    margin-top: 0.25rem;
}

.drawing-card__delete .btn {
    width: 100%;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
}

.drawing-limit {
    max-width: 560px;
    margin-bottom: 1.5rem;
}

/* --- Like button: bounce + floating hearts --- */

.like-btn__heart {
    display: inline-block;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.like-btn:hover .like-btn__heart {
    animation: heart-bounce 0.6s ease;
}

.like-btn--active .like-btn__heart {
    animation: heart-glow 2s ease-in-out infinite;
}

.like-btn.is-popping .like-btn__heart {
    animation: heart-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes heart-bounce {
    0%, 100% { transform: scale(1.15); }
    25% { transform: scale(1.4); }
    50% { transform: scale(1.25); }
    75% { transform: scale(1.35); }
}

@keyframes heart-pop {
    0% { transform: scale(0.6); }
    60% { transform: scale(1.6); }
    100% { transform: scale(1); }
}

@keyframes heart-glow {
    0%, 100% { filter: drop-shadow(0 0 2px rgba(224, 36, 94, 0.4)); }
    50% { filter: drop-shadow(0 0 8px rgba(224, 36, 94, 0.8)); }
}

.floating-heart {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    user-select: none;
    color: #e0245e;
    will-change: transform, opacity;
    animation: heart-float var(--duration, 1.8s) ease-out forwards;
}

.floating-heart svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

@keyframes heart-float {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) rotate(0deg) scale(0.5);
    }
    50% {
        opacity: 0.85;
        transform: translate(calc(-50% + var(--dx) / 2), calc(-50% - 75px)) rotate(var(--rot-mid)) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% - 160px)) rotate(var(--rot-end)) scale(0.3);
    }
}

@media (prefers-reduced-motion: reduce) {
    .floating-heart,
    .like-btn:hover .like-btn__heart,
    .like-btn--active .like-btn__heart {
        animation: none;
    }
}

/* --- Home: exercise blocks with their drawings --- */

.exercise-block {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.exercise-block__head {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    color: var(--color-ink);
    margin-bottom: 1rem;
}

.exercise-block__head:hover {
    text-decoration: none;
}

.exercise-block__head:hover .exercise-block__title {
    color: var(--color-accent-dark);
}

.exercise-block__thumb {
    width: 220px;
    max-width: 40%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

.exercise-block__text {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.exercise-block__title {
    font-size: 1.2rem;
    font-weight: 700;
}

.exercise-block__desc {
    color: var(--color-muted);
    font-size: 0.92rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.exercise-block__cta {
    color: var(--color-accent-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

.exercise-block__empty {
    margin: 0;
    color: var(--color-muted);
}

.exercise-block .drawing-list {
    margin-top: 0;
}

@media (max-width: 560px) {
    .exercise-block__head {
        flex-direction: column;
        align-items: stretch;
    }

    .exercise-block__thumb {
        width: 100%;
        max-width: none;
    }
}

/* --- Password field with eye toggle --- */

.password-field {
    position: relative;
    display: flex;
}

.password-field input {
    flex: 1;
    padding-right: 2.6rem;
}

.password-field__toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
}

.password-field__toggle:hover {
    color: var(--color-accent-dark);
    background: rgba(31, 168, 224, 0.1);
}
