/* ============================================
   HUBI TIME TRACKER — Cat-Themed Styles
   ============================================ */

/* --- Self-hosted Nunito Font --- */
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url(assets/fonts/nunito-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url(assets/fonts/nunito-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- CSS Variables / Design Tokens --- */
:root {
    --orange-primary: #FF8C42;
    --orange-secondary: #FFB347;
    --orange-light: #FFD4A3;
    --orange-glow: #FF6B1A;
    --cream: #FFF5E6;
    --cream-dark: #F5E6D0;
    --chocolate: #3D2914;
    --chocolate-light: #5C3D1E;
    --brown-warm: #8B6547;
    --white: #FFFFFF;
    --gray-light: #F0F0F0;
    --gray: #A0A0A0;
    --green-success: #4CAF50;
    --green-light: #81C784;
    --blue-break: #42A5F5;
    --blue-light: #90CAF9;
    --red-danger: #EF5350;
    --red-light: #EF9A9A;

    --font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --shadow-soft: 0 4px 20px rgba(61, 41, 20, 0.08);
    --shadow-medium: 0 8px 32px rgba(61, 41, 20, 0.12);
    --shadow-glow: 0 0 40px rgba(255, 140, 66, 0.25);
    --nav-height: 80px;
    --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--cream);
    color: var(--chocolate);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Subtle animated background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 140, 66, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 179, 71, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 212, 163, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* --- App Container --- */
#app {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(var(--nav-height) + 20px);
    min-height: 100vh;
    min-height: 100dvh;
}

/* --- Page Transitions --- */
.page {
    animation: pageIn 0.4s var(--transition-bounce) both;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Bottom Navigation --- */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 140, 66, 0.15);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 100;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s var(--transition-bounce);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn .nav-icon {
    font-size: 1.5rem;
    transition: transform 0.3s var(--transition-bounce);
}

.nav-btn .nav-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s;
}

.nav-btn.active .nav-label {
    color: var(--orange-primary);
}

.nav-btn.active .nav-icon {
    transform: scale(1.2);
}

.nav-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--orange-primary);
    border-radius: 0 0 3px 3px;
}

.nav-btn:active {
    transform: scale(0.9);
}

/* --- Header / Mascot Area --- */
.page-header {
    text-align: center;
    margin-bottom: 24px;
}

.mascot-container {
    position: relative;
    display: inline-block;
    margin-bottom: 8px;
}

#mascot-slot {
    width: 80px;
    height: 80px;
}

.mascot-status {
    position: absolute;
    bottom: -4px;
    right: -8px;
    font-size: 1.5rem;
    animation: statusPop 0.4s var(--transition-bounce) both;
}

@keyframes statusPop {
    from { transform: scale(0) rotate(-30deg); }
    to { transform: scale(1) rotate(0deg); }
}

.page-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--chocolate);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brown-warm);
    opacity: 0.7;
}

/* --- Slot Machine Dial --- */
.slot-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    line-height: 1;
}

.slot-prefix, .slot-suffix {
    white-space: nowrap;
}

.slot-machine {
    position: relative;
    display: inline-block;
    height: 108px; /* 3 rows of 36px */
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    vertical-align: middle;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 33%, black 66%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 33%, black 66%, transparent 100%);
}

.slot-viewport {
    display: block;
    height: 100%;
    overflow: hidden;
    padding-top: 36px; /* offset so index 0 sits in the middle row */
}

.slot-reel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slot-item {
    display: block;
    height: 36px;
    line-height: 36px;
    white-space: nowrap;
    font-size: inherit;
    font-weight: 900;
    color: var(--brown-warm);
    opacity: 0.3;
    transition: opacity 0.3s ease, color 0.3s ease;
    padding: 0 6px;
    text-align: center;
}

.slot-item-active {
    color: var(--orange-primary);
    opacity: 1;
}

.slot-item-icon {
    margin-right: 2px;
    font-style: normal;
}

/* Fades handled by mask-image on .slot-machine */

/* --- Timer Display --- */
.timer-display {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    margin: 20px 0;
    text-align: center;
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.timer-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--orange-primary), var(--orange-secondary), var(--orange-light));
}

.timer-display.working::before {
    background: linear-gradient(90deg, var(--green-success), var(--green-light), var(--green-success));
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

.timer-display.on-break::before {
    background: linear-gradient(90deg, var(--blue-break), var(--blue-light), var(--blue-break));
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: -200% center; }
}

.timer-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gray);
    margin-bottom: 8px;
}

.timer-label.working {
    color: var(--green-success);
}

.timer-label.on-break {
    color: var(--blue-break);
}

.timer-time {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--chocolate);
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-bottom: 8px;
}

.timer-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brown-warm);
    opacity: 0.6;
}

