* {
    box-sizing: border-box;
}

:root {
    --bg-1: #eef2ff;
    --bg-2: #fdf2f8;
    --card: rgba(255, 255, 255, 0.92);
    --card-solid: #ffffff;
    --text: #1f2330;
    --muted: #6b7280;
    --soft: #f5f6fb;
    --line: #e5e7eb;
    --primary: #6c4df6;
    --primary-dark: #5638d8;
    --primary-soft: #ece8ff;
    --good-bg: #dff7e8;
    --good: #116b35;
    --bad-bg: #ffe1e1;
    --bad: #a40000;
    --current-bg: #fff0a6;
    --shadow: 0 18px 55px rgba(42, 34, 92, 0.14);
    --shadow-soft: 0 10px 26px rgba(42, 34, 92, 0.10);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(108,77,246,0.18), transparent 34%),
        radial-gradient(circle at top right, rgba(255,122,198,0.16), transparent 32%),
        linear-gradient(135deg, var(--bg-1), var(--bg-2));
    color: var(--text);
}

.app {
    max-width: 1080px;
    margin: 32px auto;
    background: var(--card);
    padding: 30px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.72);
    backdrop-filter: blur(10px);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 22px;
    padding: 8px 4px 2px;
}

h1,
h2,
h3 {
    margin-top: 0;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(30px, 4vw, 46px);
    margin-bottom: 8px;
}

h2 {
    font-size: clamp(24px, 3vw, 34px);
}

h3 {
    font-size: 20px;
}

.subtitle {
    color: var(--muted);
    font-size: 17px;
    line-height: 1.5;
    margin: 0;
}

.tabs {
    display: flex;
    gap: 10px;
    margin: 26px 0;
    flex-wrap: wrap;
    padding: 8px;
    background: rgba(255,255,255,0.62);
    border: 1px solid rgba(255,255,255,0.78);
    border-radius: 999px;
    box-shadow: var(--shadow-soft);
}

