:root {
  --navy: #062b5c;
  --navy-2: #0b3b76;
  --red: #cf1f2c;
  --yellow: #f6c945;
  --ink: #102a43;
  --muted: #56708a;
  --line: #c9d8e8;
  --pale: #edf4fa;
  --white: #ffffff;
  --green: #178455;
  --shadow: 0 18px 60px rgba(6, 43, 92, 0.18);
  --radius: 18px;
  --base: 16px;
}

* { box-sizing: border-box; }
html { background: #e9f0f7; color: var(--ink); font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 480px) 430px; justify-content: center; align-items: center; gap: 64px; padding: 32px; background: radial-gradient(circle at 20% 20%, #fff 0, #eef4fa 35%, #dfeaf5 100%); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.desktop-note { max-width: 470px; }
.desktop-note__eyebrow { color: var(--red); font-weight: 800; letter-spacing: .04em; }
.desktop-note h1 { margin: 10px 0 22px; color: var(--navy); font-size: clamp(38px, 4vw, 62px); line-height: 1.12; letter-spacing: -.04em; }
.desktop-note p, .desktop-note li { font-size: 18px; line-height: 1.8; }
.desktop-note ul { padding-left: 1.3em; color: var(--muted); }

.app-shell { width: 430px; height: min(880px, calc(100vh - 44px)); min-height: 660px; overflow: hidden; position: relative; display: flex; flex-direction: column; background: #f8fbfe; border: 8px solid #0a1e36; border-radius: 46px; box-shadow: var(--shadow); }
.topbar { flex: 0 0 78px; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; background: var(--white); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; border: 0; background: none; color: var(--navy); padding: 0; text-align: left; }
.brand__mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--navy); color: white; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { color: var(--red); font-weight: 700; margin-top: 2px; font-size: 11px; }
.icon-button { position: relative; width: 48px; height: 48px; border: 0; border-radius: 14px; background: var(--pale); color: var(--red); font-size: 28px; }
.notification-dot { position: absolute; right: 8px; top: 7px; width: 10px; height: 10px; background: var(--red); border: 2px solid white; border-radius: 50%; }
.notification-dot.is-read { display: none; }

.page { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 118px; scroll-behavior: smooth; }
.page::-webkit-scrollbar { width: 0; }
.bottom-nav { position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; height: 82px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(6,43,92,.08); }
.bottom-nav button { border: 0; border-radius: 13px; background: none; color: #698097; display: grid; place-items: center; gap: 1px; padding: 6px 2px; }
.bottom-nav button span { font-size: 25px; line-height: 1; font-weight: 800; }
.bottom-nav button small { font-size: 11px; font-weight: 700; }
.bottom-nav button.is-active { color: var(--navy); background: var(--pale); }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-heading h2 { margin: 0; color: var(--navy); font-size: 25px; letter-spacing: -.03em; }
.page-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.date-chip { flex: none; background: var(--pale); color: var(--navy); border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 800; }

.status-banner { display: flex; gap: 12px; align-items: center; padding: 13px 14px; margin-bottom: 15px; border-radius: var(--radius); color: #fff; background: var(--navy); }
.status-banner__light { flex: none; width: 14px; height: 14px; border-radius: 50%; background: #4ae19b; box-shadow: 0 0 0 6px rgba(74,225,155,.14); }
.status-banner strong, .status-banner small { display: block; }
.status-banner strong { font-size: 15px; }
.status-banner small { opacity: .78; margin-top: 2px; }

.alert-card { overflow: hidden; border: 2px solid var(--red); border-radius: var(--radius); background: #fff; margin-bottom: 16px; }
.alert-card__head { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; background: var(--red); color: white; }
.alert-card__head strong { font-size: 15px; }
.alert-card__body { display: grid; grid-template-columns: 110px 1fr; gap: 13px; padding: 14px; }
.alert-thumb {
  min-height: 105px;
  background: url("assets/wildlife-camera.png") 69% center/cover;
  background-image: image-set(
    url("assets/wildlife-camera.webp") type("image/webp"),
    url("assets/wildlife-camera.png") type("image/png")
  );
  border-radius: 12px;
  position: relative;
}
.alert-thumb::after { content: "イノシシ"; position: absolute; left: 7px; bottom: 7px; padding: 4px 7px; border-radius: 7px; background: var(--red); color: white; font-size: 11px; font-weight: 800; }
.alert-copy strong { display: block; color: var(--navy); font-size: 18px; margin: 4px 0; }
.alert-copy p { margin: 5px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.button-row { display: flex; gap: 8px; }
.btn { min-height: 47px; border: 0; border-radius: 13px; padding: 11px 15px; font-weight: 800; color: white; background: var(--navy); box-shadow: 0 6px 14px rgba(6,43,92,.16); }
.btn:active { transform: translateY(1px); }
.btn--red { background: var(--red); }
.btn--light { background: var(--pale); color: var(--navy); box-shadow: none; border: 1px solid var(--line); }
.btn--wide { width: 100%; }
.btn--huge { width: 100%; min-height: 82px; border-radius: 20px; font-size: 22px; }
.text-button { border: 0; background: none; color: var(--navy-2); font-weight: 800; padding: 5px; }

.section-title { margin: 22px 2px 10px; display: flex; align-items: center; justify-content: space-between; }
.section-title h3 { margin: 0; color: var(--navy); font-size: 18px; }
.section-title button { border: 0; background: none; color: var(--red); font-size: 13px; font-weight: 800; }
.camera-list { display: grid; gap: 10px; }
.camera-card { display: grid; grid-template-columns: 94px 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 10px; background: #fff; text-align: left; color: var(--ink); }
.camera-card__image { width: 94px; height: 74px; border-radius: 11px; background-color: #dbe7f1; background-position: center; background-size: cover; position: relative; overflow: hidden; }
.camera-card__image::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 55%, rgba(3,22,44,.28)); }
.camera-card strong, .camera-card small { display: block; }
.camera-card strong { color: var(--navy); font-size: 16px; }
.camera-card small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.camera-card__arrow { color: var(--navy); font-size: 22px; }
.state { display: inline-flex; gap: 6px; align-items: center; padding: 5px 8px; border-radius: 999px; background: #e6f6ef; color: var(--green); font-size: 11px; font-weight: 800; }
.state--alert { background: #fdecef; color: var(--red); }
.state--check { background: #fff4d8; color: #8b6300; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-card { min-height: 112px; border: 0; border-radius: 17px; padding: 15px; text-align: left; background: var(--pale); color: var(--navy); }
.quick-card span { display: block; font-size: 30px; margin-bottom: 8px; }
.quick-card strong { font-size: 15px; }
.quick-card--red { background: var(--red); color: white; }

.camera-view {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  border-radius: 18px;
  background: url("assets/wildlife-camera.png") 68% center/cover;
  background-image: image-set(
    url("assets/wildlife-camera.webp") type("image/webp"),
    url("assets/wildlife-camera.png") type("image/png")
  );
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.camera-view::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(3,22,44,.3), transparent 35%, rgba(3,22,44,.3)); pointer-events: none; }
.livecam-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #dbe7f1; }
.live-tag, .camera-time, .detection-box { position: absolute; z-index: 2; }
.live-tag { left: 12px; top: 12px; padding: 6px 9px; border-radius: 8px; background: var(--red); color: white; font-size: 11px; font-weight: 900; }
.camera-time { right: 12px; top: 12px; color: white; font-size: 11px; text-shadow: 0 1px 3px #000; }
.detection-box { right: 40px; bottom: 38px; width: 105px; height: 65px; border: 3px solid var(--red); color: white; font-size: 11px; font-weight: 800; padding: 3px; }
.livecam-source { position: absolute; z-index: 3; left: 12px; bottom: 10px; border: 0; border-radius: 8px; padding: 6px 8px; background: rgba(3,22,44,.78); color: white; font-size: 10px; font-weight: 800; }
.livecam-loading { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; color: var(--navy); background: var(--pale); font-size: 13px; font-weight: 800; }
.livecam-loading[hidden] { display: none; }
.livecam-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 9px 2px 2px; color: var(--muted); font-size: 10px; }
.livecam-note button { border: 0; background: none; color: var(--navy); font-size: 11px; font-weight: 800; text-decoration: underline; }
.camera-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 11px 0 16px; }
.metric { border: 1px solid var(--line); border-radius: 13px; padding: 10px 5px; background: white; text-align: center; }
.metric strong, .metric small { display: block; }
.metric strong { color: var(--navy); font-size: 16px; }
.metric small { color: var(--muted); font-size: 10px; margin-top: 3px; }
.action-panel { border-radius: 20px; padding: 16px; background: var(--navy); color: white; }
.action-panel h3 { margin: 0 0 5px; font-size: 19px; }
.action-panel p { margin: 0 0 13px; font-size: 13px; opacity: .78; }
.action-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
.mode-check { position: relative; }
.mode-check input { position: absolute; opacity: 0; }
.mode-check span { display: grid; place-items: center; min-height: 68px; border: 2px solid rgba(255,255,255,.25); border-radius: 15px; font-weight: 800; }
.mode-check input:checked + span { background: white; color: var(--navy); border-color: white; }

.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.filter-chip { white-space: nowrap; border: 1px solid var(--line); background: white; color: var(--navy); border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 800; }
.filter-chip.is-active { color: white; background: var(--navy); border-color: var(--navy); }
.event-list { display: grid; gap: 9px; }
.event { display: grid; grid-template-columns: 58px 1fr auto; gap: 11px; align-items: center; padding: 12px; border-radius: 15px; border: 1px solid var(--line); background: white; }
.event__time { text-align: center; color: var(--navy); font-weight: 900; }
.event__time small { display: block; color: var(--muted); font-size: 10px; font-weight: 500; }
.event strong, .event small { display: block; }
.event small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.event__result { border-radius: 999px; padding: 6px 8px; background: #e6f6ef; color: var(--green); font-size: 10px; font-weight: 800; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.summary-box { padding: 14px 6px; border-radius: 15px; background: white; border: 1px solid var(--line); text-align: center; }
.summary-box strong { display: block; color: var(--navy); font-size: 25px; }
.summary-box small { color: var(--muted); font-size: 10px; }
.chart-card { margin-top: 12px; padding: 15px; border-radius: 17px; background: white; border: 1px solid var(--line); }
.chart-card h3 { margin: 0 0 14px; color: var(--navy); font-size: 16px; }
.bar-chart { display: flex; align-items: end; justify-content: space-between; gap: 8px; height: 155px; padding-top: 10px; border-bottom: 2px solid var(--line); }
.bar { flex: 1; min-width: 18px; position: relative; height: var(--h); border-radius: 8px 8px 0 0; background: var(--navy); }
.bar.is-hot { background: var(--red); }
.bar span { position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 10px; white-space: nowrap; }
.bar em { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); color: var(--navy); font-size: 11px; font-style: normal; font-weight: 800; }
.species-bars { display: grid; gap: 12px; }
.species-row { display: grid; grid-template-columns: 70px 1fr 34px; gap: 9px; align-items: center; font-size: 12px; }
.species-track { height: 13px; background: var(--pale); border-radius: 999px; overflow: hidden; }
.species-track i { display: block; height: 100%; width: var(--w); background: var(--navy); border-radius: inherit; }

.settings-list { display: grid; gap: 10px; }
.setting-group { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: white; }
.setting-row { width: 100%; min-height: 64px; border: 0; border-bottom: 1px solid var(--line); background: white; color: var(--ink); padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong, .setting-row small { display: block; }
.setting-row strong { color: var(--navy); font-size: 15px; }
.setting-row small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.switch { width: 54px; height: 31px; border-radius: 999px; background: #aebdca; padding: 4px; transition: .2s; }
.switch::after { content: ""; display: block; width: 23px; height: 23px; border-radius: 50%; background: white; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: .2s; }
.switch.is-on { background: var(--green); }
.switch.is-on::after { transform: translateX(23px); }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: end center; background: rgba(3,19,36,.55); padding: 18px; }
.modal { width: min(100%, 414px); max-height: 88vh; overflow-y: auto; border-radius: 28px 28px 18px 18px; background: white; box-shadow: var(--shadow); animation: rise .22s ease-out; }
.modal__handle { width: 52px; height: 5px; margin: 9px auto 2px; border-radius: 99px; background: var(--line); }
.modal__body { padding: 16px 18px 22px; }
.modal__icon { display: grid; place-items: center; width: 70px; height: 70px; margin: 0 auto 12px; border-radius: 50%; background: #fdecef; color: var(--red); font-size: 38px; font-weight: 900; }
.modal h2 { color: var(--navy); text-align: center; margin: 5px 0 8px; font-size: 26px; }
.modal p { color: var(--muted); line-height: 1.6; }
.modal-data { border-radius: 15px; padding: 12px 14px; margin: 12px 0; background: var(--pale); }
.modal-data div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; }
.modal-data span { color: var(--muted); }
.modal-data strong { color: var(--navy); }
.progress { height: 14px; border-radius: 999px; background: var(--pale); overflow: hidden; margin: 18px 0; }
.progress i { display: block; width: var(--progress, 0%); height: 100%; background: var(--red); transition: width .35s; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 28px; transform: translate(-50%, 140px); opacity: 0; padding: 13px 18px; border-radius: 13px; color: white; background: #102a43; box-shadow: var(--shadow); font-weight: 800; transition: .25s; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.empty { padding: 30px 20px; text-align: center; color: var(--muted); }
.eyebrow { color: var(--red); font-size: 12px; font-weight: 900; letter-spacing: .04em; }

body.senior { --base: 19px; }
body.senior .page { font-size: 18px; }
body.senior .page-heading h2 { font-size: 29px; }
body.senior .camera-card strong, body.senior .setting-row strong { font-size: 18px; }
body.senior .camera-card small, body.senior .setting-row small, body.senior .event small { font-size: 13px; }
body.senior .bottom-nav small { font-size: 13px; }
body.senior .bottom-nav { height: 92px; }

@keyframes rise { from { transform: translateY(35px); opacity: .4; } }

@media (max-width: 900px) {
  body { display: block; min-height: 100dvh; padding: 0; background: #f8fbfe; }
  .desktop-note { display: none; }
  .app-shell { width: 100%; height: 100dvh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); flex-basis: calc(74px + env(safe-area-inset-top)); }
  .modal-backdrop { padding: 0; }
  .modal { width: 100%; border-radius: 28px 28px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
