* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mode-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #4facfe;
}

.text-display {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    line-height: 1.6;
    min-height: 100px;
}

#textInput {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    resize: none;
    height: 100px;
}

#textInput:focus {
    outline: 2px solid #4facfe;
    background: rgba(255, 255, 255, 0.1);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

#resetBtn, #timeSelect {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

#resetBtn:hover {
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

#timeSelect {
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

#timeSelect option {
    background: #16213e;
    color: #fff;
}

.keyboard-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.keyboard-row {
    display: flex;
    gap: 0.3rem;
}

.key {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.key.active {
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    transform: translateY(2px);
}

.key.space {
    width: 200px;
}

.correct {
    color: #4facfe;
}

.incorrect {
    color: #ff4f4f;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .key {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .key.space {
        width: 150px;
    }
}

.text-display.loading {
    position: relative;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
}

.text-display.loading::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(79, 172, 254, 0.3);
    border-radius: 50%;
    border-top-color: #4facfe;
    animation: loading 0.8s ease infinite;
}

@keyframes loading {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .key {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .key.space {
        width: 150px;
    }
}

.trophy-popup {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #222;
  color: gold;
  padding: 10px 20px;
  font-size: 18px;
  border-radius: 12px;
  opacity: 0;
  transition: all 0.5s ease;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.trophy-popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Extended key widths */
.key[data-key="Tab"],
.key[data-key="CapsLock"],
.key[data-key="Enter"],
.key[data-key="ShiftLeft"],
.key[data-key="ShiftRight"],
.key[data-key="Backspace"],
.key[data-key="Control"],
.key[data-key="Alt"],
.key[data-key="Meta"],
.key[data-key="AltGraph"],
.key[data-key="ContextMenu"],
.key[data-key="ControlRight"] {
  width: 60px;
}

.key[data-key="Enter"],
.key[data-key="ShiftRight"] {
  width: 80px;
}

.key[data-key="Space"] {
  width: 200px;
}
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 220px;
    height: 100vh;
    background: rgba(22, 33, 62, 0.97);
    box-shadow: 2px 0 16px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 1000;
    padding-top: 2rem;
    transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}

.sidebar.collapsed {
    width: 64px;
    transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}

.sidebar.collapsed nav ul li a {
    font-size: 0;
    padding: 0.5rem 0.5rem;
}

.sidebar.collapsed nav ul li a::before {
    content: attr(data-icon);
    font-size: 1.5rem;
    display: block;
    text-align: center;
    color: #fff;
    margin-bottom: 0.2rem;
}
.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}
.sidebar nav ul li {
    margin-bottom: 1.5rem;
    width: 100%;
}
.sidebar nav ul li a {
    display: block;
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: background 0.3s, color 0.3s;
    background: rgba(255,255,255,0.02);
}
.sidebar nav ul li a:hover, .sidebar nav ul li a.active {
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    color: #16213e;
}
.container {
    margin-left: 240px;
    transition: margin-left 0.4s cubic-bezier(0.4,0,0.2,1);
}
.sidebar.collapsed ~ .container {
    margin-left: 84px;
}
/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 40px;
    height: 40px;
    background: rgba(22,33,62,0.95);
    border: none;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: background 0.3s;
}
.sidebar-toggle .bar {
    width: 22px;
    height: 3px;
    background: #fff;
    margin: 3px 0;
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-toggle.active .bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.sidebar-toggle.active .bar:nth-child(2) {
    opacity: 0;
}
.sidebar-toggle.active .bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}
/* About Page Typography */
.about-title {
    font-size: 3rem;
    margin-bottom: 2rem;
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}
.about-text {
    font-size: 1.35rem;
    line-height: 2.1;
    margin-bottom: 2.2rem;
    color: #e0e6f7;
    letter-spacing: 0.01em;
    transition: color 0.3s;
}
.about-text strong {
    color: #00f2fe;
}
@media (max-width: 900px) {
    .sidebar {
        width: 64px;
        padding-top: 1rem;
    }
    .sidebar.collapsed {
        width: 64px;
    }
    .container {
        margin-left: 84px;
    }
    .sidebar-toggle {
        left: 12px;
        top: 12px;
    }
}

.text-display.loading {
    position: relative;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
}

.text-display.loading::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(79, 172, 254, 0.3);
    border-radius: 50%;
    border-top-color: #4facfe;
    animation: loading 0.8s ease infinite;
}

@keyframes loading {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .key {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .key.space {
        width: 150px;
    }
}

.trophy-popup {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #222;
  color: gold;
  padding: 10px 20px;
  font-size: 18px;
  border-radius: 12px;
  opacity: 0;
  transition: all 0.5s ease;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.trophy-popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Extended key widths */
.key[data-key="Tab"],
.key[data-key="CapsLock"],
.key[data-key="Enter"],
.key[data-key="ShiftLeft"],
.key[data-key="ShiftRight"],
.key[data-key="Backspace"],
.key[data-key="Control"],
.key[data-key="Alt"],
.key[data-key="Meta"],
.key[data-key="AltGraph"],
.key[data-key="ContextMenu"],
.key[data-key="ControlRight"] {
  width: 60px;
}

.key[data-key="Enter"],
.key[data-key="ShiftRight"] {
  width: 80px;
}

.key[data-key="Space"] {
  width: 200px;
}
