
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&family=Special+Elite&family=Inter:wght@400;700&display=swap');
/* ===== NAVBAR ===== */
.header {
  width: 100%;
  background-color: transparent;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
  height: 80px;
}

.nav-container {
  max-width: 100%;
  margin: 0;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  color: var(--machine-color);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.5px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.9;
  transition: opacity 0.3s;
}

.logo-img {
  height: 32px;
  width: auto;
  filter: brightness(0) opacity(0.8);
}

.logo:hover {
  opacity: 1;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
}

.nav-links a {
  color: var(--machine-color);
  text-decoration: none;
  font-size: 28px;
  opacity: 0.8;
  transition: all 0.3s ease;
}

.nav-links a:hover {
  color: var(--accent-gold);
  opacity: 1;
  transform: scale(1.1);
}


:root {
    --bg-color: #8d6e63; 
    --machine-color: #222;
    --machine-shadow: #1a2429;
    --paper-color: #fff9f0;
    --text-color: #212121;
    --ink-color: #000;
    --ink-faded: #424242;
    --error-color: #e53935;
    --accent-gold: #ffb300;
    --key-cap: #eceff1;
    --key-stem: #546e7a;
    --font-typewriter: 'Courier Prime', monospace;
    --font-vintage: 'Special Elite', cursive;
}

/* Dark Mode Overrides */
body.dark-mode {
    --bg-color: #121212;
    --paper-color: #1e1e1e;
    --text-color: #e0e0e0;
    --machine-color: #000000;
}