.tab {
    border: 0;
    border-radius: 999px;
    padding: 12px 17px;
    background: transparent;
    color: #394150;
    cursor: pointer;
    text-decoration: none;
    font-weight: 800;
    font-size: 15px;
    transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.tab:hover {
    transform: translateY(-1px);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.tab.active {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    box-shadow: 0 10px 22px rgba(108,77,246,0.28);
}

.link-tab {
    display: inline-block;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
    animation: panelIn 0.18s ease-out;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.intro-card,
.lesson-card,
.finger-map,
.game-intro,
.game-rules {
    background: rgba(255,255,255,0.76);
    border: 1px solid rgba(229,231,235,0.92);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 16px;
    box-shadow: 0 8px 22px rgba(31,35,48,0.055);
}

.intro-card,
.game-intro {
    background:
        linear-gradient(135deg, rgba(108,77,246,0.10), rgba(255,255,255,0.78)),
        rgba(255,255,255,0.86);
    border-color: rgba(108,77,246,0.18);
}

.lesson-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.lesson-card {
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.lesson-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(31,35,48,0.09);
}

.lesson-card ul,
.lesson-card ol {
    padding-left: 22px;
    margin-bottom: 0;
}

.lesson-card li {
    margin-bottom: 9px;
    line-height: 1.45;
}

.keyboard-note {
    margin-bottom: 8px;
    color: var(--muted);
}

.keyboard-row {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin: 14px 0 16px;
    align-items: center;
}

.keyboard-row span {
    display: inline-flex;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--card-solid);
    border: 1px solid var(--line);
    align-items: center;
    justify-content: center;
    font-weight: 900;
    box-shadow: 0 4px 0 rgba(31,35,48,0.11);
}

.keyboard-row .gap {
    background: transparent;
    border: 0;
    box-shadow: none;
    width: 18px;
}

.finger-map {
    border-left: 6px solid var(--primary);
}

.finger-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.finger-columns p {
    margin: 8px 0;
    line-height: 1.45;
}

.big-action {
    margin-top: 8px;
    padding: 15px 24px;
    font-size: 17px;
}

.practice-top {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 16px;
}

.keyboard-help {
    background: rgba(255,255,255,0.74);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 13px 15px;
    color: #444b5b;
    box-shadow: 0 8px 18px rgba(31,35,48,0.05);
}

kbd {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 7px;
    background: white;
    border: 1px solid #cfd4df;
    box-shadow: 0 2px 0 rgba(0,0,0,0.16);
    font-weight: 900;
    font-size: 13px;
}

label {
    font-weight: 800;
    color: #343b4c;
}

select,
textarea,
button {
    font-size: 16px;
}

select {
    width: 100%;
    padding: 12px 13px;
    margin: 10px 0 14px;
    border: 1px solid #d7dbe5;
    border-radius: 12px;
    background: white;
    color: var(--text);
    box-shadow: 0 5px 13px rgba(31,35,48,0.045);
}

select:focus {
    outline: 3px solid rgba(108,77,246,0.20);
    border-color: var(--primary);
}

.target {
    background: rgba(255,255,255,0.78);
    border: 1px solid var(--line);
    padding: 22px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    line-height: 1.75;
    font-size: 26px;
    font-family: Consolas, "Courier New", monospace;
    min-height: 58px;
    word-wrap: break-word;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 10px 22px rgba(31,35,48,0.055);
}

.target span {
    padding: 3px 2px;
    border-radius: 6px;
}

.target .correct {
    background: var(--good-bg);
    color: var(--good);
}

.target .wrong {
    background: var(--bad-bg);
    color: var(--bad);
}

.target .current {
    background: var(--current-bg);
    border-bottom: 4px solid #d9a600;
    box-shadow: 0 0 0 3px rgba(255,240,166,0.38);
}

textarea {
    width: 100%;
    height: 152px;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 2px solid #d7dbe5;
    resize: vertical;
    font-size: 23px;
    font-family: Consolas, "Courier New", monospace;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 12px 26px rgba(31,35,48,0.06);
}

textarea:focus {
    outline: 4px solid rgba(108,77,246,0.16);
    border-color: var(--primary);
}

.controls {
    margin-top: 15px;
}

button {
    padding: 11px 19px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    margin-right: 8px;
    font-weight: 900;
    box-shadow: 0 10px 21px rgba(108,77,246,0.24);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
    box-shadow: 0 13px 25px rgba(108,77,246,0.30);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 6px 14px rgba(108,77,246,0.22);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.stats div {
    background: rgba(255,255,255,0.78);
    border: 1px solid var(--line);
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: 0 8px 18px rgba(31,35,48,0.05);
}

.stats strong,
.game-stats strong {
    font-size: 20px;
    color: var(--primary-dark);
}

#message {
    font-weight: 900;
    padding: 10px 2px 0;
}

#message.success {
    color: var(--good);
}

#message.warning {
    color: #a45c00;
}

/* Igra */
.game-layout {
    display: grid;
    grid-template-columns: 292px 1fr;
    gap: 18px;
}

.game-sidebar {
    background: rgba(255,255,255,0.72);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: 0 10px 24px rgba(31,35,48,0.06);
}

.game-rules {
    background: white;
    padding: 15px;
    margin-top: 6px;
}

.game-rules p {
    margin: 8px 0;
}

.game-sidebar button {
    width: 100%;
    margin: 8px 0 0;
}

