* {
    box-sizing: border-box;
}

:root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #09090a;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    /*--success-bg: #dcfce7;*/
    --success-bg: #ffffff;
    --success-text: #166534;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --border: #afafaf;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.5);
    --radius: 14px;
}

html,
body {
    margin: 0;
    padding: 0;
    /*font-family: Arial, Helvetica, sans-serif;*/
    /* Font: */
    /*font-family: "Quicksand", sans-serif;*/
    font-family: "Jura", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;

    background: linear-gradient(180deg, #eaf2ff 0%, #f8fafc 100%);
    color: var(--text);
}

body {
    min-height: 100vh;
}

body {
    background-image: url('/images/maalaismaisemaa_lyhyt_v1.webp');
    /*background-image: url('/images/maalaismaisemaa.webp');*/
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-color: #cad7ff;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4); /* tummentaa */
    z-index: -1;
}

.container {
    width: min(1100px, 92%);
    margin: 0 auto;
}

.site-header {
    /*background: var(--bg);*/
    color: #fff;
    /*box-shadow: 0 3px 16px rgba(0, 0, 0, 0.15);*/
}

.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.only_desktop {
    display: block;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #000;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
}

.logo-icon {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.2)) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.flip-img {
    animation: flipAnim 10s 1;
}

@keyframes flipAnim {
    0%   { transform: rotateY(0deg); }
    45%  { transform: rotateY(0deg); }
    50%  { transform: rotateY(180deg); }
    95%  { transform: rotateY(180deg); }
    100% { transform: rotateY(360deg); }
}

.nav {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.nav a {
    color: #000;
    text-decoration: none;
}


.nav a.btn {
    color: #fff;
    text-decoration: none;
}

.main-content {
    padding: 10px 0 60px;
}

.hero {
    display: flex;
    justify-content: center;
    align-items: center;
    /*min-height: calc(100vh - 140px);*/
}

.hero-card, .auth-card, .panel {
    background-color: rgb(255 255 255 / 85%);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    background-color: rgb(255 255 255 / 85%);
    border-radius: var(--radius);
}

.hero-card {
    max-width: 760px;
    padding: 42px;
    text-align: center;
}

.hero-card h1 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 0;
    font-size: clamp(1.6rem, 3.5vw, 2rem);
}

.hero-card p {
    color: #000000;
    /*color: var(--muted);*/
    font-size: 1.05rem;
    line-height: 1.6;
}


.hero-card ul {
    color: #000000;
    /*color: var(--muted);*/
    font-size: 1.05rem;
    line-height: 1.6;
}

.hero-actions {
    margin-top: 28px;
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.auth-card {
    max-width: 520px;
    margin: 10px auto;
    padding: 32px;
}

.auth-card h1 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 0;
    margin-bottom: 20px;
}

.form-card,
.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
}

.form-actions {
    display: flex;
    align-items: end;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-card label {
    margin-bottom: 0px;
}

input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    background: #fff;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: none;
    border-radius: 4px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
    box-shadow: rgba(0, 0, 0, 0.15) 0px 5px 10px;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #979797;
    color: #fff;
    min-height: 36px;
}

.btn-secondary:hover {
    background: #bcbcbc;
}

.btn-small {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.95rem;
}

.btn-login {
    background: #1dde26;
    color: #000;
    min-height: 36px;
}

.btn-login:hover {
    color: #FFF;
    background: #10ad18;
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.alert p {
    margin: 6px 0;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
}

.dashboard-top,
.detail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-top h1,
.detail-top h1 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0 0 8px;
}

.muted {
    color: var(--muted);
}

.panel {
    padding: 24px;
    margin-bottom: 24px;
}

.panel h2 {
    margin-top: 0;
}

.cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.addiction-card {
    padding: 22px;
    border: 1px solid #c9c9c9;
    border-radius: 2px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.card-head h3 {
    margin: 0 0 14px;
    font-size: 1.25rem;
}

.counter {
    margin-top: 16px;
    padding: 18px;
    border-radius: 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.counter-main {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.5;
}

.counter-sub {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.95rem;
}

.delete-btn {
    border: none;
    background: var(--danger);
    color: #fff;
    border-radius: 4px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 700;
    min-height: 36px;
}

.delete-btn:hover {
    background: var(--danger-hover);
}

.auth-link {
    margin-top: 18px;
    color: var(--muted);
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
}

.privacy-link a {
    color: var(--primary);
    text-decoration: none;
}

.goals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.goal-pill {
    position: relative;
    overflow: hidden;
    min-height: 40px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #f1f5f9;
}

.goal-pill-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0;
    transition: width 0.3s ease;
}

.goal-pill-content {
    position: relative;
    z-index: 1;
    min-height: 40px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
}

.goal-title {
    white-space: nowrap;
}

.goal-text {
    text-align: right;
    white-space: nowrap;
}

.goal-done {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.goal-done .goal-pill-fill {
    width: 100% !important;
    background: #86efac;
}

.goal-pending {
    background: #eeeeee;
    color: #334155;
}

.goal-pending .goal-pill-fill {
    background: #39f100;
}

.privacy h1 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 2em;
}

@media (max-width: 760px) {
    body {
        /*background-attachment: scroll;*/
        background-image: url('/images/maalaismaisemaa.webp');
    }
    .goals {
        grid-template-columns: 1fr;
    }
    .only_desktop {
        display: none;
    }
    .logo {
        margin: 20px auto;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
}

.card-actions {
    margin-top: 18px;
}

.history-list {
    display: grid;
    gap: 12px;
}

.history-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

@media (max-width: 760px) {
    .site-header {
        padding: 20px 0 0 0;
    }

    .form-grid,
    .cards {
        grid-template-columns: 1fr;
    }

    .hero-card,
    .auth-card,
    .panel {
        padding: 22px;
    }

    .dashboard-top,
    .detail-top {
        flex-direction: column;
        align-items: center;
    }

    .header-inner {
        position: relative;
        flex-direction: column;
        align-items: center;
    }

    .nav {
        position: absolute;
        top: 0;
        right: 0;
    }
}