body.dark-mode .desk { background-color: #1a1a1a; }
body.dark-mode .paper-sheet { background-color: #252525; color: #d1d1d1; border-color: #444; }
body.dark-mode .sticky-note { background: #332f1a; color: #eee; border-color: #444; }
body.dark-mode .word { color: #888; }
body.dark-mode .letter.correct { color: #fff; }

/* Navbar Contrast in Dark Mode */
body.dark-mode .logo,
body.dark-mode .nav-links a {
    color: #ccc;
}

body.dark-mode .logo-img {
    filter: brightness(0) invert(0.8);
}

body.dark-mode .nav-links a:hover {
    color: var(--accent-gold);
}

/* Dark Mode Buttons Contrast */
body.dark-mode .toggle-btn {
    background: #2a2a2a;
    border-color: #444;
    color: #888;
}

body.dark-mode .toggle-btn:hover {
    background: #333;
    color: #bbb;
}

body.dark-mode .toggle-btn.active {
    background: #444;
    border-color: #666;
    color: #fff;
}

body.dark-mode .filter-btn {
    border-color: #555;
    color: #888;
}

body.dark-mode .filter-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
}

body.dark-mode .filter-btn.active {
    background: #555;
    border-color: #777;
    color: #fff;
}

body.dark-mode .action-btn {
    border-color: #666;
    color: #aaa;
}

body.dark-mode .action-btn:hover {
    background: #666;
    color: #121212;
}

body.dark-mode .danger-btn {
    border-color: #ff5252;
    color: #ff5252;
}

body.dark-mode .danger-btn:hover {
    background: #ff5252;
    color: #fff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    
    background-image: 
        repeating-linear-gradient(90deg, transparent 0, transparent 50px, rgba(0,0,0,0.05) 50px, rgba(0,0,0,0.05) 52px),
        linear-gradient(to bottom, #8d6e63, #6d4c41);
    color: var(--text-color);
    font-family: var(--font-vintage);
    height: 100vh;
    height: 100dvh;
    
        overflow: hidden;
    padding-bottom: 0;
}

.desk {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 100%;
}


.typewriter {
    position: relative;
    width: 990px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    transform: scale(0.9);
    transform-origin: bottom center;
    margin-bottom: 0; 
}


.return-lever {
    position: absolute;
    top: 40px;
    left: -60px;
    width: 100px;
    height: 15px;
    background: #cfd8dc;
    border: 2px solid #546e7a;
    border-radius: 10px;
    transform: rotate(-10deg);
    z-index: 4;
    transform-origin: right center;
}

.return-lever::after {
    content: '';
    position: absolute;
    left: -5px;
    top: -20px;
    width: 30px;
    height: 40px;
    background: #eceff1;
    border: 2px solid #546e7a;
    border-radius: 5px;
}


.roller-section {
    width: 935px;
    height: 80px;
    background: #37474f;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 5;
    position: relative;
    border: 3px solid #263238;
}

.roller {
    flex-grow: 1;
    height: 100%;
    background: #212121;
    border-radius: 5px;
    margin: 0 15px;
    
    background-image: linear-gradient(to bottom, #212121 0%, #424242 20%, #212121 40%);
}

.knob {
    width: 60px;
    height: 60px;
    background: #455a64;
    border-radius: 50%;
    border: 3px solid #263238;
}


.paper-guide {
    position: absolute;
    bottom: 60px;
    width: 825px;
    height: 85vh;
    z-index: 3; 
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.paper-sheet {
    background: var(--paper-color);
    width: 100%;
    min-height: 100vh; 
    height: auto; 
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    padding: 40px 40px;
    padding-bottom: 50vh; 
    font-family: var(--font-typewriter);
    font-size: 1.65rem; 
    line-height: 2.0;
    color: #9e9e9e; 
    overflow: hidden;
    position: relative;
    border: 1px solid #e0e0e0;
}


.machine-body {
    width: 990px;
    height: 200px; 
    background: var(--machine-color);
    border-radius: 30px 30px 0 0;
    padding: 20px;
    z-index: 6;
    margin-top: -30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    
    box-shadow: 
        inset 0 10px 0 rgba(255,255,255,0.05),
        0 -5px 20px rgba(0,0,0,0.3);
    border: 4px solid #1a2429;
    border-bottom: none; 
}


.typebars-semicircle {
    width: 550px;
    height: 80px;
    background: #1a2429; 
    border-radius: 0 0 100px 100px;
    margin-top: 0;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    border-top: none;
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.5);
}


.typebars-inner {
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 10px,
        #37474f 10px,
        #37474f 12px
    );
    opacity: 0.5;
}


.brand-plate {
    display: none;
}


.controls-row {
    display: flex;
    justify-content: center;
    gap: 60px;
    width: 100%;
    padding: 20px;
    margin-top: 20px;
    position: relative;
}



.keyboard-area {
    display: flex;
    gap: 20px;
}


.mode-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    
    border: 3px solid #78909c; 
    
    background: radial-gradient(circle at 30% 30%, #cfd8dc, #90a4ae);
    color: #263238;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    transition: all 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
    outline: none;
    
    
    box-shadow: 
        
        inset 2px 2px 5px rgba(255,255,255,0.3),
        inset -2px -2px 5px rgba(0,0,0,0.2),
        
        0 6px 0 #546e7a,
        
        0 12px 10px rgba(0,0,0,0.4);
}

.mode-btn:hover {
    transform: translateY(1px);
    box-shadow: 
        inset 2px 2px 5px rgba(255,255,255,0.3),
        inset -2px -2px 5px rgba(0,0,0,0.2),
        0 5px 0 #546e7a,
        0 10px 9px rgba(0,0,0,0.4);
}

.mode-btn:active {
    transform: translateY(6px);
    box-shadow: 
        inset 2px 2px 10px rgba(0,0,0,0.3),
        0 0 0 #546e7a,
        0 2px 3px rgba(0,0,0,0.5);
}

.mode-btn.active {
    
    background: radial-gradient(circle at 30% 30%, #ffca28, #f57f17);
    color: #263238;
    border-color: #ff6f00;
    
    
    transform: translateY(6px);
    box-shadow: 
        inset 2px 2px 10px rgba(0,0,0,0.2),
        0 0 0 #e65100,
        0 2px 3px rgba(0,0,0,0.5);
}

.mode-btn.active:active {
    transform: translateY(7px);
    box-shadow: 
        inset 2px 2px 15px rgba(0,0,0,0.3),
        0 -1px 0 #e65100,
        0 1px 2px rgba(0,0,0,0.5);
}

.game-info-display {
    margin-top: 40px; 
    color: #90a4ae;
    font-size: 0.9rem;
    display: flex;
    gap: 20px;
    font-family: var(--font-typewriter);
}


.words {
    height: 100%;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    transition: transform 0.3s ease-out; 
}

.word {
    margin: 0 15px 0 0; 
    display: inline-block;
}

.letter {
    position: relative;
}

.letter.correct {
    color: #212121; 
    text-shadow: 0 0 1px rgba(0,0,0,0.2);
}

.letter.incorrect {
    color: var(--error-color);
    text-decoration: line-through;
    opacity: 0.7;
}

.letter.extra {
    text-decoration: none;
    opacity: 1;
}



.letter.current::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 10%;
    height: 80%;
    width: 2px;
    background-color: #000;
    animation: blink 1s infinite;
    opacity: 1;
}


.word.current-word-end .letter:last-child::after {
    content: '';
    position: absolute;
    right: 0;
    top: 10%;
    height: 80%;
    width: 2px;
    background-color: #000;
    animation: blink 1s infinite;
    opacity: 1;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}


.sticky-note {
    position: absolute;
    top: 50px;
    right: 50px;
    width: 200px;
    background: #fff176; 
    padding: 20px;
    box-shadow: 5px 5px 0 rgba(0,0,0,0.1);
    transform: rotate(2deg);
    font-family: 'Special Elite', cursive;
    z-index: 20;
    border: 1px solid #fdd835;
}

.sticky-note .pin {
    position: absolute;
    top: -10px;
    left: 50%;
    width: 15px;
    height: 15px;
    background: #e53935;
    border-radius: 50%;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.sticky-note h3 {
    text-align: center;
    border-bottom: 2px solid #f9a825;
    padding-bottom: 5px;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #333;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stat {
    text-align: center;
}

.stat .val {
    font-size: 1.5rem;
    font-weight: bold;
    color: #212121;
}

.stat .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #555;
}


.restart-note {
    top: 320px; 
    right: 50px;
    transform: rotate(-3deg);
    background: #ffcc80; 
    border-color: #ffb74d;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px; 
}

.restart-note:hover {
    transform: scale(1.05) rotate(-3deg);
}

#restart-button {
    margin-top: 0;
    cursor: pointer;
    font-weight: bold;
    color: #3e2723; 
    outline: none;
    border: none;
    background: transparent;
    font-family: var(--font-vintage); 
    font-size: 1.4rem;
    display: block;
    width: 100%;
}

#restart-button:hover,
#restart-button:focus {
    color: #000; 
}

.hidden {
    display: none !important;
}


.modal {
    display: none; 
    position: fixed; 
    z-index: 100; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(2px);
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: #fff9c4;
    margin: 10% auto; 
    padding: 40px;
    border: 4px solid #263238;
    width: 60%; 
    box-shadow: 10px 10px 0 rgba(0,0,0,0.2);
    font-family: var(--font-typewriter);
    position: relative;
    border-radius: 10px;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 2px solid #e0e0e0;
    padding: 12px;
    text-align: left;
}

th {
    background-color: #fff59d;
    font-weight: bold;
    border-color: #fbc02d;
}

th.sortable {
    cursor: pointer;
    transition: background-color 0.2s;
}

th.sortable:hover {
    background-color: #fff176;
}

th.sortable i {
    margin-left: 5px;
    font-size: 0.8em;
    opacity: 0.5;
}

th.sortable.asc i::before {
    content: "\f0de"; 
    opacity: 1;
}

th.sortable.desc i::before {
    content: "\f0dd"; 
    opacity: 1;
}


.settings-container {
    margin-top: 20px;
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.toggle-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toggle-btn {
    padding: 10px 20px;
    border: 2px solid #263238;
    background: #eceff1;
    color: #263238;
    font-family: var(--font-typewriter);
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
}

.toggle-btn:hover {
    background: #cfd8dc;
}

.toggle-btn.active {
    background: #263238;
    color: #fff;
}


.typebars-inner.active {
    animation: type 0.1s ease-out;
}

@keyframes type {
    0% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

.paper-sheet.tearing {
    transition: transform 0.6s ease-in, opacity 0.6s ease-in;
    pointer-events: none;
}

.paper-sheet.animating {
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}


@media screen and (max-width: 1200px) {
    .typewriter {
        transform: scale(0.85);
    }
}

@media screen and (max-width: 992px) {
    .typewriter {
        transform: scale(0.7);
    }
    
    .sticky-note {
        transform: scale(0.8) rotate(2deg);
        right: 20px;
        top: 20px;
    }
    
    .restart-note {
        transform: scale(0.8) rotate(-3deg);
        right: 20px;
        top: 250px;
    }
}

@media screen and (max-width: 768px) {
    .typewriter {
        transform: scale(0.55);
        margin-bottom: 0;
    }
    
    .desk {
        padding-bottom: 0;
        align-items: flex-end;
    }
    
    .sticky-note {
        position: fixed;
        top: 10px;
        right: 10px;
        width: auto;
        min-width: 120px;
        padding: 10px;
        transform: none;
        font-size: 0.8rem;
        z-index: 1000;
        border-radius: 5px;
    }
    
    .sticky-note .pin {
        display: none;
    }
    
    .sticky-note h3 {
        font-size: 1rem;
        margin-bottom: 5px;
        padding-bottom: 2px;
        border-bottom-width: 1px;
    }
    
    .stat-row {
        margin-bottom: 5px;
    }
    
    .stat .val {
        font-size: 1.1rem;
    }
    
    .stat .label {
        font-size: 0.6rem;
    }
    
    .restart-note {
        position: fixed;
        top: 10px;
        left: 10px;
        right: auto;
        width: auto;
        height: auto;
        padding: 8px 15px;
        transform: none;
        z-index: 1000;
        border-radius: 5px;
        box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    }
    
    .restart-note .pin {
        display: none;
    }
    
    #restart-button {
        font-size: 1rem;
    }
    
    .modal-content {
        width: 90%;
        margin: 30% auto;
        padding: 20px;
    }
    
    .controls-row {
        gap: 20px;
        padding: 10px;
    }
    
    .mode-btn {
        width: 45px;
        height: 45px;
        font-size: 0.9rem;
    }
}

@media screen and (max-width: 576px) {
    .typewriter {
        transform: scale(0.42);
    }
}

@media screen and (max-width: 400px) {
    .typewriter {
        transform: scale(0.36);
    }
}

@media screen and (max-height: 600px) {
    .typewriter {
        transform: scale(0.45);
    }
    .desk {
        padding-bottom: 0;
    }
}


.sheet-content {
    width: 100%;
    color: var(--text-color);
    font-family: var(--font-typewriter);
    padding-bottom: 100px;
}

.sheet-content h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
    text-decoration: underline;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.sheet-content.hidden {
    display: none;
}

.sheet-footer {
    margin-top: 50px;
    display: flex;
    justify-content: center;
    gap: 30px;
    padding-bottom: 50px;
}

.action-btn, .danger-btn {
    padding: 12px 25px;
    font-family: var(--font-typewriter);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #263238;
    background: transparent;
    transition: all 0.2s;
    text-transform: uppercase;
}

.action-btn:hover {
    background: #263238;
    color: #fff;
}

.danger-btn {
    border-color: #d32f2f;
    color: #d32f2f;
}

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


.stats-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 2px solid #5d4037;
    color: #5d4037;
    padding: 5px 15px;
    font-family: var(--font-typewriter);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: rgba(93, 64, 55, 0.1);
}

.filter-btn.active {
    background: #5d4037;
    color: #fff9c4;
}

.table-container {
    width: 100%;
    margin-top: 20px;
}

.global-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.1rem;
    border: 2px solid #263238;
}

.global-stats-table th, .global-stats-table td {
    border: 1px solid #263238;
    padding: 12px;
    text-align: left;
}

.global-stats-table th {
    background-color: rgba(0,0,0,0.05);
    font-weight: bold;
    text-transform: uppercase;
    border-bottom: 2px solid #263238;
}

.global-stats-table tr:nth-child(even) {
    background-color: rgba(0,0,0,0.02);
}

.settings-container {
    max-width: 700px;
    margin: 0 auto;
}

.setting-group {
    margin-bottom: 40px;
    border-bottom: 1px dashed #aaa;
    padding-bottom: 20px;
}

.setting-group:last-child {
    border-bottom: none;
}

.setting-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-transform: uppercase;
}

.toggle-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.toggle-btn {
    padding: 10px 20px;
    font-size: 1.1rem;
    border: 2px solid #263238;
    background: transparent;
    color: #263238;
    font-family: var(--font-typewriter);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    background: rgba(38, 50, 56, 0.1);
}

.toggle-btn.active {
    background: #263238;
    color: #fff;
}

/* Zen Mode */
body.zen-mode .words {
    color: var(--ink-color);
}

body.zen-mode .letter {
    color: var(--ink-color);
    border-bottom: none;
}

body.zen-mode .letter.current {
    background-color: transparent;
    border-bottom: 2px solid var(--ink-color);
}

.zen-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--ink-color);
    animation: blink 1s infinite;
    vertical-align: middle;
    margin-left: 1px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