.timer-breakdown {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--cream-dark);
}

.breakdown-item {
    text-align: center;
}

.breakdown-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
    margin-bottom: 2px;
}

.breakdown-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--chocolate);
    font-variant-numeric: tabular-nums;
}

/* --- Action Buttons --- */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 24px;
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s var(--transition-bounce);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    pointer-events: none;
}

.btn:active {
    transform: scale(0.95);
}

.btn-start {
    background: linear-gradient(135deg, var(--orange-primary), var(--orange-glow));
    color: white;
    box-shadow: 0 6px 24px rgba(255, 140, 66, 0.4);
}

.btn-start:hover {
    box-shadow: 0 8px 32px rgba(255, 140, 66, 0.5);
    transform: translateY(-2px);
}

.btn-break {
    background: linear-gradient(135deg, var(--blue-break), #1E88E5);
    color: white;
    box-shadow: 0 6px 24px rgba(66, 165, 245, 0.3);
}

.btn-break:hover {
    box-shadow: 0 8px 32px rgba(66, 165, 245, 0.4);
    transform: translateY(-2px);
}

.btn-resume {
    background: linear-gradient(135deg, var(--green-success), #388E3C);
    color: white;
    box-shadow: 0 6px 24px rgba(76, 175, 80, 0.3);
}

.btn-resume:hover {
    box-shadow: 0 8px 32px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

.btn-finish {
    background: linear-gradient(135deg, var(--red-danger), #D32F2F);
    color: white;
    box-shadow: 0 6px 24px rgba(239, 83, 80, 0.3);
}

.btn-finish:hover {
    box-shadow: 0 8px 32px rgba(239, 83, 80, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--white);
    color: var(--chocolate);
    box-shadow: var(--shadow-soft);
    border: 2px solid var(--cream-dark);
}

.btn-secondary:hover {
    border-color: var(--orange-secondary);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-row {
    display: flex;
    gap: 12px;
}

.btn-row .btn {
    flex: 1;
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-medium);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-right: 64px; /* Space for the absolute delete and edit buttons */
}

.card-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--chocolate);
}

.card-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brown-warm);
    opacity: 0.7;
}

.card-body {
    display: flex;
    gap: 16px;
}

.card-stat {
    flex: 1;
    text-align: center;
    padding: 8px;
    background: var(--cream);
    border-radius: var(--radius-sm);
}

.card-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
    margin-bottom: 2px;
}

.card-stat-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--chocolate);
}

.card-stat-value.work {
    color: var(--green-success);
}

.card-stat-value.break-val {
    color: var(--blue-break);
}

.card-delete, .card-edit {
    position: absolute;
    top: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--cream);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0.5;
}

.card-delete {
    right: 12px;
    color: var(--red-danger);
    font-size: 1rem;
}

.card-edit {
    right: 48px;
    color: var(--orange-primary);
    font-size: 0.9rem;
}

@media (hover: hover) {
    .card-delete, .card-edit {
        opacity: 0;
    }
    .card:hover .card-delete, .card:hover .card-edit {
        opacity: 1;
    }
}

.card-delete:active {
    transform: scale(0.85);
    background: var(--red-light);
}

.card-edit:active {
    transform: scale(0.85);
    background: var(--orange-light);
}

/* Edit Form */
.time-picker-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.time-picker-group label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray);
    margin-bottom: 4px;
}

.task-select {
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    background: var(--white);
    padding: 0 10px;
    height: 44px;
    width: 100%;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--chocolate);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%238B6547'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.native-time-picker {
    display: block;
    text-align: left;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    background: var(--white);
    transition: border-color 0.3s;
    padding: 0 10px;
    height: 44px;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    color: var(--chocolate);
    outline: none;
    cursor: pointer;
}

.native-time-picker:focus,
.native-time-picker:focus-within {
    border-color: var(--orange-primary);
}

/* Watch Picker Modal */
.watch-picker-modal {
    padding: 24px;
    max-width: 320px;
    overflow: hidden;
    animation: dialogIn 0.3s var(--transition-bounce) both;
}

.wp-header {
    background: var(--orange-primary);
    color: white;
    padding: 16px;
    margin: -32px -24px 16px -24px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wp-time-display {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.wp-segment {
    cursor: pointer;
    transition: opacity 0.2s;
}

.wp-segment-active {
    opacity: 1;
}

.wp-segment-dim {
    opacity: 0.6;
}

.wp-ampm-switch {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 700;
    font-size: 0.9rem;
}

.wp-ampm-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
}

.wp-ampm-active {
    opacity: 1;
}

.wp-ampm-dim {
    opacity: 0.5;
}

.wp-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
}

