:root {
  color-scheme: light;
  --page: #ffffff;
  --card: #edf7f0;
  --grey: #f5f5f7;
  --forest: #0d472a;
  --evergreen: #1a6b3d;
  --ink: #212624;
  --amber: #a85400;
  --line: #dfe3e0;
  --tab-height: 68px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--forest); }
body { -webkit-text-size-adjust: 100%; }
button, input, a { font: inherit; }
button { color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--evergreen); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }

#screen {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(var(--tab-height) + 32px + env(safe-area-inset-bottom));
}

.header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.header h1 { font-size: clamp(22px, 7vw, 34px); line-height: 1.15; }
.subtitle { font-size: 12px; color: var(--evergreen); margin-top: 4px; letter-spacing: 0.02em; }
.bell { font-size: 26px; min-width: 44px; min-height: 44px; }
.page-title { text-align: center; font-size: 17px; font-weight: 600; margin-bottom: 16px; }

.search {
  width: 100%; margin-top: 16px; padding: 13px 14px; border: 0; border-radius: 12px;
  background: var(--card); color: var(--forest); font-size: 16px;
}
.search::placeholder { color: #5f7a6a; }
.chips { display: flex; gap: 8px; margin: 14px 0 18px; overflow-x: auto; }
.chip { flex: none; min-height: 40px; padding: 8px 15px; border-radius: 999px; background: var(--card); font-weight: 600; font-size: 15px; }
.chip[aria-pressed="true"] { background: var(--evergreen); color: #fff; }
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.empty { color: var(--evergreen); padding: 8px 0; }

.card {
  position: relative; display: flex; gap: 14px; align-items: center; width: 100%;
  padding: 12px 52px 12px 12px; margin-bottom: 12px; border-radius: 16px; background: var(--card); text-align: left;
}
.market-emoji {
  flex: none; display: grid; place-items: center; width: 84px; height: 84px;
  background: var(--page); border-radius: 14px; font-size: 38px;
}
.card-name { display: block; font-weight: 700; font-size: 17px; line-height: 1.25; }
.card-area { display: block; color: var(--evergreen); font-size: 15px; margin-top: 3px; }
.card-dates { display: block; font-size: 15px; margin-top: 3px; }
.status { display: block; font-size: 13px; margin-top: 4px; }
.status.confirmed { color: var(--evergreen); }
.status.warning { color: var(--amber); }
.card-wrap { position: relative; }
.heart { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; font-size: 22px; color: var(--evergreen); }

#map { position: fixed; inset: 0 0 calc(var(--tab-height) + env(safe-area-inset-bottom)); z-index: 1; }
.legend {
  position: fixed; z-index: 500; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-height) + 12px + env(safe-area-inset-bottom));
  display: flex; gap: 14px; padding: 7px 12px; white-space: nowrap;
  background: var(--page); border-radius: 999px; font-size: 13px; box-shadow: 0 1px 6px rgb(0 0 0 / 0.2);
}
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.pin { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; font-size: 17px; box-shadow: 0 1px 4px rgb(0 0 0 / 0.4); }
.pin.confirmed { background: var(--evergreen); }
.pin.warning { background: var(--amber); }

