/* 養蜂生活: 焼杉の濃い茶色と蜂蜜の黄色。スマホ最優先・押しやすい大きさ。外部フォント・外部画像なし */
:root {
  --brown-900: #2b1a12;
  --brown-800: #3a241a;
  --brown-600: #6b4331;
  --honey: #f2b01e;
  --honey-dark: #b87a00;
  --honey-soft: #fdf0c8;
  --cream: #fbf6ea;
  --paper: #ffffff;
  --ink: #2a1d16;
  --muted: #7a6a60;
  --line: #e4d9c9;
  --ok: #2f7d4a;
  --warn: #b86a00;
  --bad: #b3261e;
  --hdr-h: 58px;
  --tab-h: 62px;
  --maxw: 640px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink); font-size: 17px; line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", "Noto Sans CJK JP", sans-serif;
}
body.modal-open { overflow: hidden; }
.hidden { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.pre { white-space: pre-wrap; word-break: break-word; }
.center { text-align: center; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
p { margin: 0 0 10px; }
a { color: var(--honey-dark); }
button { font-family: inherit; }

/* ---- ヘッダー（上の safe-area に対応） ---- */
.hdr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; background: var(--brown-900); color: #fff;
  padding: constant(safe-area-inset-top) 10px 0 10px; padding: env(safe-area-inset-top, 0px) 10px 0 10px;
  display: flex; align-items: center; gap: 8px; border-bottom: 4px solid var(--honey);
}
.hdr > * { min-height: var(--hdr-h); }
.hdr-back { background: none; border: 0; color: #fff; font-size: 38px; line-height: 1; width: 48px; padding: 0 0 4px; cursor: pointer; }
.hdr-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.hdr-name { font-size: 19px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-sub { font-size: 12px; color: #f1dfb4; margin-top: -2px; }
.hdr-right { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.hdr-reload { background: rgba(255, 255, 255, .14); color: #fff; border: 0; border-radius: 10px; font-size: 14px; font-weight: 700; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.hdr-ver { font-size: 11px; color: #cdb98f; margin-top: 2px; }
.hdr-right { min-height: var(--hdr-h); }

main#main {
  max-width: var(--maxw); margin: 0 auto;
  padding: calc(var(--hdr-h) + 4px + 14px) 16px calc(var(--tab-h) + 28px) 16px;
  padding-top: calc(var(--hdr-h) + 18px + constant(safe-area-inset-top));
  padding-top: calc(var(--hdr-h) + 18px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--tab-h) + 28px + constant(safe-area-inset-bottom));
  padding-bottom: calc(var(--tab-h) + 28px + env(safe-area-inset-bottom, 0px));
}
.page > * + * { margin-top: 14px; }

/* ---- 下部タブ（下の safe-area に対応） ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; background: var(--brown-900);
  padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom, 0px); border-top: 1px solid #000;
}
body.locked .tabbar { display: none; }
.tab { flex: 1; min-height: var(--tab-h); background: none; border: 0; color: #cdb98f; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; cursor: pointer; }
.tab.on { color: var(--honey); box-shadow: inset 0 3px 0 var(--honey); }
.tab-ico { font-size: 24px; line-height: 1.1; }
.tab-lbl { font-size: 13px; font-weight: 700; }

/* ---- カード・お知らせ ---- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card > * + * { margin-top: 12px; }
.card-title { font-size: 18px; color: var(--brown-800); border-left: 6px solid var(--honey); padding-left: 10px; }
.sub-title { font-size: 15px; color: var(--brown-600); margin-top: 14px; }
.notice { background: var(--honey-soft); border: 2px solid var(--honey); border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.notice p { margin: 6px 0 0; }
.notice.code { background: #fff7e0; font-weight: 700; color: var(--brown-800); }
.notice.warn { background: #ffe9e5; border-color: #e0786b; }
.notice.free { background: #f3ece0; border-color: #cdb98f; font-weight: normal; }
.hint { font-size: 14px; color: var(--muted); }
.readonly { padding: 12px; background: #f4eee3; border-radius: 10px; min-height: 48px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-ico { font-size: 56px; color: var(--honey); line-height: 1; }
.form-msg { color: var(--bad); font-weight: 700; min-height: 0; }
.ver { font-size: 13px; color: var(--muted); text-align: center; margin: 8px 0 0; }
.noscript { padding: 20px; }

/* ---- ボタン ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; cursor: pointer;
  min-height: 52px; padding: 8px 18px; border-radius: 14px; border: 2px solid var(--brown-800); background: #fff; color: var(--brown-800);
  font-size: 17px; font-weight: 800; line-height: 1.3;
}
.btn.primary { background: var(--honey); border-color: var(--honey-dark); color: var(--brown-900); }
.btn.ghost { background: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { background: #fff; border-color: #e0a29c; color: var(--bad); }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 58px; font-size: 18px; }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: 15px; }
.btn.mv { min-width: 48px; min-height: 48px; padding: 0; font-size: 18px; }
.btn.mv.bad { color: var(--bad); border-color: #e0a29c; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not([disabled]):not(.disabled) { transform: translateY(1px); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* ---- フォーム ---- */
.field > * + * { margin-top: 6px; }
.lbl { font-weight: 800; font-size: 16px; color: var(--brown-800); display: block; }
.inp {
  width: 100%; min-height: 52px; padding: 10px 12px; font-size: 17px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  font-family: inherit; -webkit-appearance: none; appearance: none;
}
select.inp { background-image: linear-gradient(45deg, transparent 50%, var(--brown-600) 50%), linear-gradient(135deg, var(--brown-600) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
textarea.inp { min-height: 104px; resize: vertical; }
.inp:focus { outline: none; border-color: var(--honey-dark); box-shadow: 0 0 0 3px var(--honey-soft); }
.code-inp { font-size: 20px; letter-spacing: .08em; text-align: center; }
.check { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; margin-top: 8px; font-size: 17px; cursor: pointer; }
.check input { width: 26px; height: 26px; accent-color: var(--brown-800); flex: none; }
.kg-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.kg-name { flex: 0 0 38%; font-weight: 700; font-size: 15px; word-break: break-all; }
.kg-row .inp { flex: 1; min-width: 0; }
.kg-unit { font-weight: 700; }

/* ---- 蜜箱 ---- */
.box-card { display: flex; gap: 8px; align-items: stretch; background: #fff; border: 2px solid var(--line); border-left: 8px solid var(--brown-800); border-radius: 16px; padding: 4px 8px 4px 0; }
.box-main { flex: 1; text-align: left; background: none; border: 0; padding: 12px 8px 12px 14px; cursor: pointer; min-width: 0; color: inherit; }
.box-name { font-size: 24px; font-weight: 800; color: var(--brown-800); }
.box-place { color: var(--muted); font-size: 15px; margin: 2px 0 6px; word-break: break-all; }
.box-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.box-last { font-size: 14px; color: var(--muted); margin-top: 6px; }
.box-move { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.chip { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: 14px; font-weight: 800; background: #eee; color: #444; margin: 2px 4px 2px 0; }
.chip.ok { background: #dff2e5; color: var(--ok); }
.chip.warn { background: #ffecc8; color: var(--warn); }
.chip.bad { background: #fbdcd8; color: var(--bad); }
.chip.info { background: #e1ebf7; color: #2a5a8f; }
.chip.mute { background: #efe7da; color: var(--brown-600); }
.chip.honey { background: var(--honey-soft); color: var(--honey-dark); border: 1px solid var(--honey); }
details.unused { background: #fff; border: 1px dashed var(--line); border-radius: 14px; padding: 4px 12px 12px; }
details.unused summary { min-height: 48px; display: flex; align-items: center; font-weight: 800; cursor: pointer; color: var(--muted); }
details.unused .box-card { margin-top: 10px; }
.info { margin: 0; display: grid; grid-template-columns: 8.5em 1fr; gap: 8px 10px; font-size: 16px; }
.info dt { color: var(--muted); font-weight: 700; font-size: 14px; padding-top: 2px; }
.info dd { margin: 0; word-break: break-word; }
.honey-total { color: var(--brown-800); }
.honey-num { font-size: 40px; font-weight: 800; color: var(--honey-dark); }
.honey-unit { font-size: 16px; font-weight: 700; }
ul.plain { margin: 0; padding-left: 1.2em; }

/* ---- 記録 ---- */
.recs > * + * { margin-top: 12px; }
.rec { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fffdf8; }
.rec > * + * { margin-top: 8px; }
.rec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-date { font-weight: 800; font-size: 16px; }
.rec-honey { font-weight: 800; color: var(--honey-dark); font-size: 18px; }
.rec-box { font-weight: 700; }
.rec-boxes, .rec-note { font-size: 14px; color: var(--muted); }
.rec-memo { font-size: 16px; }
.rec-actions { display: flex; gap: 8px; justify-content: flex-end; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #eee; cursor: pointer; display: block; }
.th-wrap { position: relative; }
.th-x { position: absolute; top: -8px; right: -8px; width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: var(--bad); color: #fff; border: 2px solid #fff; font-size: 15px; }
.photo-full { width: 100%; max-height: 70vh; object-fit: contain; background: #000; border-radius: 10px; display: block; }

/* ---- カレンダー ---- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cal-title { font-size: 22px; font-weight: 800; color: var(--brown-800); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: 13px; font-weight: 800; color: var(--muted); padding: 4px 0; }
.cal-wd.sun, .cal-day.sun .cal-num { color: #c0392b; }
.cal-wd.sat, .cal-day.sat .cal-num { color: #2a5a8f; }
.cal-day { position: relative; min-height: 52px; background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 17px; font-weight: 700; padding: 4px 0 8px; color: var(--ink); }
.cal-day.out { opacity: .4; }
.cal-day.today { border-color: var(--honey-dark); border-width: 2px; }
.cal-day.sel { background: var(--brown-800); border-color: var(--brown-800); }
.cal-day.sel .cal-num { color: #fff !important; }
.cal-dot { position: absolute; left: 50%; bottom: 6px; width: 8px; height: 8px; margin-left: -4px; background: var(--honey); border-radius: 50%; }
.cal-day.sel .cal-dot { background: var(--honey); }

/* ---- 一覧リンク・設定 ---- */
.list-link { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 56px; padding: 8px 4px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 700; cursor: pointer; }
.ll-main { flex: 1; }
.ll-sub { color: var(--muted); font-size: 14px; font-weight: 400; }
.ll-arrow { color: var(--muted); font-size: 24px; }
.dev { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dev-main { flex: 1; min-width: 0; }
.dev-name { font-weight: 800; }
.coron { display: flex; gap: 14px; align-items: center; padding-top: 12px; }
.coron-img { width: 72px; height: auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; flex: none; }
.coron-name { font-weight: 800; }
.mat { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: #fffdf8; }
.mat > * + * { margin-top: 8px; }
.mat-no { font-weight: 800; color: var(--brown-600); }
.mat-nums { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.mat-nums.two { grid-template-columns: 1fr 1fr; }
.mat-nums .lbl { font-size: 13px; }
.work-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.work-row .inp { flex: 1; min-width: 0; }

/* ---- モーダル・トースト ---- */
.overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200; background: rgba(30, 18, 10, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: var(--maxw); max-height: 92%; overflow-y: auto; -webkit-overflow-scrolling: touch; background: #fff; border-radius: 20px 20px 0 0;
  padding: 20px 16px 16px; /* constant() を同じ宣言に混ぜると新しいブラウザで全部無視されるので分ける */
  padding-bottom: calc(16px + constant(safe-area-inset-bottom)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.sheet-title { font-size: 20px; margin-bottom: 12px; color: var(--brown-800); }
.sheet-body > * + * { margin-top: 12px; }
.sheet-actions { display: flex; flex-direction: column-reverse; gap: 10px; margin-top: 16px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom, 0px)); z-index: 400; max-width: 560px; margin: 0 auto; background: var(--brown-900); color: #fff; padding: 14px 16px; border-radius: 14px; font-weight: 700; text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
.toast.ng { background: var(--bad); }

/* ---- 印刷 ---- */
.print-area { display: none; }
.img-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 300; background: rgba(0, 0, 0, .88); overflow: auto; -webkit-overflow-scrolling: touch; padding: 14px; }
.img-help { color: #fff; font-size: 15px; line-height: 1.6; margin-bottom: 10px; }
.img-page { width: 100%; background: #fff; display: block; border-radius: 4px; margin-bottom: 10px; }
@media print {
  /* 印刷するのは画像だけ。画面の要素はすべて隠す */
  body > *:not(#print-area) { display: none !important; }
  body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .print-area { display: block !important; }
  /* iPhoneの共有→プリントと同じ大きさになるよう余白を14.5mmに。画像の高さ約256mmなので上に6mm空けて上下中央に */
  @page { size: A4 portrait; margin: 14.5mm; }
  .print-page { padding-top: 6mm; page-break-after: always; break-after: page; page-break-inside: avoid; break-inside: avoid; }
  .print-page:last-child { page-break-after: auto; break-after: auto; }
  .print-page img { display: block; width: 100%; height: auto; }
}

/* 規約ページ */
.doc-wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.doc-wrap h1 { font-size: 24px; margin: 8px 0 16px; }
.doc-wrap h2 { font-size: 19px; margin: 26px 0 8px; border-left: 6px solid var(--honey); padding-left: 10px; }
.doc-wrap li { margin-bottom: 6px; }
.doc-wrap .back { display: inline-block; margin-bottom: 8px; }
.site-foot { margin-top: 30px; display: flex; gap: 16px; flex-wrap: wrap; }
.line-qr { display: block; margin: 8px auto 0; border-radius: 8px; background: #fff; }