.wp-dial-container {
    position: relative;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: var(--cream);
    margin: 0 auto;
    user-select: none;
    touch-action: none;
}

.wp-center-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--orange-primary);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.wp-hand {
    position: absolute;
    width: 2px;
    background: var(--orange-primary);
    bottom: 50%;
    left: calc(50% - 1px);
    transform-origin: bottom center;
    z-index: 5;
    transition: transform 0.15s ease-out;
    pointer-events: none;
}

.wp-numbers {
    position: absolute;
    inset: 0;
}

.wp-number {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--chocolate);
    background: transparent;
    cursor: pointer;
    transition: background 0.2s;
    transform: translate(-50%, -50%);
}

.wp-number-inner {
    font-size: 0.8rem;
}

.wp-number-outer {
    font-size: 0.9rem;
}

.wp-number-active {
    color: white;
    background: var(--orange-primary);
}

@media (hover: hover) {
    .wp-number:not(.wp-number-active):hover {
        background: var(--cream-dark);
    }
}

.wp-actions {
    margin-top: 24px;
    justify-content: flex-end;
}

.wp-action-btn {
    padding: 10px 16px;
    font-size: 0.9rem;
    flex: none;
}

/* Edit Card */
.edit-card .card-header {
    padding-right: 0;
}

.card-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.card-action-btn {
    padding: 10px;
    font-size: 0.85rem;
}

.card-action-btn-save {
    flex: 1;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-emoji {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: gentleBounce 2s ease-in-out infinite;
}

@keyframes gentleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.empty-state-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brown-warm);
    opacity: 0.7;
}

.empty-state-sub {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray);
    margin-top: 4px;
}

/* --- Statistics --- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.stat-card-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--chocolate);
    margin-bottom: 2px;
}

.stat-card-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
}

/* --- Bar Chart --- */
.chart-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.chart-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--chocolate);
    margin-bottom: 20px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 160px;
    gap: 8px;
    padding-bottom: 28px;
    position: relative;
}

.chart-bars::after {
    content: '';
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--cream-dark);
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
}

.chart-bar {
    width: 100%;
    max-width: 36px;
    border-radius: 8px 8px 2px 2px;
    min-height: 4px;
    transition: height 0.6s var(--transition-bounce);
    position: relative;
}

.chart-bar.work-bar {
    background: linear-gradient(180deg, var(--orange-primary), var(--orange-secondary));
}

.chart-bar.break-bar {
    background: linear-gradient(180deg, var(--blue-break), var(--blue-light));
    opacity: 0.6;
}

.chart-bar-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gray);
    white-space: nowrap;
}

/* --- Task Breakdown --- */
.task-breakdown-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.task-breakdown-row:last-child {
    margin-bottom: 0;
}

.task-breakdown-label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 90px;
    flex-shrink: 0;
}

.task-breakdown-icon {
    font-size: 1rem;
}

.task-breakdown-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--chocolate);
    white-space: nowrap;
}

.task-breakdown-bar-wrap {
    flex: 1;
    height: 10px;
    background: var(--cream);
    border-radius: 5px;
    overflow: hidden;
}

.task-breakdown-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s var(--transition-bounce);
}

.task-breakdown-value {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--chocolate);
    min-width: 70px;
    text-align: right;
    white-space: nowrap;
}

.task-breakdown-pct {
    font-weight: 600;
    color: var(--gray);
    font-size: 0.65rem;
}

/* --- Hubi Insight --- */
.hubi-insight {
    background: linear-gradient(135deg, var(--orange-primary), var(--orange-secondary));
    border-radius: var(--radius-lg);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    box-shadow: 0 6px 24px rgba(255, 140, 66, 0.3);
}

.hubi-insight-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
    flex-shrink: 0;
}

.hubi-insight-text {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.4;
}

/* --- Section Title --- */
.section-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--brown-warm);
    opacity: 0.6;
    margin-bottom: 12px;
    margin-top: 24px;
}

/* --- Period Toggle --- */
.period-toggle {
    display: flex;
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 4px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.period-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: calc(var(--radius-md) - 4px);
    background: transparent;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s;
}

.period-btn.active {
    background: var(--orange-primary);
    color: white;
    box-shadow: 0 2px 12px rgba(255, 140, 66, 0.3);
}

/* --- Paw Print Decorations --- */
.paw-prints {
    position: fixed;
    bottom: calc(var(--nav-height) + 10px);
    right: 20px;
    opacity: 0.08;
    font-size: 2rem;
    pointer-events: none;
    z-index: 0;
}

/* --- Toast Notification --- */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--chocolate);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 200;
    box-shadow: var(--shadow-medium);
    transition: transform 0.4s var(--transition-bounce);
    max-width: 90%;
    text-align: center;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
}

