body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0px;
    background: #f0f0f0;
    color: #333;
    user-select: none;
}

h1 {
    text-align: center;
    margin-bottom: 10px;
}

#container {
    max-width: 80vw;
    margin: auto;
    padding: 2px;
    border-radius: 10px;
}

#quote {
    font-size: 30px;
    color: gray;
    display: flex;
    padding: 15px;
    min-height: 70px;
    margin-bottom: 10px;
    white-space: pre-wrap;
    width: 100%;
    /* min-width: 200px;  /* limit to 200px */
    display: flex;
    flex-wrap: wrap;
    /* allow wrapping */
    gap: 4px;
    /* spacing between characters */
    */
    /* /* font-size: 1.2rem; /* scales with screen */
    */ */ box-sizing: border-box;
    /* /* max-height: 80px;      /* adjust this height as needed */
    */ */
    /* overflow-y: auto;       /* enable vertical scroll */
    */
}

#quote span {
    display: inline-block;
}

#quote span.correct {
    color: green;
}

#quote span.incorrect {
    color: red;
}

/* #quote span.next-key {
            text-decoration: underline;
        } */

#inputArea {
    width: 100%;
    height: 70px;
    font-size: 30px;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

#stats {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
    /*background-color: #f3f3f3;*/
    padding: 10px;
}

#stats div {
    font-weight: bold;
}

#message {
    position: relative;
    top: -35px;
    margin: 10px 0;
    text-align: center;
    font-size: 28px;
    height: 2px;
    color: #ff9800;
}

#keyboard {
    /*min-width:700px;*/
    margin-top: 20px;
    user-select: none;
}

.row {
    display: flex;
    justify-content: center;
    margin-bottom: 5px;
}

.key {
    border: 1px solid #888;
    border-radius: 5px;
    /*background: #eee;*/
    width: 40px;
    height: 40px;
    line-height: 40px;
    margin: 2px;
    text-align: center;
    font-weight: bold;
    box-sizing: border-box;
    cursor: default;
    user-select: none;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    border-radius: 4px;
}

.key1 {
    background: yellow;
}

.key.wide {
    width: 60px;
}

.key.extra-wide {
    width: 100px;
}

.key.next-key {
    border: 3px solid #ff990069;
    box-shadow: 0 0 8px #ff9800;
    background-color: #fff3e0;
}

button {
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 6px;
    border: none;
    background: #2196f3;
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
}

button:hover {
    background: #1976d2;
}

#controls {
    /* display: flex; justify-content: space-between; flex-wrap: wrap; */
    gap: 10px;
    margin-top: 10px;
}

select,
input[type="text"] {
    padding: 10px 10px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #ccc;
    min-width: 150px;
    height: fit-content;
}

#customTextInput {
    width: 100%;
    margin-top: 10px;
    /* display: none; */
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 16px;
    resize: vertical;
    min-height: 60px;
}

#loginSection {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

#userInfo {
    margin-top: 15px;
    text-align: center;
}

#tabs {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.tab {
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 6px 6px 0 0;
    background: #eee;
    font-weight: bold;
    user-select: none;
}

.tab.active {
    background: #2196f3;
    color: white;
}

.tab-content {
    background: white;
    /*border: 1px solid #ddd;*/
    border-top: none;
    padding-left: 20px;
    /*max-width: 900px;*/
    max-width: 80vw;
    margin: auto;
    border-radius: 0 0 6px 6px;
    display: none;
}

.tab-content.active {
    display: block;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: center;
}

/* Dark theme */
body.dark {
    background: #121212;
    /*color: #e0e0e0;*/
}

body.dark #container {
    background: #1e1e1e;
    box-shadow: 0 0 15px #000;
}

body.dark #quote {
    border-color: #555;
    background: #2a2a2a;
}

body.dark #inputArea {
    background: #2a2a2a;
    border-color: #555;
    color: #ddd;
}

body.dark .key {
    background: #333;
    border-color: #555;
    color: #ddd;
}

body.dark .key.next-key {
    background-color: #4e2b00;
    border-color: #ffa000;
    box-shadow: 0 0 10px #ffa000;
}

