/* 農地マップ（携帯向け）。屋外でも読めるよう文字は大きめ・コントラスト高め */
:root {
  --dark: #26392b; --primary: #3d6b43; --gold: #c9a646; --ink: #2b2a22; --text2: #4a4a3e; --sub: #6d6b5c;
  --line: #e3ded0; --surface: #fffdf7; --soft: #f4f1e6; --here: #2563eb; --hot: #d62828;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--ink); background: var(--soft); font-size: 16px; line-height: 1.55;
  display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; cursor: pointer; }

/* ---- 上の帯 ---- */
.bar {
  flex: none; display: flex; align-items: center; gap: 8px; background: var(--dark); color: #fff;
  padding: calc(env(safe-area-inset-top) + 8px) 10px 8px;
}
.bar .logo { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.bar .ttl { flex: 1; min-width: 0; line-height: 1.25; }
.bar .ttl b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .ttl small { display: block; font-size: 11px; color: #a9b7a3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbtn {
  position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 54px; padding: 5px 8px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 11px; font-weight: 700;
}
.hbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hbtn i {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--gold); color: var(--dark); font: 700 12px/20px sans-serif; font-style: normal; text-align: center;
}

/* ---- 番号で探す ---- */
.search { flex: none; display: flex; gap: 8px; padding: 8px 10px; background: var(--soft); border-bottom: 1px solid var(--line); }
.search[hidden] { display: none; }
.search input { flex: 1; min-width: 0; font-size: 18px; padding: 9px 12px; border: 1px solid #cfc9b6; border-radius: 10px; background: #fff; color: var(--ink); }
.search button { border: 0; border-radius: 10px; padding: 0 16px; font-size: 16px; font-weight: 700; background: var(--primary); color: #fff; }
.search button.ghost, .ghost { background: transparent; color: var(--text2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; font-size: 14px; font-weight: 700; }

/* ---- 地図 ---- */
.mapwrap { flex: 1; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #dfe6d8; }
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 253, 247, .85) !important; }
.leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; font-size: 22px; }
.lbl {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  background: rgba(255, 255, 255, .92); border: 1px solid #333; border-radius: 3px; padding: 0 4px;
  font: 700 12px/1.35 sans-serif; color: #000;
}
.lbl.hot { background: #fff1f1; border-color: var(--hot); color: #a00; font-size: 14px; }
.zoom-low .lbl:not(.hot) { display: none; }
.basebox { display: flex; background: #fff; border-radius: 10px; padding: 3px; box-shadow: 0 1px 6px rgba(0, 0, 0, .3); }
.basebox button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--text2); }
.basebox button.on { background: var(--dark); color: #fff; }
.locate {
  position: absolute; right: 12px; bottom: 30px; z-index: 800; width: 70px; height: 70px; border-radius: 50%; border: 0;
  background: #fff; color: var(--dark); box-shadow: 0 3px 12px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12px; font-weight: 700;
}
.locate svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.locate.on { background: var(--here); color: #fff; }

/* ---- 下の情報 ---- */
.sheet {
  flex: none; max-height: 48vh; max-height: 48dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0, 0, 0, .12);
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 14px);
}
.gps { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--sub); line-height: 1.5; }
.gps i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #c9c4b4; margin-top: 5px; }
.gps.ok i { background: #16a34a; }
.gps.wait i { background: var(--gold); animation: blink 1s infinite; }
.gps.warn i { background: #ea8a0c; }
.gps.err { color: #9b1c1c; }
.gps.err i { background: var(--hot); }
@keyframes blink { 50% { opacity: .3; } }

.card { margin-top: 8px; position: relative; }
.card:empty { display: none; }
.kicker { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--text2); }
.kicker.here { background: #dbeafe; color: #1e40af; }
.kicker.pick { background: #fff4dc; color: #8a5a00; }
.close { position: absolute; top: -4px; right: -6px; border: 0; background: transparent; color: var(--sub); font-size: 22px; line-height: 1; padding: 6px 10px; }
.head { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.head .no { font-size: 32px; font-weight: 800; color: var(--dark); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.head .no small { font-size: 16px; font-weight: 700; margin-right: 2px; }
.head .place { font-size: 20px; font-weight: 700; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 2px; font-size: 14px; color: var(--text2); }
.facts b { color: var(--ink); font-size: 16px; }
.crops { margin-top: 10px; display: grid; gap: 6px; }
.crop { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 17px; font-weight: 700; }
.crop i { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.crop b { margin-left: auto; font-size: 17px; font-variant-numeric: tabular-nums; }
.crop small { font-size: 12px; color: var(--sub); font-weight: 700; }
.none { color: var(--sub); font-size: 14px; }
.tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 6px; background: #fff4dc; color: #8a5a00; border: 1px solid #ecd9a6; }
.remarks { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--gold); background: var(--soft); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.actions a, .actions button {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 10px; font-size: 14px; font-weight: 700; text-decoration: none;
  border: 1px solid var(--line); background: #fff; color: var(--dark);
}
.actions .primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.legend { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 3px; }
.hint { margin: 6px 0 0; font-size: 14px; color: var(--text2); }

/* ---- お知らせ ---- */
.panel {
  position: fixed; inset: 0; z-index: 2000; background: var(--surface); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.panel[hidden] { display: none; }
.panel-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--dark); color: #fff; font-size: 18px; }
.panel-head .ghost { color: #fff; border-color: rgba(255, 255, 255, .4); }
.panel-body { flex: 1; overflow-y: auto; padding: 8px 16px 16px; }
.panel-foot { flex: none; padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px); font-size: 12px; color: var(--sub); border-top: 1px solid var(--line); background: var(--soft); line-height: 1.6; }
.nt { padding: 14px 0; border-bottom: 1px solid var(--line); }
.nt time { font-size: 13px; color: var(--sub); font-weight: 700; }
.nt h3 { margin: 2px 0 6px; font-size: 18px; color: var(--dark); }
.nt p { margin: 0; font-size: 16px; white-space: pre-wrap; word-break: break-word; }

/* ---- 読み込み中・エラー ---- */
.message {
  position: fixed; inset: 0; z-index: 3000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; background: rgba(255, 253, 247, .97); text-align: center; font-size: 17px; color: var(--ink);
}
.message[hidden] { display: none; }
.message button { border: 0; border-radius: 10px; padding: 10px 22px; font-size: 16px; font-weight: 700; background: var(--primary); color: #fff; }
.toast {
  position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 2500; max-width: 90vw;
  background: rgba(38, 57, 43, .95); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 15px; box-shadow: 0 3px 12px rgba(0, 0, 0, .3);
}

/* ---- リンクが使えないとき・トップページ ---- */
body.plain { display: block; height: auto; overflow: auto; background: var(--soft); }
.notice-page { max-width: 520px; margin: 18vh auto 0; padding: 0 24px; text-align: center; }
.notice-page img { border-radius: 16px; }
.notice-page h1 { font-size: 22px; color: var(--dark); margin: 16px 0 8px; }
.notice-page p { font-size: 16px; color: var(--text2); }