/* --- Confirm Dialog --- */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(61, 41, 20, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dialog {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 32px 24px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-medium);
    animation: dialogIn 0.3s var(--transition-bounce) both;
}

@keyframes dialogIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dialog-emoji {
    font-size: 3rem;
    margin-bottom: 12px;
}

.dialog-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--chocolate);
    margin-bottom: 8px;
}

.dialog-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brown-warm);
    opacity: 0.7;
    margin-bottom: 20px;
    line-height: 1.4;
}

.dialog-actions {
    display: flex;
    gap: 10px;
}

.dialog-actions .btn {
    flex: 1;
    padding: 14px 16px;
    font-size: 0.9rem;
}

/* --- Changelog --- */
.changelog-dialog {
    text-align: left;
}

.changelog-dialog .dialog-emoji {
    text-align: center;
}

.changelog-dialog .dialog-title {
    text-align: center;
    margin-bottom: 16px;
}

.changelog-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.changelog-item {
    background: var(--cream);
    padding: 16px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--orange-primary);
}

.changelog-title {
    font-weight: 800;
    color: var(--chocolate);
    margin-bottom: 6px;
    font-size: 1rem;
}

.changelog-desc {
    font-size: 0.85rem;
    color: var(--brown-warm);
    line-height: 1.4;
    opacity: 0.9;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-date-wrap {
    flex: 1;
    position: relative;
}

.filter-date-btn {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--chocolate);
    background: var(--white);
    outline: none;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.3s;
}

.filter-date-btn:focus,
.filter-date-btn:active {
    border-color: var(--orange-primary);
}

.filter-date-hidden {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}


.filter-clear {
    padding: 10px 14px;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-clear:hover {
    border-color: var(--orange-primary);
    color: var(--orange-primary);
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--orange-light);
    border-radius: 4px;
}

/* --- Responsive --- */
@media (min-width: 481px) {
    #app {
        padding-top: 40px;
    }

    .timer-time {
        font-size: 4.5rem;
    }
}

/* --- Session Complete Summary --- */
.summary-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow-medium);
    margin: 20px 0;
}

.summary-emoji {
    font-size: 4rem;
    margin-bottom: 12px;
    animation: gentleBounce 2s ease-in-out infinite;
}

.summary-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--chocolate);
    margin-bottom: 4px;
}

.summary-task {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brown-warm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 16px;
    opacity: 0.7;
}

.summary-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.summary-stat {
    flex: 1;
    padding: 12px;
    background: var(--cream);
    border-radius: var(--radius-md);
}

.summary-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
    margin-bottom: 4px;
}

.summary-stat-value {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--chocolate);
}

/* --- Hubi Virtual Pet --- */
#hubi-pet {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
    pointer-events: none;
    cursor: pointer;
    will-change: transform;
}

#hubi-pet-sprite {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(61, 41, 20, 0.2));
    pointer-events: auto;
    cursor: pointer;
}

/* Pet States Animation */
#hubi-pet.walking #hubi-pet-sprite, #hubi-pet.chasing #hubi-pet-sprite {
    animation: petWalk 0.3s alternate infinite ease-in-out;
}

#hubi-pet.sleeping #hubi-pet-sprite {
    animation: petSleep 3s infinite ease-in-out;
}

#hubi-pet.eating #hubi-pet-sprite {
    animation: petEat 1s infinite alternate ease-in-out;
    transform-origin: bottom left;
}

@keyframes petWalk {
    0% { transform: translateY(0px) rotate(-3deg); }
    100% { transform: translateY(-4px) rotate(3deg); }
}

@keyframes petSleep {
    0%, 100% { transform: scaleY(1) translateY(0); }
    50% { transform: scaleY(0.95) translateY(2px); }
}

@keyframes petEat {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(15deg) translateY(4px); }
}

/* Pet Props (food, zzz, toy) */
.pet-prop {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s;
}

#hubi-pet.sleeping .prop-zzz {
    opacity: 1;
    top: -20px;
    right: -10px;
    animation: floatZzz 3s linear infinite;
}

#hubi-pet.eating .prop-fish {
    opacity: 1;
    bottom: -5px;
    left: -20px;
}

#hubi-pet.chasing .prop-toy {
    opacity: 1;
    bottom: 5px;
    left: -35px;
    animation: rollToy 0.5s linear infinite;
}

@keyframes floatZzz {
    0% { transform: translate(0, 0) scale(0.5); opacity: 0; }
    20% { opacity: 0.8; }
    80% { opacity: 0.8; transform: translate(15px, -30px) scale(1.2); }
    100% { transform: translate(20px, -45px) scale(1.5); opacity: 0; }
}

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

/* --- PETTED state --- */
#hubi-pet.petted #hubi-pet-sprite {
    animation: petBounce 0.4s ease-in-out 3;
}