body.dark button {
    background: #1976d2;
    color: #eee;
}

body.dark button:hover {
    background: #1565c0;
}

body.dark select,
body.dark input[type="text"],
body.dark #customTextInput {
    background: #2a2a2a;
    color: #ddd;
    border-color: #555;
}

.keyboardb {
    display: inline-block;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.rowb {
    display: flex;
    justify-content: center;
    margin: 17px 0;
}


.keyb {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 12px 14px;
    margin: 3px;
    min-width: 38px;
    text-align: center;
    user-select: none;
    font-weight: bold;
    cursor: default;
    box-sizing: border-box;
    position: relative;
    background: #fafafa;
    transition: background-color 0.3s;
}

/* Finger colors */
.left-pinky {
    background: #ffadad;
}

.left-ring {
    background: #ffd6a5;
}

.left-middle {
    background: #fdffb6;
}

.left-index {
    background: #caffbf;
}

.right-index {
    background: #9bf6ff;
}

.right-middle {
    background: #a0c4ff;
}

.right-ring {
    background: #bdb2ff;
}

.right-pinky {
    background: #ffc6ff;
}

.thumb {
    background: #d0f4de;
    min-width: 80px;
}

/* Wider keys */
.keyb.wide {
    min-width: 60px;
}

.keyb.space {
    min-width: 250px;
}

/* Home row highlight */
.home-row {
    border: 2px solid #333;
}

/* Finger label below key */
.finger-label {
    font-size: 10px;
    color: #555;
    position: absolute;
    bottom: -22px;
    width: 100%;
    left: 0;
}

/* Finger number at top-left */
.finger-number {
    font-size: 10px;
    color: #222;
    position: absolute;
    top: 2px;
    left: 4px;
    font-weight: normal;
}

/* Tooltip on hover */
.keyb:hover {
    background-color: #ddd;
}

.custom-img {
    width: 90vw;
}

@media (min-width: 768px) {

    /* Bootstrap's md breakpoint */
    .custom-img {
        width: 50vw;
    }
}


@media (max-width: 2000px) {
    .key {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .key.wide {
        width: 70px;
        height: 50px;
        font-size: 18px;
    }

    .key.extra-wide {
        width: 120px;
        height: 50px;
        font-size: 18px;
    }

    #quote span {
        width: 50px;
        height: 50px;
    }

    #container {
    max-width: 70vw;
    }
}

@media (max-width: 1224px) {
    .key {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .key.wide {
        width: 60px;
        height: 40px;
        font-size: 12px;
    }

    .key.extra-wide {
        width: 80px;
        height: 40px;
        font-size: 12px;
    }

    #quote span {
        padding-top: -2px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
         font-weight: 500;
    }

    .key.next-key {
        padding: 0px 10px;
        font-size: 1.2rem;
         font-weight: 500;
    }
    #container {
        max-width: 100vw;
    }
    .tab-content {
        max-width: 100vw;
    }
}

@media (max-width: 720px) {
    .key {
        width: 30px;
        height: 30px;
        font-size: 1.1rem;
    }

    .key.wide {
        width: 50px;
        height: 30px;
        font-size: 12px;
    }

    .key.extra-wide {
        width: 70px;
        height: 30px;
        font-size: 12px;
    }

    #quote span {
        padding-top: -2px;
        width: 30px;
        height: 30px;
        font-size: 1.1rem;
         font-weight: 500;
    }

    .next-key {
        padding: 0px 0px !important;
        /* font-size: 1.1rem; */
         /* font-weight: 500; */
    }
    .key.next-key {
        padding: 0px 0px !important;
        font-size: 1.1rem !important;
         /* font-weight: 500; */
    }
    #container {
        max-width: 100vw;
    }
    .tab-content {
        max-width: 100vw;
    }
}


