* {
    box-sizing: border-box;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #ffffff;
    color: #222;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER */
header {
    width: 100%;
    background: #f2f2f2;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
    position: relative;
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #333;
}

header h1 a {
    color: #333;
    text-decoration: none;
}

header h1 a:hover {
    color: #333;
}

.logo-group {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-group h1 {
    margin: 0;
}

.tagline {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

/* NAV */
nav ul {
    list-style: none;
    display: flex;
    gap: 18px;
    margin: 0;
    padding: 0;
}

nav ul li a {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 10px 14px;
    border-radius: 8px;
    background: #4C878F;
    border: 1px solid #3a6b72;
    transition: none;
    display: inline-block;
}

nav ul li a:hover,
nav ul li a.active {
    background: #3f737a;
    color: #ffffff;
    border-color: #345e64;
}

.nav-lessons {
    position: relative;
}

.lessons-dropdown {
    position: absolute;
    top: 110%;
    right: 0;
    width: 360px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    padding: 16px;
    display: none;
    z-index: 999;
}

.nav-lessons:hover .lessons-dropdown {
    display: block;
}

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.lesson-tile {
    padding: 8px 0;
    border-radius: 6px;
    background: #f0f6f7;
    text-align: center;
    font-size: 0.9rem;
    cursor: pointer;
}

.lesson-tile:hover {
    background: #4C878F;
    color: #fff;
}

.lesson-tile.active {
    background: #2C6C75;
    color: #fff;
    font-weight: bold;
}

/* HAMBURGER */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #333;
    border-radius: 2px;
}

/* MAIN */
main {
    flex: 1;
    width: 100%;
}

.main-vert-top {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

.container {
    width: 100%;
    max-width: 900px;
    text-align: center;
}

.home-page {
    max-width: 1280px;
}

.home-page h2 {
    color: #333;
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 2rem;
}

.align-left {
    text-align: left;
    max-width: 760px;
    margin: 0 auto 20px auto;
    line-height: 1.7;
    color: #444;
}

/* LITTLE HORIZONTAL ANIMATION */
.data-stream {
    width: 140px;
    height: 10px;
    margin: 0 auto 28px auto;
    border-radius: 999px;
    background: #eee;
    overflow: hidden;
    position: relative;
}

.data-stream::before {
    content: "";
    position: absolute;
    top: 0;
    left: -40px;
    width: 40px;
    height: 100%;
    background: linear-gradient(90deg, transparent, #0077cc, transparent);
    animation: streamMove 2s linear infinite;
}

@keyframes streamMove {
    0% {
        left: -40px;
    }
    100% {
        left: 140px;
    }
}

/* FEATURE BOX */
.feature-box {
    max-width: 760px;
    margin: 30px auto 0 auto;
    padding: 24px;
    text-align: left;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.feature-box h3 {
    margin-top: 0;
    color: #333;
}

.feature-box p {
    color: #555;
}

/* FOOTER */
footer {
    background: #f2f2f2;
    border-top: 1px solid #ddd;
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 20px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.footer-inner a {
    color: #0077cc;
    text-decoration: none;
    font-weight: 500;
}

.footer-inner a:hover {
    text-decoration: underline;
    color: #005fa3;
}

/* MOBILE */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    nav {
        display: none;
        position: absolute;
        top: 100%;
        right: 20px;
        width: 220px;
        background: #111;
        border: 1px solid rgba(0, 212, 255, 0.15);
        border-radius: 10px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
        z-index: 999;
    }

    nav.show {
        display: block;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
    }

    nav ul li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    nav ul li:last-child {
        border-bottom: none;
    }

    nav ul li a {
        display: block;
        padding: 14px 16px;
        border-radius: 0;
    }

    .header-bar {
        padding: 14px 16px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .main-vert-top {
        padding: 30px 16px;
    }

    .home-page h2 {
        font-size: 1.7rem;
    }

    .align-left,
    .feature-box {
        max-width: 100%;
    }
}

.hands-panel {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.hand-container svg {
    max-width: 500px;
    width: 100%;
    height: auto;
}

/* default finger state */
[id^="finger-"] {
    opacity: 0;
    transition: none;
}
.hidden {
    display: none;
}
/* active finger */
.finger-active {
    opacity: 1;
}

.typing-box {
    max-width: 980px;
    margin: 24px auto 0 auto;
    padding: 20px;
    text-align: left;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.typing-box h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.lesson-instruction {
    margin-top: 0;
    margin-bottom: 16px;
    color: #555;
    line-height: 1.6;
}

.lesson-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px;
    gap: 18px;
    align-items: start;
}

.lesson-main {
    min-width: 0;
}

.lesson-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 20px auto 12px;
    flex-wrap: wrap;
}

.lesson-title {
    color: #333;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    min-width: 220px;
}

.lesson-btn {
    background: #4C878F;
    color: #ffffff;
    border: 1px solid #3a6b72;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: none;
}

.lesson-btn:hover {
    background: #3f737a;
}

.lesson-btn:disabled {
    background: #bfcfd2;
    border-color: #aab8bb;
    color: #777;
    opacity: 1;
    cursor: not-allowed;
}

.lesson-text {
    max-height: 180px;
    overflow-y: auto;
    padding: 18px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1.2rem;
    line-height: 1.8;
    color: #222;
    word-break: break-word;
}

.typing-input {
    width: 100%;
    min-height: 120px;
    max-height: 120px;
    overflow-y: auto;
    padding: 16px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    font-family: Arial, Helvetica, sans-serif;
    color: #222;
    background: #fff;
    outline: none;
}

.typing-input:focus {
    border-color: #0077cc;
    box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.12);
    min-height: 100px;
    max-height: 100px;
}

.lesson-stats-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-card {
    padding: 12px;
    border-radius: 12px;
    background: #f5f7f8;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 6px;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.feedback-message {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #ABCED3;
    color: #2C6C75;
    border: 1px solid #d6e6f5;
}

.feedback-message.success {
    background: #e7f7ea;
    color: #23653a;
    border-color: #cfead6;
}

.feedback-message.warning {
    background: #fff4dd;
    color: #8a6220;
    border-color: #f0dfb7;
}

.typed {
    color: #4E9A66;
}

.current {
    background: #2C6C75;
    color: #fff;
    border-radius: 4px;
    padding: 2px 4px;
}

.remaining {
    color: #888;
}

@media (max-width: 900px) {
    .lesson-layout {
        grid-template-columns: 1fr;
    }

    .lesson-stats-vertical {
    position: sticky;
    top: 20px;
}

    .lesson-text {
        max-height: 260px;
    }
}

@media (max-width: 640px) {
    .lesson-stats-vertical {
        grid-template-columns: 1fr;
    }
}

.intro-center {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 24px auto;
}

.trainer-top {
    display: grid;
    grid-template-columns: 220px minmax(0, 760px) 220px;
    align-items: center;
    gap: 24px;
    max-width: 1240px;
    margin: 0 auto 30px auto;
}

.trainer-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.trainer-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    transition: opacity 0.2s ease;
}

.trainer-side label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.2;
    cursor: pointer;
}

.trainer-side input[type="radio"] {
    margin: 0;
}

.trainer-keyboard-area {
    display: flex;
    justify-content: center;
    align-items: center;
}

.keyboard-shell {
    width: 100%;
    max-width: 760px;
    padding: 20px;
    background: #fff;
    /*border: 0px solid #ddd;
    border-radius: 12px;*/
    /*box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);*/
}

.keyboard-title {
    margin: 0 0 14px 0;
    font-size: 1rem;
    color: #333;
    text-align: center;
}

.keyboard-panel {
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 16px;
}

.keyboard-placeholder {
    color: #777;
    font-size: 0.95rem;
    text-align: center;
}

@media (max-width: 980px) {
    .home-page {
        max-width: 100%;
    }

    .trainer-top {
        display: grid;
        grid-template-columns: 1fr 760px 1fr;
        align-items: center;
        gap: 24px;
        max-width: 1100px;
        margin: 0 auto 30px auto;
    }

    .trainer-side svg {
        max-width: 180px;
    }

    .trainer-keyboard-area {
        order: -1;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .keyboard-shell,
    .typing-box,
    .align-left,
    .intro-center {
        max-width: 100%;
    }
}

.keyboard-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.keyboard-layout {
    width: 100%;
}

.on-screen-keyboard {
    width: 100%;
    max-width: 980px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;

    border: 1px solid rgba(90, 90, 90, 0.6);   /* darker */
    border-radius: 16px;

    background: rgb(255, 255, 255);

    box-shadow:
        0 6px 12px rgba(0, 0, 0, 0.45),   /* outer depth */
        inset 0 1px 0 rgba(255,255,255,0.04),
        inset 0 -2px 6px rgba(0,0,0,0.5); /* inner panel feel */
}

.kb-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.kb-key {
    height: 52px;
    flex: 1;
    border-radius: 8px;

    border: 1px solid rgba(110, 110, 110, 0.7); /* darker outline */

    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.04),
        rgba(255, 255, 255, 0.015)
    );

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 1px 2px rgba(0,0,0,0.5);

    color: rgba(110, 110, 110, 0.7);
}

.kb-key {
    font-size: 0.9rem;
    color: rgba(110, 110, 110, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.kb-key {
    transition: none;
}

.kb-key.pressed-key {
    border-color: #3E8E5A;
    background: rgba(62, 142, 90, 0.22);
    box-shadow:
        0 2px 3px rgba(0,0,0,0),
        inset 0 1px 0 rgba(255,255,255,1),
        inset 0 2px 3px rgba(0,0,0,0);
    transform: translateY(1px);
}

/* Top row special widths */
.key-tilde {
    flex: 1;
}

.key-backspace {
    flex: 2;
}

/* Row 2 */
.key-tab {
    flex: 1.5;
}

.key-backslash {
    flex: 1.5;
}

/* Row 3 */
.key-caps {
    flex: 1.8;
}

.home-key {
    position: relative;
}

.home-key::after {
    content: "";
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 2px;
    border-radius: 2px;
    background: rgba(100, 100, 100, 0.85);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.key-enter {
    flex: 2.2;
}

/* Row 4 */
.key-shift-left {
    flex: 2.3;
}

.key-shift-right {
    flex: 2.7;
}

/* Bottom row */
.key-ctrl,
.key-win,
.key-alt,
.key-fn,
.key-menu {
    flex: 1.2;
}

.key-space {
    flex: 6;
}

.active-key {
    border-color: #5FAF73;
    background: rgba(95, 175, 115, 0.18);

    box-shadow:
        0 2px 3px rgba(0,0,0,0.35),      /* same outer shadow */
        inset 0 1px 0 rgba(255,255,255,0.06),
        inset 0 2px 3px rgba(0,0,0,0.15); /* press feel */
}

/* PREVIEW IMAGE */
.preview-wrap {
    margin: 20px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.preview-wrap img {
    width: 100%;
    display: block;
    opacity: 0.9;
}

/* TEXT POLISH */
.resolution {
    color: #00d4ff;
    margin-top: 10px;
}

.small-note {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 15px;
}

/* Mobile */
@media (max-width: 900px) {
    .on-screen-keyboard {
        padding: 12px;
        gap: 6px;
    }

    .kb-row {
        gap: 6px;
    }

    .kb-key {
        height: 42px;
        border-radius: 6px;
    }
}

@media (max-width: 640px) {
    .on-screen-keyboard {
        padding: 10px;
        overflow-x: auto;
    }

    .kb-row {
        min-width: 760px;
    }
}

/* ============================= */
/* UNSUPPORTED DEVICE OVERLAY */
/* ============================= */

#unsupported-device {
    display: none; /* hidden on desktop */

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background: #ffffff;
    z-index: 9999;

    align-items: center;
    justify-content: center;
}

/* Show ONLY on mobile */
@media (max-width: 900px) {

    #unsupported-device {
        display: flex;
        margin: 20px;
    }

    /* Hide EVERYTHING else */
    body > *:not(#unsupported-device) {
        display: none !important;
    }
}