#hubi-pet.petted .prop-heart {
    opacity: 1;
    top: -25px;
    left: 20px;
    animation: floatHeart 1.6s ease-out forwards;
}

@keyframes petBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes floatHeart {
    0% { transform: translate(0, 0) scale(0.3); opacity: 0; }
    15% { opacity: 1; transform: translate(0, -5px) scale(1); }
    70% { opacity: 0.8; transform: translate(5px, -25px) scale(1.1); }
    100% { transform: translate(8px, -40px) scale(0.6); opacity: 0; }
}

.prop-heart {
    color: #ff4466;
    font-size: 1.2rem;
}

/* --- NEW PET PROPS --- */
#hubi-pet.butterfly .prop-butterfly {
    opacity: 1;
    top: -30px;
    left: 20px;
    animation: butterflyFlight 4s infinite ease-in-out;
}

#hubi-pet.hunting .prop-mouse {
    opacity: 1;
    bottom: -5px;
    left: -40px;
    animation: mouseScurry 2s infinite ease-in-out;
}

#hubi-pet.box .prop-box {
    opacity: 1;
    bottom: -15px;
    left: -10px;
    font-size: 3.6rem;
    z-index: 5;
}

#hubi-pet.productive .prop-laptop {
    opacity: 1;
    bottom: -10px;
    left: -25px;
    font-size: 1.8rem;
    z-index: 6;
}

#hubi-pet.productive .prop-glasses {
    opacity: 1;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%) scaleX(1.4);
    font-size: 1.3rem;
    z-index: 10;
}

@keyframes butterflyFlight {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, -20px) rotate(20deg); }
    50% { transform: translate(10px, -40px) rotate(-10deg); }
    75% { transform: translate(-20px, -15px) rotate(15deg); }
}

@keyframes mouseScurry {
    0%, 100% { transform: translateX(0); }
    20%, 80% { transform: translateX(-5px); }
    40%, 60% { transform: translateX(10px); }
}

/* --- Body-attached props (inside sprite parts) --- */
.body-prop {
    position: absolute;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

/* -- Chef hat (kochen) -- toque between ears */
.prop-chef-hat {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 18px;
    background: white;
    border-radius: 10px 10px 2px 2px;
    border: 1.5px solid #e0e0e0;
    z-index: -2;
}
/* Hat brim */
.prop-chef-hat::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: -3px;
    right: -3px;
    height: 5px;
    background: white;
    border-radius: 2px;
    border: 1.5px solid #e0e0e0;
}
/* Puffy top */
.prop-chef-hat::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 10px;
    background: white;
    border-radius: 50%;
    border: 1.5px solid #e8e8e8;
    border-bottom: none;
}
#hubi-pet.task-kochen .prop-chef-hat { opacity: 1; }

/* -- Headband (sport) -- */
.prop-headband {
    top: 8px;
    left: 1px;
    right: 1px;
    height: 5px;
    background: #EF5350;
    border-radius: 2px;
    z-index: 4;
}
#hubi-pet.task-sport .prop-headband { opacity: 1; }

/* -- Sweat drops (sport) -- */
.prop-sweat {
    top: -2px;
    right: -8px;
    z-index: 5;
}
.sweat-drop {
    position: absolute;
    font-size: 0.6rem;
    opacity: 0;
}
.sweat-drop:first-child {
    right: 0;
}
.sweat-drop:last-child {
    right: 8px;
}
#hubi-pet.task-sport .prop-sweat { opacity: 1; }
#hubi-pet.task-sport .sweat-drop:first-child {
    animation: sweatDrip 2s ease-in infinite;
}
#hubi-pet.task-sport .sweat-drop:last-child {
    animation: sweatDrip 2s ease-in infinite 1s;
}

@keyframes sweatDrip {
    0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
    15% { opacity: 0.9; transform: translate(0, 0) scale(1); }
    80% { opacity: 0.6; transform: translate(2px, 14px) scale(0.7); }
    100% { opacity: 0; transform: translate(3px, 20px) scale(0.3); }
}

/* -- Paint spots (kreativ) -- */
.prop-paint-spots {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
}
.paint-dot {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
}
.paint-dot:nth-child(1) { top: 2px; left: 4px; }
.paint-dot:nth-child(2) { top: 6px; right: 3px; width: 2.5px; height: 2.5px; }
.paint-dot:nth-child(3) { bottom: 5px; left: 10px; width: 2px; height: 2px; }
#hubi-pet.task-kreativ .prop-paint-spots { opacity: 1; }

