@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap');

:root {
    --bg-color: #0d0d0d;
    --container-bg: #1a1a1a;
    --text-color: #e0e0e0;
    --accent-color: #00ffc0;
    --key-bg: #2b2b2b;
    --key-active-bg: #00ffc0;
    --key-active-text: #0d0d0d;
    --border-color: #3a3a3a;
    --glow-color: #00ffc0;
    --history-bg: #151515;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto Mono', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 40px;
    background-color: var(--container-bg);
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 255, 192, 0.1);
    border: 1px solid var(--border-color);
    animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

h1 {
    font-size: 3em;
    margin-bottom: 5px;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(0, 255, 192, 0.5);
    letter-spacing: 2px;
    text-align: center;
}

p {
    font-size: 1.1em;
    margin-bottom: 40px;
    color: #999;
    font-style: italic;
    text-align: center;
}

.keyboard-area {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.main-keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-numpad {
    display: flex;
    gap: 15px;
}

.row {
    display: flex;
    gap: 8px;
}

.key {
    background-color: var(--key-bg);
    border-radius: 6px;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    min-width: 45px;
    transition: background-color 0.1s ease, transform 0.1s ease, box-shadow 0.1s ease;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    position: relative;
    
    /* Penyesuaian untuk teks panjang */
    padding: 0 8px;
    overflow: hidden;
    white-space: nowrap;
}

/* Penyesuaian ukuran font untuk tombol yang panjang */
.key span {
    font-size: 1em; /* Ukuran standar */
    display: block;
}

.key.long-text span,
.mouse-key span { /* Tambahkan .mouse-key span */
    font-size: 0.7em; /* Ukuran lebih kecil untuk teks panjang */
    line-height: 1;
}

.key.active {
    background-color: var(--key-active-bg);
    color: var(--key-active-text);
    box-shadow: 0 0 20px var(--glow-color);
    transform: scale(1.05);
    animation: glow 1.2s ease-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 10px var(--glow-color), 0 0 20px var(--glow-color); }
    to { box-shadow: 0 0 20px var(--glow-color), 0 0 30px var(--glow-color); }
}

/* Specific Key Sizes */
.key.backspace { min-width: 90px; }
.key.tab, .key.capslock { min-width: 70px; }
.key.shift { min-width: 110px; }
.key.enter { min-width: 90px; }
.key.spacebar { flex-grow: 1; }

.nav-keys {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.arrow-keys {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 25px;
}

.arrow-keys .key {
    min-width: 45px;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.numpad .key {
    min-width: 45px;
}

.numpad .key.plus {
    height: 108px;
    grid-row: span 2;
}

.numpad .key.numpad-enter {
    height: 108px;
    grid-row: span 2;
}

.numpad .key.zero {
    grid-column: span 2;
}

/* Mouse Keys */
.mouse-area {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.mouse-keys {
    display: flex;
    gap: 8px;
}

.mouse-key {
    background-color: var(--key-bg);
    border-radius: 6px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    min-width: 90px; /* Lebar minimum ditambah */
    transition: background-color 0.1s ease, transform 0.1s ease, box-shadow 0.1s ease;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
}

.mouse-key.active {
    background-color: var(--key-active-bg);
    color: var(--key-active-text);
    box-shadow: 0 0 20px var(--glow-color);
    transform: scale(1.05);
}

/* History Log Styles */
.history-section {
    margin-top: 40px;
    text-align: left;
}

.history-log {
    height: 100px;
    background-color: var(--history-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.9em;
    color: var(--text-color);
    line-height: 1.5;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
}

.history-log span {
    padding: 4px 8px;
    border-radius: 4px;
    background-color: var(--key-bg);
    color: var(--text-color);
    border: 1px solid #444;
}

.exit-instruction {
    margin-top: 20px;
    font-size: 0.9em;
    color: #555;
    text-align: center;
}

.key-combo {
    font-family: 'Roboto Mono', monospace;
    background-color: #2a2a2a;
    padding: 4px 8px;
    border-radius: 6px;
    color: #888;
}