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

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    line-height: 1.5;
}

/* Skip to main content link för tangentbordsnavigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 10px 15px;
    z-index: 10000;
    font-weight: 600;
    border-radius: 0 0 8px 0;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Förbättrad fokushantering */
*:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    gap: 20px;
    grid-template-areas:
        "header header"
        "main aside";
}

header {
    grid-area: header;
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

header h1 {
    color: #667eea;
    font-size: 2em;
    margin: 0;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 25px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

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

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    min-width: 80px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat.primary .label {
    color: rgba(255,255,255,0.9);
}

.stat.primary .value {
    color: white;
}

.stat .label {
    color: #666;
    font-weight: 500;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat .value {
    font-size: 1.4em;
    font-weight: bold;
    color: #667eea;
}

.best-badge {
    font-size: 1.6em;
    transition: transform 0.2s ease;
}

.best-badge:hover {
    transform: scale(1.2);
}

.best-badge-name {
    font-size: 0.85em;
    font-weight: 600;
    color: #667eea;
}

#best-badge-container {
    padding: 8px 16px;
}

main {
    grid-area: main;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.event-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.event-card h2 {
    margin: 0;
    font-size: 1.3em;
}

.event-counter {
    background: rgba(255, 255, 255, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.event-description {
    font-size: 1.1em;
    line-height: 1.6;
}

.level-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.level-label {
    color: #667eea;
    font-weight: 600;
    font-size: 1em;
}

.level-dropdown {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.level-dropdown:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.booking-area h3 {
    color: #667eea;
    margin-bottom: 20px;
}

/* Bokföringsorder tabell */
.booking-order {
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.booking-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    overflow: hidden;
    min-width: 320px;
}

.booking-table thead tr:first-child th {
    background: #667eea;
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid #5568d3;
}

.booking-table thead tr:first-child th {
    border-bottom: 2px solid #5568d3;
}

.booking-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.booking-table tbody tr:hover {
    background: #f8f9fa;
}

.booking-table td {
    padding: 8px;
    vertical-align: middle;
}

.booking-table .account-select {
    width: 100%;
    padding: 10px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
}

.booking-table input[type="number"] {
    width: 100%;
    padding: 10px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1em;
    text-align: right;
    box-sizing: border-box;
}

.booking-table input[type="number"]:focus,
.booking-table .account-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.booking-table input[type="number"]:disabled {
    background: #e9ecef;
    color: #666;
    cursor: not-allowed;
}

.booking-table .totals-row {
    background: #f0f3ff;
    font-weight: 600;
}

.booking-table .totals-row td {
    padding: 12px 8px;
    border-top: 2px solid #667eea;
}

.booking-table .total-cell {
    text-align: right;
    color: #667eea;
    font-size: 1.1em;
}

.booking-table .balance-ok {
    color: #28a745;
}

.booking-table .balance-error {
    color: #dc3545;
}

.btn-remove {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: background 0.3s;
    white-space: nowrap;
}

.btn-remove:hover {
    background: #ff5252;
}

.controls {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-hint {
    background: #ffc107;
    color: #333;
}

.btn-hint:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.btn-skip {
    background: #6c757d;
    color: white;
}

.btn-skip:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.feedback {
    margin-top: 25px;
    padding: 20px;
    border-radius: 8px;
    font-size: 1.1em;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

.feedback h3 {
    margin-bottom: 10px;
}

/* Mobil feedback toast */
.mobile-toast {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    animation: toastSlideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.mobile-toast.correct {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.mobile-toast.incorrect {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    color: white;
}

.mobile-toast .toast-icon {
    font-size: 2.5em;
    animation: bounceIn 0.5s ease-out;
}

.mobile-toast .toast-content {
    flex: 1;
}

.mobile-toast .toast-title {
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 4px;
}

.mobile-toast .toast-message {
    font-size: 0.95em;
    opacity: 0.95;
}

.mobile-toast .toast-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes toastSlideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Dölj toast på desktop, visa på mobil */
.mobile-toast {
    display: none;
}

@media (max-width: 768px) {
    .mobile-toast {
        display: flex;
    }
}

.hint {
    margin-top: 20px;
    padding: 15px 20px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 5px;
    animation: slideIn 0.3s ease-out;
}

/* Loading state */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 100;
    border-radius: 10px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #667eea;
    font-weight: 600;
    font-size: 0.95em;
}

.event-card {
    position: relative;
}


.account-list {
    font-size: 0.9em;
}

.account-group {
    margin-bottom: 20px;
}

.account-group-title {
    font-weight: bold;
    color: #764ba2;
    margin-bottom: 8px;
    font-size: 1.05em;
}

.account-item {
    padding: 6px 10px;
    margin-bottom: 4px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.95em;
}

.account-number {
    font-weight: bold;
    color: #667eea;
    margin-right: 8px;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main"
            "aside";
    }

    aside {
        position: static;
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    header {
        padding: 15px;
    }

    main {
        padding: 15px;
    }

    /* Mobil bokföringsorder - förbättrad */
    .booking-table {
        min-width: 100%;
        font-size: 0.95em;
    }

    .booking-table thead th {
        padding: 12px 6px;
        font-size: 0.9em;
    }

    .booking-table td {
        padding: 8px 4px;
    }

    /* Bättre touchmål på mobil */
    .booking-table .account-select {
        padding: 12px 8px;
        font-size: 0.95em;
        min-height: 44px;
        min-width: 120px;
    }

    .booking-table input[type="number"] {
        padding: 10px 6px;
        font-size: 1em;
        width: 65px;
        min-height: 44px;
    }

    .booking-table .btn-remove {
        padding: 8px 10px;
        font-size: 0.85em;
        min-width: 36px;
        min-height: 44px;
    }

    /* Header på mobil */
    .header-top {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .header-badge {
        justify-content: center;
    }

    header h1 {
        font-size: 1.5em;
    }

    /* Stats i grid på mobil */
    .stats {
        gap: 8px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .stat {
        padding: 8px 10px;
        min-width: auto;
    }

    .stat .label {
        font-size: 0.7em;
    }

    .stat .value {
        font-size: 1.2em;
    }

    /* Dölj mindre viktiga stats på mobil */
    .stat.session-stat {
        display: none;
    }

    .best-badge-name {
        font-size: 0.75em;
    }

    /* Knappar i grid på mobil */
    .controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .controls .btn {
        width: 100%;
        padding: 14px 10px;
        font-size: 0.95em;
    }

    /* Primärknappen tar hela bredden */
    .controls .btn-primary {
        grid-column: 1 / -1;
    }

    .event-card {
        padding: 15px;
    }

    .event-description {
        font-size: 1em;
        line-height: 1.5;
    }

    .sidebar {
        position: static;
    }

    .account-plan {
        height: 300px;
    }

    /* Bättre feedback på mobil */
    .feedback {
        padding: 15px;
        font-size: 1em;
    }

    .feedback h3 {
        font-size: 1.1em;
    }

    /* Level selector på mobil */
    .level-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .level-dropdown {
        width: 100%;
    }
}

/* Tablet breakpoint */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .sidebar > div {
        margin: 0;
    }

    .achievements-section {
        max-height: none;
    }

    .account-plan {
        height: 400px;
    }
}

/* Sidebar layout */
.sidebar {
    grid-area: aside;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 20px;
}

.sidebar > div {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.account-plan {
    overflow-y: auto;
    height: 800px;
}

/* Highlight stat */
.stat.highlight {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.stat.highlight .value {
    color: #e67e22;
}

.stat.highlight .label {
    color: #c0392b;
}

/* Session stats */
.stat.session-stat {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.stat.session-stat .value {
    color: #667eea;
}

/* Streak effects */
.streak-value {
    transition: all 0.3s;
}

.streak-value.on-fire {
    color: #ff6b35 !important;
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.5);
}

.streak-value.hot-streak {
    color: #ff3366 !important;
    text-shadow: 0 0 15px rgba(255, 51, 102, 0.7);
    animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

/* Achievements section */
.achievements-section {
    max-height: 200px;
    overflow-y: auto;
    flex-shrink: 0;
}

.achievements-section h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.achievements-progress {
    text-align: center;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 600;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: all 0.3s;
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
}

.achievement-item.locked {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    opacity: 0.7;
}

.achievement-badge {
    font-size: 1.5em;
    min-width: 35px;
    text-align: center;
}

.achievement-text {
    flex: 1;
}

.achievement-item-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
}

.achievement-item-desc {
    font-size: 0.75em;
    color: #666;
}

/* Achievement popup */
.achievement-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1000;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.achievement-popup.fade-out {
    animation: popOut 0.5s ease-in forwards;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes popOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
}

.achievement-popup .achievement-icon {
    font-size: 2.5em;
    animation: bounce 0.5s ease-in-out infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

.achievement-popup .achievement-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.achievement-popup .achievement-title {
    font-size: 0.8em;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-popup .achievement-name {
    font-size: 1.2em;
    font-weight: bold;
}

.achievement-popup .achievement-desc {
    font-size: 0.85em;
    opacity: 0.9;
}

/* Confetti effect for big achievements */
@keyframes confetti {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(51, 51, 51, 0.97);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 800px;
}

.cookie-content p {
    margin: 0;
    font-size: 0.95em;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
}

.cookie-buttons .btn {
    padding: 10px 20px;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }
}

/* Mini-balansräkning */
.mini-balance {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px solid #667eea;
    animation: slideIn 0.3s ease-out;
}

.balance-title {
    text-align: center;
    font-size: 1.2em;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.balance-column {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.balance-column h4 {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 1em;
    color: #333;
}

.balance-column.tillgangar h4 {
    color: #28a745;
    border-color: #28a745;
}

.balance-column.skulder h4 {
    color: #dc3545;
    border-color: #dc3545;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9em;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
}

.balance-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.balance-item .account-name {
    font-weight: 500;
    color: #333;
    flex: 1;
}

.balance-item .amount {
    font-weight: 600;
    color: #667eea;
    margin-left: 10px;
}

.balance-item.result-item {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffc107;
}

.balance-item.result-item .account-name {
    font-style: italic;
}

.balance-sum {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #667eea;
    text-align: right;
    font-size: 1.1em;
    font-weight: 700;
    color: #667eea;
}

/* Flygande siffra animation */
.flying-number {
    position: fixed;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1em;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    white-space: nowrap;
}

@keyframes flyToBalance {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* Responsiv mini-balansräkning */
@media (max-width: 768px) {
    .balance-columns {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .mini-balance {
        padding: 15px;
    }

    .balance-column {
        padding: 12px;
    }

    .balance-item {
        font-size: 0.85em;
    }
}

/* ==========================================
   DRAG AND DROP ÖVNINGAR
   ========================================== */

.drag-exercise-area {
    margin: 20px 0;
}

/* Gemensam blockstil */
.draggable-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #667eea;
    border-radius: 12px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    min-height: 50px;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
}

.draggable-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
    border-color: #5568d3;
}

.draggable-block:active,
.draggable-block.dragging {
    cursor: grabbing;
    opacity: 0.8;
    transform: scale(1.02) rotate(1deg);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.35);
    z-index: 1000;
}

.draggable-block.dropped {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #4caf50;
}

/* Block innehåll */
.block-account {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1em;
    min-width: 50px;
}

.block-name {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.block-amount {
    font-weight: 600;
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    padding: 4px 12px;
    border-radius: 15px;
}

.block-side {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.block-side.debet {
    background: #e3f2fd;
    color: #1565c0;
}

.block-side.kredit {
    background: #fce4ec;
    color: #c2185b;
}

/* Typ 1: Dra till sida */
.drag-exercise {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.block-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 2px dashed #dee2e6;
    min-height: 80px;
}

.block-pool.empty-pool {
    justify-content: center;
    align-items: center;
    color: #999;
    font-style: italic;
}

.drop-zones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.drop-zone {
    min-height: 180px;
    padding: 20px;
    border-radius: 15px;
    border: 3px dashed;
    transition: all 0.3s ease;
}

.drop-zone.debet-zone {
    border-color: #1565c0;
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.05) 0%, rgba(21, 101, 192, 0.1) 100%);
}

.drop-zone.kredit-zone {
    border-color: #c2185b;
    background: linear-gradient(135deg, rgba(194, 24, 91, 0.05) 0%, rgba(194, 24, 91, 0.1) 100%);
}

.drop-zone h4 {
    text-align: center;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid currentColor;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1.1em;
}

.debet-zone h4 {
    color: #1565c0;
}

.kredit-zone h4 {
    color: #c2185b;
}

.dropped-blocks {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Drag-over effekt */
.drop-zone.drag-over {
    border-style: solid;
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.debet-zone.drag-over {
    background: rgba(21, 101, 192, 0.2);
}

.kredit-zone.drag-over {
    background: rgba(194, 24, 91, 0.2);
}

/* Sant/Falskt övningar */
.true-false-exercise {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.statement-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #667eea;
    border-radius: 15px;
    padding: 25px 30px;
    text-align: center;
    font-size: 1.15em;
    line-height: 1.6;
    color: #333;
}

.true-false-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.tf-btn {
    padding: 20px 30px;
    font-size: 1.2em;
    font-weight: 600;
    border: 3px solid;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tf-btn.true-btn {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
    color: #155724;
}

.tf-btn.true-btn:hover {
    background: linear-gradient(135deg, #c3e6cb 0%, #b1dfbb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.tf-btn.false-btn {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-color: #dc3545;
    color: #721c24;
}

.tf-btn.false-btn:hover {
    background: linear-gradient(135deg, #f5c6cb 0%, #f1b0b7 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.tf-btn.selected {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.5), 0 8px 25px rgba(0, 0, 0, 0.2);
    border-width: 4px;
    position: relative;
}

.tf-btn.selected::after {
    content: '✓';
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.tf-btn.true-btn.selected {
    background: linear-gradient(135deg, #b8e6c1 0%, #9fddab 100%);
    border-color: #1e7e34;
}

.tf-btn.false-btn.selected {
    background: linear-gradient(135deg, #f1b0b7 0%, #ea9099 100%);
    border-color: #bd2130;
}

/* Dim unselected button when one is selected */
.true-false-buttons:has(.selected) .tf-btn:not(.selected) {
    opacity: 0.5;
    transform: scale(0.95);
}

.tf-btn.correct-answer {
    animation: correctPulse 0.6s ease-out;
}

.tf-btn.wrong-answer {
    animation: wrongShake 0.5s ease-out;
}

/* Animationer */
@keyframes dropBounce {
    0% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes correctPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.5);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

.draggable-block.correct {
    animation: correctPulse 0.6s ease-out;
    border-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.draggable-block.incorrect {
    animation: wrongShake 0.5s ease-out;
    border-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

/* Touch clone */
.touch-clone {
    transition: none !important;
    animation: none !important;
}

/* Responsiv drag-and-drop */
@media (max-width: 768px) {
    .drop-zones {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .drop-zone {
        min-height: 120px;
    }

    .build-exercise {
        grid-template-columns: 1fr;
    }

    .draggable-block {
        padding: 12px 15px;
        min-height: 48px;
    }

    .block-pool {
        padding: 15px;
        gap: 10px;
    }

    .step-handle {
        padding: 10px;
        font-size: 1.5em;
    }

    .block-account {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .draggable-block {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .block-amount {
        align-self: flex-end;
    }
}

/* Touch targets */
@media (pointer: coarse) {
    .draggable-block {
        min-height: 56px;
        padding: 16px 20px;
    }

    .step-handle {
        padding: 15px;
    }
}