/* -- Brush (kreativ) — attached to front-left leg -- */
.prop-brush {
    position: absolute;
    top: -6px;
    left: -14px;
    font-size: 1.2rem;
    transform: rotate(70deg);
    transform-origin: center center;
    z-index: 2;
}
#hubi-pet.task-kreativ .prop-brush { opacity: 1; }

/* -- Easel (kreativ) -- */
.prop-easel {
    display: block;
    position: absolute;
    width: 44px;
    height: 56px;
    bottom: -16px;
    left: -38px;
    transform: perspective(120px) rotateY(30deg);
}
.easel-canvas {
    position: absolute;
    top: 0;
    left: 5px;
    width: 34px;
    height: 32px;
    background: #FFF9F0;
    border: 2px solid #BCAAA4;
    border-radius: 1px;
    z-index: 2;
    overflow: hidden;
}
/* Half-fish painting on canvas */
.canvas-stroke {
    position: absolute;
}
/* Fish body — left half, fading out on the right */
.canvas-stroke.s1 {
    top: 8px;
    left: 3px;
    width: 18px;
    height: 12px;
    background: #42A5F5;
    border-radius: 60% 30% 30% 60%;
    clip-path: inset(0 20% 0 0);
}
/* Fish eye */
.canvas-stroke.s2 {
    top: 11px;
    left: 6px;
    width: 4px;
    height: 4px;
    background: #1A237E;
    border-radius: 50%;
}
/* Fish tail — sketched, partial */
.canvas-stroke.s3 {
    top: 9px;
    left: 16px;
    width: 8px;
    height: 10px;
    border-left: 2px solid #42A5F5;
    border-top: 2px solid #42A5F5;
    border-bottom: 2px solid #42A5F5;
    border-right: none;
    border-radius: 0 40% 40% 0;
    background: transparent;
    opacity: 0.5;
}
/* Easel legs */
.easel-leg-l, .easel-leg-r {
    position: absolute;
    bottom: 0;
    width: 3px;
    height: 22px;
    background: #6D4C41;
    border-radius: 1px;
}
.easel-leg-l { left: 10px; transform: rotate(8deg); transform-origin: top center; }
.easel-leg-r { right: 8px; transform: rotate(-8deg); transform-origin: top center; }

#hubi-pet.task-kreativ .prop-easel {
    opacity: 1;
    bottom: -16px;
    left: -38px;
    z-index: 6;
}

/* -- Book (lernen) -- */
/* -- Dream bubble (entspannen) -- */
.prop-dream {
    display: block;
    position: absolute;
    width: 50px;
    height: 50px;
}
.dream-bubble {
    position: absolute;
    top: 0;
    left: 8px;
    width: 36px;
    height: 28px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    border: 1.5px solid #ddd;
}
.dream-dot {
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    border: 1px solid #ddd;
}
.dream-dot-1 {
    width: 8px;
    height: 8px;
    bottom: 8px;
    left: 2px;
}
.dream-dot-2 {
    width: 5px;
    height: 5px;
    bottom: 2px;
    left: -4px;
}
.dream-fish {
    position: absolute;
    top: 4px;
    left: 16px;
    font-size: 1.1rem;
    animation: none;
}
#hubi-pet.task-entspannen .prop-dream {
    opacity: 1;
    top: -4px;
    right: -30px;
    z-index: 10;
    animation: dreamFloat 4s ease-in-out infinite;
}
#hubi-pet.task-entspannen .dream-fish {
    animation: dreamFishSwim 3s ease-in-out infinite;
}

@keyframes dreamFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
@keyframes dreamFishSwim {
    0%, 100% { transform: translateX(0) scaleX(1); }
    30% { transform: translateX(4px) scaleX(1); }
    50% { transform: translateX(4px) scaleX(-1); }
    80% { transform: translateX(-2px) scaleX(-1); }
    95% { transform: translateX(-2px) scaleX(1); }
}

/* Open book: two pages with a spine in the middle */
.prop-book {
    display: block;
    width: 40px;
    height: 26px;
    position: absolute;
}
.book-cover {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 26px;
    background: #7E57C2;
    border-radius: 3px;
    border: 1.5px solid #5E35B1;
}
/* Left page */
.book-page {
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 17px;
    height: 21px;
    background: #FFF9F0;
    border-radius: 2px 0 0 2px;
    transform-origin: right center;
}
/* Spine line */
.book-page::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 2px;
    bottom: 2px;
    width: 1px;
    background: #D7CCC8;
}
/* Right page (the one that flips) */
.book-page-flip {
    position: absolute;
    bottom: 2px;
    left: 20px;
    width: 17px;
    height: 21px;
    background: #FFF3E0;
    border-radius: 0 2px 2px 0;
    transform-origin: left center;
    animation: none;
}
/* Text lines on pages */
.book-page::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 3px;
    right: 4px;
    height: 2px;
    background: #E0D5C8;
    box-shadow: 0 4px 0 #E0D5C8, 0 8px 0 #E0D5C8, 0 12px 0 #E0D5C8;
    border-radius: 1px;
}
.book-page-flip::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 3px;
    right: 3px;
    height: 2px;
    background: #E0D5C8;
    box-shadow: 0 4px 0 #E0D5C8, 0 8px 0 #E0D5C8;
    border-radius: 1px;
}
#hubi-pet.task-lernen .prop-book {
    opacity: 1;
    bottom: -12px;
    left: -22px;
    z-index: 6;
    transform: rotate(-25deg) perspective(80px) rotateX(20deg);
}
#hubi-pet.task-lernen .book-page-flip {
    animation: pageFlip 3s ease-in-out infinite;
}