.game-main {
    min-width: 0;
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.game-stats div {
    background: rgba(255,255,255,0.78);
    border: 1px solid var(--line);
    padding: 13px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: 0 8px 18px rgba(31,35,48,0.05);
}

.game-area {
    position: relative;
    height: 450px;
    background:
        linear-gradient(rgba(108,77,246,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108,77,246,0.04) 1px, transparent 1px),
        linear-gradient(180deg, #ffffff, #f1efff);
    background-size: 34px 34px, 34px 34px, auto;
    border: 3px solid rgba(108,77,246,0.18);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(108,77,246,0.06), 0 18px 36px rgba(31,35,48,0.08);
}

.game-area::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 62px;
    height: 3px;
    background: repeating-linear-gradient(90deg, rgba(164,0,0,0.25), rgba(164,0,0,0.25) 12px, transparent 12px, transparent 22px);
    pointer-events: none;
}

.game-area:focus {
    outline: 4px solid rgba(108,77,246,0.24);
    outline-offset: 4px;
}

.falling-token {
    position: absolute;
    top: 0;
    left: 50px;
    min-width: 58px;
    padding: 13px 19px;
    border-radius: 18px;
    background: white;
    border: 2px solid var(--primary);
    box-shadow: 0 14px 28px rgba(42,34,92,0.18);
    text-align: center;
    font-family: Consolas, "Courier New", monospace;
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #2f276b;
}

.typed-buffer {
    position: absolute;
    left: 18px;
    bottom: 18px;
    min-height: 34px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 28px;
    font-weight: 900;
    color: var(--primary-dark);
    background: rgba(255,255,255,0.72);
    padding: 5px 10px;
    border-radius: 10px;
}

.game-message {
    position: absolute;
    right: 18px;
    bottom: 18px;
    max-width: 70%;
    background: rgba(255,255,255,0.90);
    border: 1px solid rgba(229,231,235,0.9);
    padding: 11px 15px;
    border-radius: 14px;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(31,35,48,0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 10px 22px rgba(31,35,48,0.055);
}

th,
td {
    padding: 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    background: var(--primary-soft);
    color: #33256f;
}

a {
    color: var(--primary-dark);
    font-weight: 900;
}

@media (max-width: 900px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    .game-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .tabs {
        border-radius: var(--radius-lg);
    }
}

@media (max-width: 760px) {
    .app {
        margin: 14px;
        padding: 18px;
        border-radius: 20px;
    }

    .lesson-grid,
    .finger-columns,
    .stats,
    .practice-top {
        grid-template-columns: 1fr;
    }

    .target {
        font-size: 20px;
    }

    .game-area {
        height: 380px;
    }

    .falling-token {
        font-size: 29px;
    }

    .site-header {
        align-items: flex-start;
    }
}

@media (max-width: 520px) {
    .tabs {
        display: grid;
        grid-template-columns: 1fr;
        border-radius: var(--radius-lg);
    }

    .tab {
        width: 100%;
        text-align: center;
    }

    .game-stats {
        grid-template-columns: 1fr;
    }

    button {
        width: 100%;
        margin: 7px 0 0;
    }
}


/* Igra prstiju */
.finger-game-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 18px;
}

.finger-game-area .finger-name-bubble {
    position: absolute;
    top: 74px;
    left: 50px;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(108, 77, 246, 0.12);
    border: 1px solid rgba(108, 77, 246, 0.24);
    color: #33256f;
    font-weight: 900;
    font-size: 14px;
    box-shadow: 0 8px 18px rgba(31,35,48,0.06);
}

.finger-game-area .falling-token {
    border-color: #ff7ac6;
    color: #5e1746;
}

.finger-game-area {
    background:
        radial-gradient(circle at top, rgba(255,122,198,0.14), transparent 34%),
        linear-gradient(rgba(108,77,246,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108,77,246,0.04) 1px, transparent 1px),
        linear-gradient(180deg, #ffffff, #fff0f8);
    background-size: auto, 34px 34px, 34px 34px, auto;
}

@media (max-width: 900px) {
    .finger-game-layout {
        grid-template-columns: 1fr;
    }
}

/* Igra riječi */
.word-game-intro {
    background:
        linear-gradient(135deg, rgba(22, 163, 74, 0.12), rgba(255,255,255,0.78)),
        rgba(255,255,255,0.86);
    border-color: rgba(22, 163, 74, 0.18);
}

.word-game-area {
    background:
        radial-gradient(circle at top, rgba(34,197,94,0.13), transparent 34%),
        linear-gradient(rgba(34,197,94,0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34,197,94,0.045) 1px, transparent 1px),
        linear-gradient(180deg, #ffffff, #effdf4);
    background-size: auto, 34px 34px, 34px 34px, auto;
    border-color: rgba(22, 163, 74, 0.22);
}

.word-token {
    min-width: 118px;
    border-color: #16a34a;
    color: #14532d;
    letter-spacing: 5px;
}

/* Edukacijski sustav */
.lesson-card ol li,
.lesson-card ul li {
    line-height: 1.55;
}

.practice-top label,
.game-sidebar label {
    font-weight: 800;
}