@media (max-width: 600px) {
    .key {
        width: 20px;
        height: 25px;
        font-size: 12px;
        margin: 0px;
    }

    .key.wide {
        width: 30px;
        height: 25px;
        font-size: 10px;
    }

    .key.extra-wide {
        width: 30px;
        height: 25px;
        font-size: 10px;
    }

    #quote span {
        margin: 2px;
        padding-top: -2px;
        width: 30px;
        height: 30px;
        font-size: 1.1rem;
         font-weight: 500;
    }

    .next-key {
        padding: 0px 0px !important;
    }
    .key.next-key {
        padding: 0px 0px !important;
        font-size: 1rem !important;
    }
    #container {
        max-width: 100vw;
    }
    .tab-content {
        max-width: 100vw;
    }
    .content-area{
        padding: 0px 0px !important;

    }
}

body {
    background: #f6f8fa;
}

.sidebar {
    width: 240px;
    min-height: 100vh;
    background: white;
    border-right: 1px solid #e5e9ef;
    position: fixed;
    top: 0;
    left: 0;
    padding-top: 25px;
    transition: transform 0.3s ease;
}

@media(max-width:992px) {
    .sidebar.hide {
        transform: translateX(-100%);
    }
}

.content-area {
    margin-left: 240px;
    padding: 20px 0 0 25px;
    transition: margin-left 0.3s ease;
}

@media(max-width:992px) {
    .content-area {
        margin-left: 0;
    }
}

.sidebar .nav-link {
    color: #4a5568;
    font-weight: 500;
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background 0.25s ease, color 0.25s ease;
}

.sidebar .nav-link:hover {
    background: #eef3ff;
}

.sidebar .nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: #1a56db;
    border-radius: 0 4px 4px 0;
    animation: slideIndicator 0.3s ease forwards;
}

@keyframes slideIndicator {
    0% {
        height: 0%
    }

    100% {
        height: 100%;
    }
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, #dce7ff 0%, #eef3ff 100%);
    color: #1a56db;
    animation: activeFade 0.25s ease;
}

@keyframes activeFade {
    from {
        background: #fff;
        opacity: 0.3
    }

    to {
        opacity: 1
    }
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    margin-left: 15px;
    margin-bottom: 25px;
    color: #2b6cb0;
}

.menu-btn {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 26px;
    cursor: pointer;
    z-index: 1001;
}

@media(max-width:992px) {
    .menu-btn {
        display: block;
    }
}

#stats {
    z-index: -1;
}

/* @keyframes blink-underline {
            0%, 50%, 100% {
                text-decoration: underline;
            }

            25%, 75% {
                text-decoration: none;
            }
        }

        .next-key {
            animation: blink-underline 1s infinite;
        } */

span {
    /* border: 1px solid; */
    align-content: center;
    /* width: 40px !important;
    width: 40px !important; */
    text-align: center;
    margin: 3px;
    border-radius: 5px;

}

input {
    border: 2px solid #000;
    transition: border 0.3s, box-shadow 0.3s;
}

input:focus {
    outline: none;
    border: none;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.rating {
    font-size: 1.5rem;
    color: gold;
    user-select: none;
}

.rating .star {
    margin-right: 0.2rem;
}

.rating .star.inactive {
    color: #ccc;
}

.result-circle {
    width: 100px;
    height: 100px;
    margin: auto;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.5rem;
}

.result-circle svg {
    transform: rotate(-90deg);
}

.result-circle circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}

.result-circle .bg {
    stroke: #e9ecef;
}

.result-circle .progress {
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease;
}

.result-circle.orange .progress {
    stroke: #fd7e14;
}

.result-circle.green .progress {
    stroke: #198754;
}

.custom-focus:focus {
    border-color: lightgreen !important;
    box-shadow: 0 0 0 0.2rem rgba(144, 238, 144, 0.25);
    /* light green shadow */
}

.custom-placeholder::placeholder {
    color: lightgreen;
    opacity: 1;
    /* ensures full color opacity */
}

.custom-disabled:disabled {
    background-color: #9bf39b4f !important;
    opacity: 1;
    /* keep full color, no transparency */
}

.next-key {
    padding: 5px 12px;
    border: 3px solid #ff990069;
    box-shadow: 0 0 8px #ff9800;
    background-color: #fff3e0;
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 500;
    animation: borderBlink 1s step-start infinite;
}

@keyframes borderBlink {
    50% {
        border-color: transparent;
    }
}