@keyframes pageFlip {
    0%, 55%, 100% { transform: rotateY(0deg); }
    62% { transform: rotateY(-40deg); }
    70% { transform: rotateY(-100deg); }
    80% { transform: rotateY(-160deg); }
    88% { transform: rotateY(-180deg); }
}

/* -- Pot (kochen) -- */
.prop-pot {
    display: block;
    position: absolute;
    bottom: -14px;
    left: -30px;
}
.pot-body {
    display: block;
    width: 32px;
    height: 20px;
    background: linear-gradient(to bottom, #78909C, #546E7A);
    border-radius: 3px 3px 8px 8px;
    border: 2px solid #455A64;
    position: relative;
}
/* Rim */
.pot-body::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    height: 5px;
    background: #90A4AE;
    border-radius: 3px;
    border: 1px solid #607D8B;
}
/* Lid handle */
.pot-body::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 4px;
    background: #455A64;
    border-radius: 4px 4px 0 0;
}
/* Handles on sides */
.pot-steam {
    position: absolute;
    top: -16px;
    font-size: 0.85rem;
    color: #B0BEC5;
    opacity: 0;
}
.pot-steam:first-of-type { left: 4px; }
.pot-steam-2 { left: 18px; }
.pot-steam-3 { left: 11px; }

#hubi-pet.task-kochen .pot-steam-3 {
    animation: steamRise 1.4s ease-out infinite 0.35s;
}
#hubi-pet.task-kochen .prop-pot {
    opacity: 1;
    bottom: -14px;
    left: -30px;
    z-index: 6;
    animation: potSizzle 0.15s ease-in-out infinite alternate;
}
#hubi-pet.task-kochen .pot-steam:first-of-type {
    animation: steamRise 1.4s ease-out infinite;
}
#hubi-pet.task-kochen .pot-steam-2 {
    animation: steamRise 1.4s ease-out infinite 0.7s;
}

@keyframes steamRise {
    0% { opacity: 0; transform: translateY(0) scale(0.6); }
    15% { opacity: 0.8; }
    60% { opacity: 0.5; transform: translateY(-16px) scale(1.3) translateX(4px); }
    100% { opacity: 0; transform: translateY(-26px) scale(1.8) translateX(-3px); }
}
@keyframes potSizzle {
    0% { transform: translateX(-0.5px) rotate(-0.5deg); }
    100% { transform: translateX(0.5px) rotate(0.5deg); }
}

/* -- Shopping cart (einkaufen) -- */
.prop-cart {
    display: block;
    position: absolute;
}
.cart-body {
    font-size: 2.6rem;
    display: block;
}
.cart-treat {
    position: absolute;
    font-size: 1rem;
}
.cart-treat:nth-child(2) { left: 8px; top: -4px; }
.cart-treat-2 { left: 20px; top: -6px; }
.cart-treat-3 { left: 14px; top: -12px; }

#hubi-pet.task-einkaufen .prop-cart {
    opacity: 1;
    bottom: -10px;
    left: -42px;
    z-index: 6;
    animation: cartBounce 0.35s ease-in-out infinite alternate;
}

@keyframes cartBounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-2px); }
}

