/* =========================
   RESET & VARIABLES
========================= */
@font-face {
    font-family: "KurdFont";
    src: url("font.ttf") format("truetype");
}

* {
    font-family: "KurdFont", sans-serif;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #ffffff;
    --text: #000000;
    --key: #ffffff;
    --panel: #f2f2f2;
    --tools: #000;
    --border: #dddddd;
    --danger: #ccc;
}

body.dark {
    --bg: #121212;
    --text: #f5f5f5;
    --key: #1e1e1e;
    --panel: #1a1a1a;
    --tools: #fff;
    --danger: #444;
    --border: #2a2a2a;
}

/* =========================
   BASE
========================= */
body {
    margin: 0;
    font-family: "KurdFont", sans-serif;
    direction: rtl;
    background: var(--bg);
    color: var(--text);
    touch-action: manipulation;
}

/* =========================
   TOP BAR (FIXED SINGLE ROW)
========================= */
button svg use {
  fill: var(--tools); !important;
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.title {
    font-weight: 500;
    font-size: 1rem;
    flex-shrink: 0;
}

.actions {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.actions::-webkit-scrollbar {
    display: none;
}

.actions button {
    flex-shrink: 0;
    border: none;
    background: var(--panel);
    color: var(--text);
    padding: 10px 8px;
    border-radius: 8px;
    font-size: 16px;
    display: flex;
}

/* =========================
   EDITOR
========================= */
main {
    padding: 16px;
    padding-bottom: 280px;
    /* space for keyboard */
}

#textArea {
    min-height: 180px;
    font-size: 22px;
    line-height: 1.8;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--text);
    vertical-align: bottom;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* =========================
   KEYBOARD (FIXED BOTTOM)
========================= */
.keyboard {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--panel);
    padding: 10px 6px;
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    z-index: 15;
}

.row {
    display: flex;
    margin-bottom: 6px;
}

/* =========================
   KEYS
========================= */
.key {
    flex: 1;
    margin: 3px;
    padding: 14px 0;
    background: var(--key);
    color: var(--text);
    border-radius: 12px;
    font-size: 20px;
    border: none;
    user-select: none;
    font-family: "KurdFont", sans-serif;
}

.key:active {
    transform: scale(0.96);
}

.key.wide {
    flex: 1;
}

.key.space {
    flex: 3;
}

.key.back,
.key.danger {
    background: var(--danger);
}

/* =========================
   DESKTOP
========================= */
@media (min-width: 768px) {
    body {
        margin: auto;
    }

    .keyboard {
        border-radius: 22px;
    }
}