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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #030712;
    color: #f3f4f6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 70px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

/* Header */
header {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.logo-icon { width: 36px; height: 36px; flex-shrink: 0; }
.logo-text { font-size: 1.25rem; font-weight: 600; color: #f3f4f6; }
.logo:hover .logo-text { color: #10b981; }

#habit-text {
    font-size: 0.9rem;
    color: #9ca3af;
    line-height: 1.2;
}
#habit-text::before { content: '„'; font-size: 1.3rem; color: #4b5563; margin-right: 0.15rem; vertical-align: -0.15em; }
#habit-text::after { content: '"'; font-size: 1.3rem; color: #4b5563; margin-left: 0.15rem; vertical-align: -0.1em; }

/* Menu Backdrop */
.menu-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 25;
}
.menu-backdrop.hidden { display: none; }

/* Logo Menu */
.logo-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background: #1f2937;
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 30;
    min-width: 380px;
}
.logo-menu.hidden { display: none; }

.logo-menu button,
.logo-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: #f3f4f6;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    white-space: nowrap;
    text-decoration: none;
}
.logo-menu button:hover,
.logo-menu a:hover { background: #374151; }

.legal-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
}
.legal-row .komplexitaeter-link {
    padding: 0;
    width: auto;
}
.legal-row .komplexitaeter-link:hover {
    background: none;
}
.legal-row .komplexitaeter-logo {
    height: 26px;
    width: auto;
}
.logo-menu .legal-divider {
    color: #374151;
    font-size: 0.7rem;
}
.logo-menu .legal-link {
    color: #4b5563;
    text-decoration: none;
    font-size: 0.7rem;
    padding: 0;
    width: auto;
}
.logo-menu .legal-link:hover {
    color: #9ca3af;
    background: none;
}

