/* Basic reset and styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Color variables */
:root {
    /* base */
    --white: #ffffff;

    /* neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --slate-50: #f8fafc;
    --slate-900: #1E293B;
    --red-100: #fee2e2;
    --red-200: #fecaca;
    --red-800: #991b1b;

    /* accents */
    --green-500: #10b981;
    --green-600: #059669;
    --purple-100: #eef2ff;
    --purple-500: #8b5cf6;
    --purple-600: #7c3aed;


    /* semantics */
    --text-default: #333333;
    --border-default: #f1f5f9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--slate-50);
    color: var(--text-default);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background-color: var(--white);
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 32px;
    height: 32px;
}

.update-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: pulse 2s infinite;
}

.update-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.update-btn svg {
    flex-shrink: 0;
    animation: rotate 2s linear infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    50% {
        box-shadow: 0 2px 12px rgba(16, 185, 129, 0.4);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.coffee-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 15px;
    background-color: #FF813F;
    color: #FFFFFF;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.3s linear;
    border: 1px solid transparent;
    box-shadow: 0px 1px 2px rgba(190, 190, 190, 0.5);
    line-height: 1.5;
}

.coffee-btn:hover {
    opacity: 0.85;
    box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5);
    text-decoration: none;
}

.coffee-btn svg {
    width: 20px;
    height: 20px;
    stroke: #FFFFFF;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .coffee-btn span {
        display: none;
    }

    .coffee-btn {
        padding: 8px 12px;
    }

    .app-title {
        font-size: 18px;
    }

    .app-logo {
        width: 24px;
        height: 24px;
    }
}

.settings-panel {
    background-color: var(--white);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-default);
}

.main {
    flex: 1;
    padding: 0 20px;
}

.content {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 0;
    display: grid;
    gap: 32px;
}

.start-section {
    padding: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    width: 100%;
    background-color: var(--green-500);
    color: var(--white);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.2);
}

.btn-primary:hover {
    background-color: var(--green-600);
}

.section {
    padding: 0;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
}

.placeholders {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 12px;
    padding: 0;
}

.placeholders li {
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-400);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.placeholders li.note--wrong {
    background-color: var(--red-100);
    color: var(--red-800);
    border-color: var(--red-200);
}

.placeholders li.note--correct {
    background-color: var(--purple-100);
    color: var(--purple-500);
    border-color: var(--purple-500);
}

.keyboard {
    background: linear-gradient(to bottom, #8b7355 0%, #6b5a47 100%);
    border-radius: 8px;
    padding: 20px 16px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    height: 160px;
}

.keyboard .kb-row {
    display: grid;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    column-gap: 0;
    position: absolute;
    left: 16px;
    right: 16px;
}

.keyboard .kb-row.kb-row--white {
    bottom: 16px;
    height: 120px;
}

.keyboard .kb-row.kb-row--black {
    bottom: 16px;
    height: 120px;
}

.key-btn {
    min-width: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border: none;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.key--white {
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 60%, #e9ecef 100%);
    color: var(--gray-500);
    grid-column: span 2;
    height: 100%;
    padding-bottom: 8px;
    border: 1px solid #d0d0d0;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), inset 0 -2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    margin: 0 1px;
}

.key--white:hover {
    background: linear-gradient(to bottom, #f8f9fa 0%, #e9ecef 60%, #dee2e6 100%);
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 -1px 2px rgba(0, 0, 0, 0.1);
}

.key--white:active {
    background: linear-gradient(to bottom, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(2px);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.key--black {
    background: linear-gradient(to bottom, #1a1a1a 0%, #0a0a0a 60%, #000000 100%);
    color: var(--white);
    z-index: 2;
    position: relative;
    grid-column: span 2;
    height: 70px;
    width: 60%;
    margin: 0 auto;
    padding-bottom: 6px;
    border-radius: 0 0 3px 3px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6), inset 0 -1px 2px rgba(255, 255, 255, 0.1);
    border: 1px solid #000;
    border-top: 1px solid #333;
    align-self: flex-start;
}

.key--black:hover {
    background: linear-gradient(to bottom, #2a2a2a 0%, #1a1a1a 60%, #0a0a0a 100%);
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.7), inset 0 -1px 2px rgba(255, 255, 255, 0.15);
}

.key--black:active {
    background: linear-gradient(to bottom, #0a0a0a 0%, #000000 100%);
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.key-btn.selected {
    box-shadow: 0 0 0 3px var(--purple-500), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.key--black.selected {
    box-shadow: 0 0 0 3px var(--purple-500), 0 3px 6px rgba(0, 0, 0, 0.6), inset 0 -1px 2px rgba(255, 255, 255, 0.1);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn-action-primary {
    width: 100%;
    background-color: var(--purple-500);
    color: var(--white);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.2);
}

.btn-action-primary:hover {
    background-color: var(--purple-600);
}

.btn-action-secondary {
    flex-grow: 1;
    background-color: var(--white);
    color: var(--purple-500);
    border: 2px solid var(--gray-200);
}

.btn-action-secondary:hover {
    border-color: var(--gray-300);
}


button[disabled],
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.footer {
    text-align: center;
    padding: 32px 20px;
}

.footer p {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 4px;
}

/* Selectors inside settings panel */
.selectors {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.selectors label {
    font-size: 16px;
    color: var(--gray-500);
    font-weight: 500;
}

.selectors select,
.selectors .select-like {
    padding: 6px 12px;
    font-size: 14px;
    color: var(--gray-700);
    font-weight: 600;
    background-color: var(--gray-100);
    border: none;
    border-radius: 8px;
}

.selectors .field {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.label-with-hint {
    position: relative;
}

.label-with-hint .hint {
    display: none;
}

#play-dictation[hidden] {
    display: none;
}

.btn--loading {
    position: relative;
    pointer-events: none;
}

.btn--loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

.btn--loading .btn-label {
    display: none;
}

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