:root {
    --bg-color: #eaddcf;
    --surface-color: #fff;
    --primary: #e60000;
    --text-main: #111;
    --font-sans: Impact, Charcoal, sans-serif;
    --font-serif: "Times New Roman", Times, serif;
    --font-mono: "Courier New", Courier, monospace;
    --font-comic: "Comic Sans MS", cursive, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-mono);
    background-color: var(--bg-color);
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.05) 10px, rgba(0,0,0,0.05) 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(0,0,0,0.05) 10px, rgba(0,0,0,0.05) 20px);
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    text-transform: uppercase;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 600px; 
    margin: 0 auto;
    position: relative;
}

header {
    padding: 30px 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

h1 {
    font-family: var(--font-sans);
    font-size: 46px;
    background-color: black;
    color: white;
    padding: 5px 15px;
    transform: rotate(-4deg);
    display: inline-block;
    letter-spacing: 3px;
    border: 4px solid var(--primary);
    box-shadow: -8px 8px 0px var(--primary);
    text-shadow: 2px 2px 0px red;
}

h1:active {
    transform: rotate(5deg) scale(1.1);
}

.subtitle {
    font-family: var(--font-serif);
    font-size: 18px;
    color: var(--primary);
    transform: rotate(3deg);
    margin-top: 15px;
    background: yellow;
    display: inline-block;
    padding: 4px 10px;
    border: 2px dashed black;
    font-weight: bold;
}

.date-display {
    font-family: var(--font-comic);
    font-size: 18px;
    font-weight: bold;
    color: white;
    background: black;
    padding: 15px 10px;
    border-radius: 50% 20% / 10% 40%;
    transform: rotate(15deg);
    border: 4px dotted var(--primary);
    box-shadow: inset 0 0 10px red;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stats-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    justify-content: center;
}

.stat-box {
    flex: 1;
    background-color: var(--surface-color);
    border: 5px solid black;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 8px 8px 0px rgba(0,0,0,1);
}

.stat-box:first-child {
    transform: rotate(-6deg);
    font-family: var(--font-serif);
    background: #fff;
}

.stat-box:last-child {
    transform: rotate(4deg);
    background-color: var(--primary);
    color: white;
    border-color: white;
    box-shadow: -8px 8px 0px black;
    border: 5px double black;
}

.stat-value {
    font-size: 54px;
    font-weight: bold;
    font-family: var(--font-sans);
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    letter-spacing: 2px;
    margin-top: 8px;
    text-align: center;
    font-weight: bold;
}

.section-header {
    padding: 10px 20px;
}

.section-header h2 {
    font-family: var(--font-sans);
    font-size: 28px;
    background: black;
    color: white;
    display: inline-block;
    padding: 8px 12px;
    transform: skew(-15deg) rotate(-2deg);
    border-bottom: 5px solid var(--primary);
}

.habits-list {
    flex: 1;
    padding: 10px 20px 100px; 
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.habit-card {
    background-color: white;
    border: 4px solid black;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transform: rotate(1deg);
    box-shadow: 6px 6px 0px black;
    cursor: pointer;
}

.habit-card:nth-child(even) {
    transform: rotate(-2deg);
    border-style: dashed;
    background-color: #f9f9f9;
}

.habit-card:nth-child(3n) {
    border-style: dotted;
    transform: rotate(3deg);
}

.habit-card:active {
    transform: scale(0.95) rotate(5deg);
    background-color: yellow;
}

.habit-info {
    flex: 1;
}

.habit-name {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: bold;
    line-height: 1.2;
}

.habit-streak {
    font-family: var(--font-mono);
    font-size: 14px;
    background: yellow;
    display: inline-block;
    padding: 4px 8px;
    border: 2px solid black;
    color: black;
    margin-top: 8px;
    font-weight: bold;
    transform: rotate(-2deg);
}

.habit-streak i {
    color: red;
}

.habit-toggle {
    width: 40px;
    height: 40px;
    border: 4px solid black;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    box-shadow: 3px 3px 0 black;
    transform: rotate(15deg);
}

/* Completed State */
.habit-card.completed {
    background-color: black;
    color: white;
    border-color: var(--primary);
}

.habit-card.completed .habit-name {
    text-decoration: line-through;
    text-decoration-color: var(--primary);
    text-decoration-thickness: 5px;
}

.habit-card.completed .habit-toggle {
    background-color: var(--primary);
    border-color: white;
    color: black;
    box-shadow: 3px 3px 0 white;
}

.empty-state {
    font-family: var(--font-comic);
    font-size: 24px;
    color: black;
    text-align: center;
    background: yellow;
    border: 6px dotted var(--primary);
    padding: 40px 20px;
    transform: rotate(-3deg);
    box-shadow: -10px 10px 0 black;
    margin-top: 20px;
}

.empty-state i {
    font-size: 56px;
    margin-bottom: 20px;
    color: var(--primary);
    display: inline-block;
    transform: rotate(180deg);
}

.fab {
    position: fixed;
    bottom: 30px;
    right: max(30px, calc(50vw - 270px));
    width: 70px;
    height: 70px;
    border-radius: 0;
    background-color: var(--primary);
    color: white;
    border: 5px solid black;
    font-family: var(--font-sans);
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 8px 8px 0 white, 12px 12px 0 black;
    cursor: pointer;
    z-index: 10;
    transform: rotate(15deg);
}

.fab:active {
    transform: rotate(-45deg) scale(0.8);
    background-color: yellow;
    color: black;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: black;
    color: white;
    width: 90%;
    max-width: 400px;
    padding: 30px;
    border: 8px solid var(--primary);
    transform: scale(0.5) rotate(-20deg);
    transition: transform 0.2s;
    box-shadow: 15px 15px 0 yellow;
}

.modal-overlay.active .modal-content {
    transform: scale(1) rotate(2deg);
}

.modal-content h2 {
    font-family: var(--font-sans);
    font-size: 36px;
    margin-bottom: 15px;
    color: yellow;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.modal-desc {
    font-family: var(--font-mono);
    font-size: 16px;
    background: var(--primary);
    padding: 8px;
    display: inline-block;
    margin-bottom: 25px;
    border: 2px dashed white;
    transform: rotate(-1deg);
}

.modal-content input {
    width: 100%;
    background-color: white;
    border: 6px solid yellow;
    padding: 15px;
    color: black;
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 30px;
    outline: none;
    box-shadow: inset 4px 4px 0 rgba(0,0,0,0.3);
}

.modal-content input:focus {
    border-color: var(--primary);
    background-color: #fff9f9;
}

.modal-actions {
    display: flex;
    gap: 20px;
}

.modal-actions button {
    flex: 1;
    padding: 15px;
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 4px 4px 0 white;
}

.btn-secondary {
    background-color: white;
    color: black;
    border: 4px solid black;
    font-family: var(--font-mono);
    transform: rotate(-3deg);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: 4px solid yellow;
    font-family: var(--font-sans);
    transform: rotate(3deg);
}

.btn-primary:active, .btn-secondary:active {
    transform: scale(0.9);
}

i.ph, i[class*="ph-"] {
    transform: rotate(10deg);
}