/* --- Treat Elements --- */
.treat-tray {
    position: fixed;
    width: 50px;
    height: 18px;
    background: linear-gradient(to bottom, #b0b0b0, #888);
    border-radius: 0 0 12px 12px;
    border: 2px solid #999;
    border-top: none;
    z-index: 9998;
    animation: treat-appear 0.4s ease-out;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.treat-box {
    position: fixed;
    width: 42px;
    height: 48px;
    background: linear-gradient(135deg, #e8a44a, #d4893a);
    border-radius: 4px;
    border: 2px solid #c07830;
    z-index: 9999;
    cursor: pointer;
    animation: treat-box-pulse 1.2s ease-in-out infinite, treat-appear 0.4s ease-out;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 3px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    transition: transform 0.4s ease;
}

.treat-box::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.treat-box-label {
    font-family: var(--font-family, sans-serif);
    font-size: 8px;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.treat-box.pouring {
    transform: rotate(-35deg);
    animation: none;
    cursor: default;
}

.treat-particle {
    position: fixed;
    width: 7px;
    height: 7px;
    background: #8B6914;
    border-radius: 50%;
    z-index: 9999;
    animation: treat-fall 0.7s ease-in forwards;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.treat-heart {
    position: fixed;
    color: #ff4466;
    font-size: 1.2rem;
    z-index: 9999;
    animation: treat-heart-float 1.8s ease-out forwards;
    pointer-events: none;
}

@keyframes treat-appear {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes treat-box-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes treat-fall {
    0% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateY(55px) translateX(var(--drift, 3px)); }
}

@keyframes treat-heart-float {
    0% { opacity: 0; transform: translateY(0) scale(0.3); }
    15% { opacity: 1; transform: translateY(-8px) scale(1); }
    70% { opacity: 0.8; transform: translateY(-30px) scale(1.1); }
    100% { opacity: 0; transform: translateY(-50px) scale(0.6); }
}

/* --- Sync Page --- */
.sync-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.sync-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 20px;
    background: var(--white);
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s var(--transition-bounce);
    font-family: var(--font-family);
    -webkit-tap-highlight-color: transparent;
    text-align: center;
}

.sync-card:hover {
    border-color: var(--orange-secondary);
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.sync-card:active {
    transform: scale(0.97);
}

.sync-card-icon {
    font-size: 2rem;
}

.sync-card-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--chocolate);
}

.sync-card-desc {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brown-warm);
    opacity: 0.7;
}

.sync-section {
    margin-bottom: 20px;
}

.sync-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
    margin-bottom: 8px;
}

.sync-phrase {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 12px;
}

.sync-phrase-words {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.sync-phrase-word {
    background: linear-gradient(135deg, var(--orange-primary), var(--orange-secondary));
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
}

.sync-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 12px;
}

.sync-qr svg {
    border-radius: var(--radius-sm);
}

.sync-qr-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brown-warm);
    opacity: 0.7;
    margin-top: 8px;
}

.sync-data-area {
    width: 100%;
    min-height: 80px;
    max-height: 150px;
    padding: 12px;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 16px;
    color: var(--chocolate);
    background: var(--white);
    resize: none;
    outline: none;
    transition: border-color 0.3s;
    word-break: break-all;
}

.sync-data-area:focus {
    border-color: var(--orange-primary);
}

.sync-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    color: var(--chocolate);
    background: var(--white);
    outline: none;
    transition: border-color 0.3s;
}

.sync-input:focus {
    border-color: var(--orange-primary);
}

.sync-input::placeholder {
    color: var(--gray);
    opacity: 0.6;
}

.sync-btn-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.sync-btn-row .btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.85rem;
}

.sync-hint {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brown-warm);
    opacity: 0.6;
    text-align: center;
    margin: 12px 0;
    line-height: 1.4;
}

.sync-camera {
    position: relative;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    margin-bottom: 12px;
}

.sync-camera video {
    width: 100%;
    display: block;
}

.sync-camera-close {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 8px 14px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

/* --- Cloud Sync --- */
.cloud-sync-card {
    background: var(--cream);
    border: 2px solid var(--orange-light);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
}

.cloud-sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
}

.cloud-sync-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray);
    flex-shrink: 0;
}

.cloud-sync-dot.connected {
    background: #4CAF50;
}

.cloud-sync-dot.error {
    background: #e53935;
}

.cloud-sync-last {
    font-size: 0.8rem;
    color: var(--brown-warm);
    opacity: 0.7;
    margin-bottom: 12px;
}

.cloud-sync-divider {
    margin: 24px 0 16px;
    border: none;
    border-top: 1px solid var(--orange-light);
}

/* --- Phrase Autocomplete --- */
.phrase-ac-wrapper {
    position: relative;
}

.phrase-ac-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 50;
    background: var(--white);
    border: 2px solid var(--orange-light);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
}

.phrase-ac-dropdown.visible {
    display: block;
}

.phrase-ac-item {
    padding: 10px 14px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.95rem;
    color: var(--brown-dark);
}

.phrase-ac-item:hover,
.phrase-ac-item.active {
    background: var(--cream);
    color: var(--orange);
}

/* --- Hubi Zone (mobile pet area) --- */
#hubi-zone {
    display: none;
}

@media (max-width: 380px) {
    .page-title.slot-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 520px) {
    body {
        position: relative;
    }

    #app {
        min-height: auto;
    }

    #hubi-zone {
        display: block;
        min-height: 300px;
        padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
    }

    #hubi-pet {
        position: absolute;
    }
}
