@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    --ink: #17324d;
    --muted: #718096;
    --paper: #fffdf8;
    --line: #e7e3d9;
    --accent: #e76f51;
    --accent-dark: #bb4f37;
    --mint: #dff3e8;
    --sky: #e4f2f7;
    --shadow: 0 22px 60px rgba(35, 63, 77, 0.13);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: linear-gradient(135deg, #f8efe2 0%, #e7f2ee 52%, #dcebf1 100%);
    font-family: 'DM Sans', sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

.calendar-app {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 56px;
}

.back-link {
    color: var(--ink);
    font-size: 0.9rem;
    text-decoration: none;
}

.back-link:hover { color: var(--accent-dark); }

.app-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding: 62px 4px 30px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-dark);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1, h2 { font-family: 'Space Grotesk', sans-serif; }
h1 { margin: 0; font-size: clamp(2.7rem, 7vw, 5.5rem); line-height: 0.95; letter-spacing: 0; }
.subtitle { margin: 15px 0 0; color: var(--muted); font-size: 1.03rem; }

.today-button, .icon-button, .event-input-row button {
    border: 0;
    color: white;
    background: var(--ink);
    transition: transform 160ms ease, background 160ms ease;
}

.today-button { padding: 12px 20px; border-radius: 4px; font-weight: 700; }
.today-button:hover, .icon-button:hover, .event-input-row button:hover { background: var(--accent-dark); transform: translateY(-2px); }

.calendar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.75fr);
    gap: 18px;
}

.calendar-panel, .events-panel {
    background: rgba(255, 253, 248, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: var(--shadow);
}

.calendar-panel { padding: clamp(20px, 4vw, 38px); }
.events-panel { display: flex; flex-direction: column; padding: clamp(22px, 3vw, 32px); }

.month-toolbar { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 12px; margin-bottom: 28px; }
.month-toolbar h2 { margin: 0; text-align: center; font-size: clamp(1.2rem, 3vw, 1.7rem); }
.icon-button { width: 42px; height: 42px; border-radius: 50%; font-size: 1.2rem; }
.icon-button:last-child { justify-self: end; }

.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { gap: 6px; margin-bottom: 8px; color: var(--muted); font-size: 0.72rem; font-weight: 700; text-align: center; text-transform: uppercase; }
.calendar-grid { gap: 6px; }

.day {
    position: relative;
    min-height: 76px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.45);
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.day:hover { border-color: var(--accent); transform: translateY(-2px); }
.day.other-month { color: #aeb8b9; background: transparent; }
.day.today { border: 2px solid var(--accent); padding: 9px; }
.day.selected { color: var(--ink); background: var(--mint); border-color: #76b696; }
.day-number { font-weight: 700; }
.event-dot { display: block; width: 7px; height: 7px; margin-top: 13px; border-radius: 50%; background: var(--accent); }

.selected-date-heading { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.selected-date-heading h2 { margin: 0; font-size: 1.55rem; line-height: 1.1; }
.event-form { padding: 24px 0; }
.event-form label { display: block; margin-bottom: 10px; font-size: 0.86rem; font-weight: 700; }
.event-input-row { display: flex; gap: 8px; }
.event-input-row input { min-width: 0; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: white; outline: none; }
.event-input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.16); }
.event-input-row button { width: 44px; flex: 0 0 44px; border-radius: 3px; font-size: 1.5rem; line-height: 1; }
.event-list { display: grid; gap: 10px; }
.event-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 12px 14px; border-left: 3px solid var(--accent); background: var(--sky); }
.event-item span { overflow-wrap: anywhere; font-size: 0.91rem; }
.delete-event { padding: 4px 10px; border: 0; color: var(--muted); background: transparent; font-size: 1.1rem; }
.delete-event:hover { color: var(--accent-dark); }
.empty-state { margin: 8px 0; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 760px) {
    .calendar-app { width: min(100% - 20px, 620px); padding-top: 22px; }
    .app-header { align-items: start; flex-direction: column; padding-top: 44px; }
    .calendar-layout { grid-template-columns: 1fr; }
    .day { min-height: 58px; padding: 7px; font-size: 0.9rem; }
    .day.today { padding: 6px; }
    .event-dot { margin-top: 9px; }
}

@media (max-width: 430px) {
    .calendar-panel { padding: 16px 10px; }
    .weekdays { font-size: 0.6rem; }
    .calendar-grid, .weekdays { gap: 3px; }
    .day { min-height: 48px; padding: 5px; }
    .day.today { padding: 4px; }
}