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

:root {
    --primary-color: #8b5a3c;
    --secondary-color: #d4a574;
    --accent-color: #f5e6d3;
    --text-dark: #2c1810;
    --text-light: #6b5344;
    --border-color: #c9a876;
    --error-color: #c24a4a;
    --success-color: #4a8a4a;
}

body {
    font-family: 'Georgia', 'Garamond', serif;
    background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6b4423 100%);
    color: var(--accent-color);
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Form Section */
.form-section {
    margin-bottom: 3rem;
}

.form-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--border-color);
}

.form-container h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

input[type="text"],
input[type="date"],
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Georgia', serif;
    font-size: 1rem;
    color: var(--text-dark);
    background: var(--accent-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(139, 90, 60, 0.2);
}

small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

.submit-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.2s ease;
}

.submit-btn:hover {
    background: #6b4423;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(139, 90, 60, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    display: none;
    text-align: center;
    font-weight: 600;
}

.form-message.success {
    background: rgba(74, 138, 74, 0.1);
    color: var(--success-color);
    display: block;
    border: 1px solid var(--success-color);
}

.form-message.error {
    background: rgba(194, 74, 74, 0.1);
    color: var(--error-color);
    display: block;
    border: 1px solid var(--error-color);
}

/* Grid Section */
.grid-section {
    margin-bottom: 3rem;
}

.grid-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 2rem;
}

.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    animation: fadeIn 0.5s ease;
}

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

/* Individual Tile */
.tile {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(139, 90, 60, 0.15);
}

.tile-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    word-break: break-word;
}

.tile-message {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    line-height: 1.5;
    word-break: break-word;
}

.tile-date {
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: right;
    font-style: italic;
}

.loading {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .form-container {
        padding: 1.5rem;
    }

    .tiles-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .tile {
        padding: 1rem;
    }

    .tile-name {
        font-size: 1.1rem;
    }

    .tile-message {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }

    header p {
        font-size: 0.95rem;
    }

    main {
        margin: 1rem auto;
    }

    .form-container {
        padding: 1rem;
    }

    .tiles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    label {
        font-size: 0.95rem;
    }

    input,
    textarea {
        font-size: 16px; /* Prevents zoom-in on iOS */
    }
}