.month-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.month-head strong { font-size: 18px; }
.month-button { width: 44px; height: 44px; font-size: 24px; color: var(--evergreen); }
.month-button:disabled { opacity: 0.25; cursor: default; }
.calendar-box { padding: 12px; margin-bottom: 18px; border-radius: 16px; background: var(--card); }
.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.weekdays { font-size: 12px; font-weight: 600; color: #5f7a6a; margin-bottom: 4px; }
.day { position: relative; aspect-ratio: 1; max-height: 56px; width: 100%; border-radius: 50%; font-size: 17px; }
.day.has-market::after { content: ""; position: absolute; left: 50%; bottom: 12%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #c8352e; }
.day[aria-pressed="true"] { background: var(--evergreen); color: #fff; font-weight: 700; }
.day[aria-pressed="true"]::after { background: #fff; }
.day-title { font-weight: 700; margin-bottom: 12px; }

.sheet { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; background: rgb(0 0 0 / 0.35); }
.sheet[hidden] { display: none; }
.sheet-panel {
  width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; background: var(--page); color: var(--ink);
  border-radius: 22px 22px 0 0; padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
}
.sheet-top { position: sticky; top: -12px; display: flex; justify-content: flex-end; background: var(--page); padding: 6px 0; z-index: 2; }
.done { min-height: 40px; padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--evergreen); font-weight: 600; background: #fff; }
.detail-box { padding: 2px 16px; border-radius: 16px; background: var(--grey); margin-bottom: 20px; }
.detail-box > * { display: block; width: 100%; padding: 13px 0; border-bottom: 1px solid var(--line); text-align: left; }
.detail-box > *:last-child { border-bottom: 0; }
.detail-title { color: var(--forest); font-size: 23px; font-weight: 700; line-height: 1.2; }
.detail-heading { font-size: 17px; font-weight: 700; margin: 0 0 8px 16px; }
.action { color: var(--evergreen); text-decoration: none; }
.day-choice { display: block; width: 100%; padding: 13px 16px; margin-bottom: 8px; text-align: left; background: var(--grey); border-radius: 12px; color: var(--ink); }
.sheet-heading { font-size: 20px; font-weight: 700; color: var(--forest); margin-bottom: 14px; }
.small-print { font-size: 13px; color: #5f6b64; line-height: 1.45; margin-top: 20px; }
.toast { position: fixed; z-index: 1100; left: 16px; right: 16px; bottom: calc(var(--tab-height) + 18px + env(safe-area-inset-bottom)); max-width: 608px; margin: 0 auto; padding: 12px 14px; color: #fff; background: var(--forest); border-radius: 12px; }

.tabs {
  position: fixed; z-index: 900; left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-height) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line);
}
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: #4a5650; }
.tabs button span { font-size: 22px; line-height: 1; }
.tabs button[aria-current="page"] { color: var(--evergreen); font-weight: 700; background: var(--card); }

.leaflet-container { font: inherit; }

.status.finished { color: #5f6b64; }
.finished-title { margin-top: 24px; color: #5f6b64; }
.card-wrap:has(.status.finished) .card { opacity: 0.75; }

.signup { margin-bottom: 18px; padding: 12px 14px; border-radius: 16px; background: var(--card); display: block; }
.signup-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.signup-title { font-weight: 700; font-size: 15px; }
.signup-close { width: 36px; height: 36px; font-size: 24px; line-height: 1; color: var(--evergreen); }
.signup-hide { margin-top: 6px; color: var(--evergreen); font-weight: 600; min-height: 36px; }
.signup-row { display: flex; gap: 8px; margin-top: 8px; }
.signup-row input { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 16px; color: var(--ink); background: #fff; }
.signup-button { flex: none; padding: 0 18px; min-height: 44px; border-radius: 999px; background: var(--evergreen); color: #fff; font-weight: 700; }
.signup-button:disabled { opacity: 0.6; }
.signup-consent { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 13px; line-height: 1.4; color: var(--ink); }
.signup-consent input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--evergreen); }
.signup-message { font-size: 13px; color: var(--amber); margin-top: 6px; }
.signup-message:empty { display: none; }
.hidden-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.sheet.centered { align-items: center; padding: 16px; }
.popup-panel {
  position: relative; width: 100%; max-width: 380px; padding: 28px 20px 20px; text-align: center;
  background: var(--card); color: var(--forest); border-radius: 22px; box-shadow: 0 8px 30px rgb(0 0 0 / 0.25);
}
.popup-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; background: #fff; font-size: 24px; line-height: 1; color: var(--evergreen); }
.popup-emoji { font-size: 52px; line-height: 1; }
.popup-title { font-size: 24px; font-weight: 700; line-height: 1.2; margin-top: 10px; }
.popup-text { margin: 10px 0 16px; color: var(--ink); line-height: 1.4; }
.popup-panel .signup-row { flex-direction: column; }
.popup-panel .signup-button { min-height: 48px; }
.popup-panel .signup-consent { text-align: left; }