.logo-menu-divider { height: 1px; background: #374151; margin: 0.5rem 0; }

/* Habits Header with Edit Button */
/* (removed - no longer needed) */

/* Habits List */
.habits-list {
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.habits-list::-webkit-scrollbar { display: none; }

.habit-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    color: #f3f4f6;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.habit-item:hover { background: #374151; }
.habit-item.active { background: #1f4a3d; }
.habit-item.active:hover { background: #245a4a; }

.habit-item-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
}
.habit-item-icon svg { width: 18px; height: 18px; }

.habit-item-title {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Delete Button - immer sichtbar */
.habit-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.habit-delete-btn:hover {
    background: #dc2626;
    color: #fff;
}
.habit-delete-btn svg {
    width: 16px;
    height: 16px;
}

.no-habits {
    padding: 0.75rem 1rem;
    color: #6b7280;
    font-size: 0.85rem;
    text-align: center;
}

/* Scroll Wrapper */
.scroll-wrapper {
    position: relative;
    flex: 1;
    min-height: 0;
}
.scroll-wrapper::before,
.scroll-wrapper::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 50px;
    pointer-events: none;
    z-index: 5;
}
.scroll-wrapper::before { top: 0; background: linear-gradient(to bottom, #030712 0%, transparent 100%); }
.scroll-wrapper::after { bottom: 0; background: linear-gradient(to top, #030712 0%, transparent 100%); }

#scroll-container {
    height: 100%;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-top: 10px;
    padding-bottom: 10px;
}
#scroll-container::-webkit-scrollbar { display: none; }

/* Grid */
.week-grid {
    display: grid;
    grid-template-columns: 40px repeat(7, 1fr) 24px;
    gap: 6px;
    align-items: center;
}

.day-headers { margin-bottom: 0.5rem; }
.day-headers span { text-align: center; font-size: 0.75rem; color: #6b7280; }

.year-marker {
    text-align: center;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border-top: 1px solid #374151;
    font-size: 1.5rem;
    font-weight: bold;
    color: #10b981;
}

.month-marker {
    text-align: center;
    padding: 0.5rem;
    margin: 0.25rem 0;
    border-top: 1px solid #1f2937;
    font-size: 1rem;
    color: #9ca3af;
}

.week-row { padding: 4px 0; border-radius: 4px; }
.week-row.current { background: #111827; }
.week-label { text-align: right; font-size: 0.7rem; color: #4b5563; white-space: nowrap; }

/* Day Buttons */
.day-btn {
    aspect-ratio: 1;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    background: #1f2937;
    color: #9ca3af;
    width: 100%;
}
.day-btn:hover { background: #374151; }
.day-btn.past { color: #9ca3af; }
.day-btn.future { background: #0d1117; color: #374151; opacity: 0.6; }
.day-btn.future:hover { opacity: 0.8; background: #1f2937; }
.day-btn.inactive { background: #0d1117; color: #374151; opacity: 0.6; }
.day-btn.inactive:hover { opacity: 0.8; background: #1f2937; }
.day-btn.checked { background: #10b981; color: #030712; opacity: 1; }
.day-btn.checked:hover { background: #34d399; }
.day-btn.today { box-shadow: 0 0 0 2px #030712, 0 0 0 4px #10b981; opacity: 1; }
.day-btn:disabled { cursor: default; opacity: 0.3; }

.week-stats { text-align: center; font-size: 0.75rem; color: #4b5563; font-variant-numeric: tabular-nums; }

/* Floating Buttons */
.jump-btn {
    position: fixed;
    bottom: 45px; right: 20px;
    width: 50px; height: 50px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transition: transform 0.2s, background 0.2s;
    z-index: 20;
}
.jump-btn:hover { background: #60a5fa; transform: scale(1.1); }

.share-btn {
    position: fixed;
    bottom: 45px; left: 20px;
    width: 50px; height: 50px;
    border-radius: 50%;
    background: #6b7280;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
    transition: transform 0.2s, background 0.2s;
    z-index: 20;
}
.share-btn:hover { background: #9ca3af; transform: scale(1.1); }

/* Stats Bar */
.stats {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 1rem;
    background: #111827;
    border-top: 1px solid #1f2937;
    display: flex;
    justify-content: space-around;
    text-align: center;
    z-index: 10;
}
.stats .number { font-size: 1.5rem; font-weight: bold; color: #10b981; }
.stats .number.gray { color: #9ca3af; }
.stats .label { font-size: 0.75rem; color: #6b7280; }

/* Overlay */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(3, 7, 18, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}
.overlay.hidden { display: none; }
.overlay.dismissable { cursor: pointer; }

.overlay-content {
    background: rgba(17, 24, 39, 0.95);
    padding: 2rem;
    border-radius: 16px;
    max-width: 450px;
    width: 100%;
    text-align: center;
    border: 1px solid #374151;
    cursor: default;
}

.overlay h2 { font-size: 1.5rem; font-weight: 400; margin-bottom: 0.5rem; color: #3b82f6; }
.overlay p { color: #9ca3af; margin-bottom: 1.5rem; }

.overlay input[type="text"] {
    width: 100%;
    padding: 0.875rem 1rem;
    background: #1f2937;
    border: 2px solid #374151;
    border-radius: 8px;
    color: #f3f4f6;
    font-size: 1rem;
    margin-bottom: 1rem;
}
.overlay input[type="text"]:focus { outline: none; border-color: #3b82f6; }

.suggestions-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
    height: 150px;
}
.suggestions-wrapper::before,
.suggestions-wrapper::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 40px;
    pointer-events: none;
    z-index: 5;
}
.suggestions-wrapper::before { top: 0; background: linear-gradient(to bottom, rgba(17, 24, 39, 0.95), transparent); }
.suggestions-wrapper::after { bottom: 0; background: linear-gradient(to top, rgba(17, 24, 39, 0.95), transparent); }

.suggestions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    height: 100%;
    overflow-y: auto;
    padding: 50px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: y mandatory;
}
.suggestions::-webkit-scrollbar { display: none; }

.suggestion-btn {
    background: #1f2937;
    border: 1px solid #374151;
    color: #9ca3af;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease-out;
    white-space: nowrap;
    flex-shrink: 0;
    scroll-snap-align: center;
}
.suggestion-btn:hover { background: #374151; color: #f3f4f6; }

.btn-start {
    width: 100%;
    padding: 1rem;
    background: #3b82f6;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-start:hover { background: #60a5fa; }
.btn-start:disabled { background: #374151; color: #6b7280; cursor: not-allowed; }

/* Share Menu */
.share-menu {
    position: fixed;
    bottom: 110px; left: 20px;
    background: #1f2937;
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 30;
}
.share-menu.hidden { display: none; }
.share-menu button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: #f3f4f6;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    white-space: nowrap;
}
.share-menu button:hover { background: #374151; }

/* Delete Dialog */
.delete-dialog {
    background: rgba(17, 24, 39, 0.98);
    padding: 1.5rem;
    border-radius: 12px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    border: 1px solid #374151;
    cursor: default;
}
.delete-dialog h3 { font-size: 1.1rem; font-weight: 500; margin-bottom: 0.5rem; color: #f3f4f6; }
.delete-dialog p { color: #9ca3af; font-size: 0.9rem; margin-bottom: 1rem; }
.delete-dialog .habit-name { color: #10b981; font-weight: 500; }

.delete-dialog-buttons { display: flex; gap: 0.75rem; }
.delete-dialog-buttons button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-cancel { background: #374151; color: #f3f4f6; }
.btn-cancel:hover { background: #4b5563; }
.btn-delete { background: #dc2626; color: #fff; }
.btn-delete:hover { background: #ef4444; }

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: #030712;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

/* Mobile */
@media (max-width: 480px) {
    .container { padding: 0.5rem; }
    header { gap: 0.5rem; }
    .logo-icon { width: 28px; height: 28px; }
    .logo-text { font-size: 1.1rem; }
    #habit-text { font-size: 0.8rem; }
    #habit-text::before, #habit-text::after { font-size: 1.1rem; }
    .week-grid { grid-template-columns: 60px repeat(7, 1fr) 22px; gap: 3px; }
    .day-headers span { font-size: 0.65rem; }
    .week-label { font-size: 0.6rem; }
    .day-btn { font-size: 0.7rem; }
    .week-stats { font-size: 0.6rem; }
    .stats .number { font-size: 1.25rem; }
    .stats .label { font-size: 0.65rem; }
    .jump-btn, .share-btn { width: 44px; height: 44px; bottom: 40px; }
    .jump-btn { right: 12px; }
    .share-btn { left: 12px; }
    .overlay-content { padding: 1.5rem; }
}