/* SlotTogether – warm paper-sticker aesthetic */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,800&family=Karla:wght@400;600;700&display=swap');

:root {
    --paper:   #faf4e8;
    --ink:     #22271f;
    --ink-soft:#6b6f60;
    --card:    #fffdf7;
    --line:    #22271f;
    --yes:     #3aa06a;
    --yes-soft:#dff1e5;
    --maybe:   #e8a531;
    --maybe-soft:#faeecf;
    --no-soft: #f3ece0;
    --accent:  #e2543a;
    --radius:  18px;
    --shadow:  4px 4px 0 var(--ink);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    background-image: radial-gradient(#e7dcc4 1px, transparent 1px);
    background-size: 22px 22px;
    color: var(--ink);
    font-family: 'Karla', sans-serif;
    font-size: 18px;
    line-height: 1.5;
}

.wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}
.wrap-wide { max-width: 860px; }

.brand {
    display: block;
    text-align: center;
    font-family: 'Fraunces', serif;
    font-weight: 800;
    font-size: 22px;
    color: var(--ink);
    text-decoration: none;
    margin-bottom: 18px;
}
.brand span { color: var(--accent); }

.card {
    background: var(--card);
    border: 2.5px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 20px;
    margin-bottom: 22px;
}
.center { text-align: center; }
.bigmoji { font-size: 56px; line-height: 1; margin-bottom: 8px; }

.h1 {
    font-family: 'Fraunces', serif;
    font-weight: 800;
    font-size: 34px;
    line-height: 1.15;
    margin: 0 0 10px;
}
.h2 {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 22px;
    margin: 0 0 12px;
}
.lead { font-size: 19px; color: var(--ink-soft); margin: 0 0 18px; }
.mono { font-family: monospace; word-break: break-all; background: var(--no-soft); padding: 10px; border-radius: 10px; }

label.field-label {
    display: block;
    font-weight: 700;
    font-size: 19px;
    margin: 0 0 8px;
}
.hint { font-size: 15px; color: var(--ink-soft); margin: 4px 0 10px; }

.optional { font-weight: 400; color: var(--ink-soft); font-size: 16px; }

input[type=text], input[type=date], input[type=number] {
    width: 100%;
    font: inherit;
    font-size: 20px;
    padding: 14px 14px;
    border: 2.5px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    -webkit-appearance: none;
}
input:focus { outline: 3px solid var(--maybe); outline-offset: 2px; }

/* Buttons */
.btn {
    display: inline-block;
    font: inherit;
    font-weight: 700;
    font-size: 20px;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    background: #fff;
    border: 2.5px solid var(--line);
    border-radius: 14px;
    padding: 15px 22px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .06s ease, box-shadow .06s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-green   { background: var(--yes); color: #fff; }
.btn-block   { display: block; width: 100%; }
.btn-small   { font-size: 16px; padding: 10px 16px; box-shadow: 3px 3px 0 var(--ink); }

/* Date chips (create page) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
    background: var(--yes-soft);
    border: 2px solid var(--line);
    border-radius: 999px;
    padding: 8px 8px 8px 16px;
}
.chip button {
    font: inherit;
    font-weight: 700;
    border: 2px solid var(--line);
    background: #fff;
    border-radius: 999px;
    width: 30px; height: 30px;
    line-height: 1;
    cursor: pointer;
}

/* Hour / slot grids */
.slot-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 10px 0 6px;
}
.slot {
    font: inherit;
    font-weight: 700;
    font-size: 18px;
    padding: 14px 4px;
    border: 2.5px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background .1s ease;
}
.slot .sub { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.slot[data-state="1"] { background: var(--maybe); }
.slot[data-state="1"] .sub { color: #5c4104; }
.slot[data-state="2"] { background: var(--yes); color: #fff; }
.slot[data-state="2"] .sub { color: #d9f2e3; }
.slot.on { background: var(--yes); color: #fff; }

.day-block { margin-bottom: 22px; }
.day-title {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 20px;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.day-title::before { content: "📅"; font-size: 18px; }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 15px; font-weight: 600; margin: 6px 0 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 16px; height: 16px; border-radius: 5px; border: 2px solid var(--line); display: inline-block; }
.dot-yes   { background: var(--yes); }
.dot-maybe { background: var(--maybe); }
.dot-no    { background: #fff; }

/* Share page link boxes */
.linkbox { margin-bottom: 20px; }
.linkbox .mono { display: block; margin: 8px 0 10px; font-size: 14px; }

/* Best time banner */
.best {
    background: var(--yes);
    color: #fff;
    border: 2.5px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 22px;
    text-align: center;
}
.best .h2 { color: #fff; margin-bottom: 6px; }
.best .when { font-family: 'Fraunces', serif; font-weight: 800; font-size: 28px; line-height: 1.2; }
.best .count { font-size: 16px; margin-top: 6px; color: #dff1e5; }
.best .best-slot { margin-bottom: 12px; }
.best .best-slot:last-of-type { margin-bottom: 0; }
.best .who {
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    background: rgba(255,255,255,.16);
    border-radius: 999px;
    padding: 4px 14px;
    margin-top: 6px;
}
.best .who-maybe { color: #ffe9bd; }
.best .who-no { color: #ffd6cc; background: rgba(0,0,0,.14); }
.btn-summary { margin-top: 14px; background: #fff; }

/* Results grid */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
table.grid { border-collapse: collapse; width: 100%; min-width: 420px; background: #fff; }
table.grid th, table.grid td {
    border: 2px solid var(--line);
    padding: 8px 10px;
    font-size: 15px;
    text-align: center;
    white-space: nowrap;
}
table.grid th { background: var(--no-soft); font-weight: 700; }
table.grid th.slot-h { text-align: left; }
td.c-yes   { background: var(--yes);   }
td.c-maybe { background: var(--maybe); }
td.c-no    { background: #fff; color: #c9c2b2; }
tr.is-best th.slot-h { background: var(--yes-soft); }
tr.is-best th.slot-h::after { content: " ⭐"; }

.people { list-style: none; margin: 0; padding: 0; }
.people li {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 18px;
    padding: 10px 0;
    border-bottom: 2px dashed #e0d6c0;
}
.people li:last-child { border-bottom: 0; }
.people .avatar {
    width: 38px; height: 38px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--maybe-soft);
    border: 2px solid var(--line);
    border-radius: 999px;
    font-family: 'Fraunces', serif; font-weight: 800; font-size: 17px;
}

.footer-note { text-align: center; font-size: 14px; color: var(--ink-soft); margin-top: 14px; }

/* Modal (name already taken) */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(34, 39, 31, .55);
}
.modal-overlay[hidden] { display: none; }
.modal { max-width: 420px; width: 100%; margin-bottom: 0; }

.copied { background: var(--yes) !important; color: #fff !important; }

/* Page-load reveal */
.card, .best { animation: pop .35s ease both; }
.card:nth-of-type(2) { animation-delay: .07s; }
.card:nth-of-type(3) { animation-delay: .14s; }
@keyframes pop {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

@media (min-width: 480px) {
    .slot-grid { grid-template-columns: repeat(4, 1fr); }
    .h1 { font-size: 40px; }
}
