:root{
  --bg:#f7f9fc;
  --panel:#ffffff;
  --panel2:#f1f5f9;
  --text:#1f2937;
  --muted:#6b7280;
  --border:rgba(0,0,0,.08);

  --primary:#3b82f6;
  --primary2:#60a5fa;
  --green:#10b981;

  --sheet-left-w: 84px;
  --sheet-col-w: 28px;
  --sheet-gap: 6px;
  --sheet-row-h: 56px;
  --sheet-row-border: rgba(0,0,0,.06);
}

*{box-sizing:border-box}

html, body{ height:100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background:var(--bg);
  color:var(--text);
  padding-bottom: 96px;
}

/* ✅ 端末のタップ時ハイライトを抑止（広域） */
a, button, [role="button"], input, select{
  -webkit-tap-highlight-color: transparent;
}

/* ✅ フォーカスリング（広域） */
button:focus,
button:focus-visible,
a:focus,
a:focus-visible{
  outline: none !important;
  box-shadow: none !important;
}

/* =========================
   Header / Topbar（ライト）
   ========================= */
.topbar{
  position:sticky; top:0;
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 14px;
  background:rgba(255,255,255,.92);
  border-bottom:1px solid var(--border);
  backdrop-filter: blur(8px);
  z-index:10;
}

.brand{font-weight:800; letter-spacing:.02em; color: var(--text);}
.sub{font-size:12px; color:var(--muted); margin-top:2px}
.topbar-left{display:flex; flex-direction:column; gap:2px}

.topbar-right{
  display:flex;
  gap:10px;
  align-items:center;
}

.linkbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  color:var(--text);
  text-decoration:none;
  background:rgba(255,255,255,.9);
  font-weight:800;
}
.linkbtn:active{transform: translateY(1px)}

.ghost{
  background:rgba(255,255,255,.9);
  border:1px solid var(--border);
  padding:10px 12px;
  color:var(--text);
}

.wrap{
  max-width:520px;
  margin:0 auto;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.panel{
  background:linear-gradient(180deg, var(--panel), var(--panel2));
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
}
.panel-title{
  font-weight:800;
  margin-bottom:10px;
}

/* =========================
   TOP: ticket layout
   ========================= */
.ticket-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
}
.ticket-card{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px;
  background:rgba(255,255,255,.85);
}
.ticket-name{font-size:12px; color:var(--muted)}
.ticket-count{
  font-size:28px;
  font-weight:900;
  margin-top:6px;
}

.ticket-row{
  display:flex;
  align-items:stretch;
  gap:12px;
}

.ticket-card-compact{
  flex: 1;
  min-height:110px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:14px;
}

.use-ticket-big{
  flex: 1.5;
  min-height:110px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
  border-radius:18px;
  white-space: normal;
  line-height: 1.2;
}

.panel-actions{
  display:flex;
  gap:10px;
  margin-top:12px;
}

/* =========================
   Buttons / UI parts
   ========================= */
button{
  border:none;
  border-radius:14px;
  padding:12px 14px;
  font-weight:800;
  color:var(--text);
  background:rgba(255,255,255,.9);
  border:1px solid var(--border);
  appearance:none;
  -webkit-appearance:none;
  background-clip: padding-box;
}
button:active{transform: translateY(1px)}
button.full{width:100%}

.primary{
  background:var(--primary);
  border:1px solid rgba(59,130,246,.35);
  color:#ffffff;
}
.secondary{
  background:rgba(96,165,250,.18);
  border:1px solid rgba(96,165,250,.35);
}

.fullbtn{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
}

.divider{
  height:1px;
  background: rgba(0,0,0,.08);
  margin:14px 0;
  border-radius:999px;
}

.btn-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:12px;
}
.bigbtn{
  padding: 26px 14px;
  min-height: 92px;
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(59,130,246,.16);
  border:1px solid rgba(59,130,246,.28);
  color:var(--text);
}
.bigbtn:nth-child(2){background:rgba(16,185,129,.14); border-color:rgba(16,185,129,.28)}
.bigbtn:nth-child(3){background:rgba(236,72,153,.12); border-color:rgba(236,72,153,.22)}
.bigbtn:nth-child(4){background:rgba(253,186,116,.14); border-color:rgba(253,186,116,.22)}

.hint{margin-top:10px; font-size:12px; color:var(--muted)}

.stats-row{
  display:grid;
  grid-template-columns: repeat(3,1fr);
  gap:10px;
}
.stat{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px;
  background:rgba(255,255,255,.85);
}
.stat-label{font-size:12px; color:var(--muted)}
.stat-value{font-size:20px; font-weight:900; margin-top:6px}

.hidden{display:none !important}

/* =========================
   Modal
   ========================= */
.backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  z-index:50;
}

/* ✅ 通常モーダルは中央表示 */
.modal{
  position:fixed;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(520px, calc(100vw - 24px));
  max-height:calc(100dvh - 24px);
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  background:linear-gradient(180deg, #ffffff, #f3f6fb);
  border:1px solid var(--border);
  border-radius:18px;
  z-index:60;
  color:var(--text);
  box-shadow: 0 18px 46px rgba(0,0,0,.18);
}

.modal.hidden{
  display:none !important;
}

/* ✅ 設定系モーダルの中身 */
.family-modal{
  width:100%;
  max-height:none;
  overflow:visible;
  background:transparent;
  border:none;
  box-shadow:none;
  border-radius:0;
  padding:14px 14px 12px;
}

.modal-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,.75);
}

.modal-title{font-weight:900}

.modal-body{padding:14px}

.modal-foot{
  display:flex;
  gap:10px;
  padding:12px 14px;
  border-top:1px solid var(--border);
  justify-content:flex-end;
  background:rgba(255,255,255,.65);
}

.label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:8px;
}

.stepper{
  display:grid;
  grid-template-columns: 52px 1fr 52px;
  gap:10px;
  align-items:center;
}

.stepbtn{
  padding:14px 0;
  font-size:20px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.9);
  color:var(--text);
}

.count{
  width:100%;
  padding:14px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.95);
  color:var(--text);
  font-size:20px;
  font-weight:900;
  text-align:center;
}

.quick{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}
.chip{
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.9);
  font-weight:900;
  color:var(--text);
}
.modal .quick{ display:none !important; }

.field-row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top:12px;
}

select{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.95);
  color:var(--text);
  font-weight:800;
}

.result{
  margin-top:14px;
  border:1px dashed rgba(0,0,0,.22);
  border-radius:14px;
  padding:12px;
  display:flex;
  align-items:center;
  gap:10px;
  background:rgba(59,130,246,.10);
}
.sparkle{font-size:20px}
.result-text{font-weight:900; font-size:18px}
.smallnote{margin-top:10px; font-size:12px; color:var(--muted)}

#familyCodeBox{
  background: rgba(59,130,246,.08);
}
#generatedFamilyCode{
  font-weight: 1000;
  letter-spacing: .08em;
}

/* =========================
   history list（ライト）
   ========================= */
.history-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin:10px 0 12px;
}
.history-item{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px;
  background:rgba(255,255,255,.85);
}
.history-top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
}
.badge{
  font-size:12px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.9);
}
.meta{font-size:12px; color:var(--muted); margin-top:6px}
.history-meta{font-size:12px; color:var(--muted)}

/* =========================================================
   Daily sheet (date x count)
   ========================================================= */
.daily-sheet{
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  background:rgba(255,255,255,.85);
}
.sheet-table{
  display:grid;
  grid-template-columns: var(--sheet-left-w) 1fr;
  border-radius:14px;
  overflow:hidden;
  background:rgba(255,255,255,.85);
}
.sheet-left{
  border-right:1px solid var(--border);
  background:rgba(255,255,255,.85);
}
.left-head{
  height:44px;
  display:flex;
  align-items:center;
  padding:0 10px;
  font-weight:900;
  color:var(--muted);
  border-bottom:1px solid var(--border);
  background:rgba(0,0,0,.02);
  font-size:12px;
}
.left-body{
  display:flex;
  flex-direction:column;
}
.date-row{
  height: var(--sheet-row-h);
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:2px;
  padding:0 10px;
  border-bottom:1px solid var(--sheet-row-border);
}
.left-body .date-row:last-child{border-bottom:none}

.sheet-right{
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
}
.right-head{
  height:44px;
  display:grid;
  grid-template-columns: repeat(var(--cols), var(--sheet-col-w));
  gap: var(--sheet-gap);
  padding: 0 10px;
  box-sizing: border-box;
  align-items:center;
  border-bottom:1px solid var(--border);
  background:rgba(0,0,0,.02);
}
.right-head .scale-cell{
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  text-align:center;
  font-size:11px;
  color:rgba(0,0,0,.35);
  font-weight:900;
  border-left:none;
}

.right-body{
  display:flex;
  flex-direction:column;
}
.grid-row{
  height: var(--sheet-row-h);
  display:grid;
  grid-template-columns: repeat(var(--cols), var(--sheet-col-w));
  gap: var(--sheet-gap);
  padding:0 10px;
  align-content:center;
  align-items:center;
  border-bottom:1px solid var(--sheet-row-border);
}
.right-body .grid-row:last-child{border-bottom:none}

.day-cell{
  width: var(--sheet-col-w);
  height: var(--sheet-col-w);
  border-radius:10px;
  border:1px solid rgba(0,0,0,.08);
  background:rgba(0,0,0,.02);
  display:flex;
  align-items:center;
  justify-content:center;
}
.day-cell.empty{
  background:rgba(0,0,0,.01);
  border-color:rgba(0,0,0,.06);
}
.day-cell.filled{
  border-color:rgba(0,0,0,.12);
}
.day-cell .seal{
  font-size:16px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.18));
}

.day-date{font-weight:900; font-size:12px}
.day-week{font-size:11px; color:var(--muted); font-weight:900}
.day-date.sun, .day-week.sun{color: rgba(248,113,113,.95)}
.day-date.sat, .day-week.sat{color: rgba(59,130,246,.95)}

.day-cell.seal-work{  background: rgba(59,130,246,.14); border-color: rgba(59,130,246,.22); }
.day-cell.seal-lesson{background: rgba(16,185,129,.14); border-color: rgba(16,185,129,.22); }
.day-cell.seal-help{  background: rgba(249,115,22,.14); border-color: rgba(249,115,22,.22); }
.day-cell.seal-other{ background: rgba(168,85,247,.14); border-color: rgba(168,85,247,.22); }

/* =========================
   Toast (top)
   ========================= */
.toast{
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 24px));
  z-index: 100;
  pointer-events: none;
}

.toast-inner{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  border-radius:18px;
  border:1px solid rgba(0,0,0,.10);
  background:rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0,0,0,.14);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 240ms ease, transform 240ms ease;
  pointer-events: none;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  outline: none;
}

.toast.show .toast-inner{
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-earn .toast-inner{
  border-color: rgba(59,130,246,.35);
  box-shadow: 0 10px 28px rgba(59,130,246,.12), 0 10px 28px rgba(0,0,0,.12);
}
.toast.toast-use .toast-inner{
  border-color: rgba(248,113,113,.35);
  box-shadow: 0 10px 28px rgba(248,113,113,.10), 0 10px 28px rgba(0,0,0,.12);
}

.toast-emoji{
  font-size:24px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.12));
}
.toast-text{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.toast-title{
  font-weight:900;
  font-size:15px;
  letter-spacing:.02em;
}
.toast-sub{
  font-weight:1000;
  font-size:20px;
  letter-spacing:.02em;
}

.toast-undo-btn{
  margin-left:auto;
  border:1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.92);
  color: var(--text);
  padding:10px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  outline: none !important;
  box-shadow: none !important;
}

.toast-undo:active{ transform: translateY(1px); }
.toast-undo:disabled{
  opacity:.45;
  cursor:not-allowed;
  transform:none !important;
}

.toast.toast-use .toast-undo-btn{ border-color: rgba(248,113,113,.35); }
.toast.toast-earn .toast-undo-btn{ border-color: rgba(59,130,246,.35); }

.toast-undo-btn:focus,
.toast-undo-btn:focus-visible{
  outline: none !important;
  box-shadow: none !important;
}

button:disabled,
.linkbtn[aria-disabled="true"]{
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
}

.toast { pointer-events: none; }

/* =========================
   Weekly breakdown
   ========================= */
.week-breakdown{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:10px;
}

.week-row{
  display:grid;
  grid-template-columns: 84px 1fr 56px;
  gap:10px;
  align-items:center;
}

.week-label{
  font-weight:900;
  color: var(--text);
  font-size: 13px;
}

.week-bar{
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.03);
  overflow:hidden;
}

.week-bar > div{
  height:100%;
  width:0%;
  border-radius: 999px;
}

.week-pct{
  text-align:right;
  font-weight:900;
  color: var(--muted);
  font-size: 13px;
}

.week-fill-work{   background: rgba(59,130,246,.45); }
.week-fill-lesson{ background: rgba(16,185,129,.45); }
.week-fill-help{   background: rgba(236,72,153,.38); }
.week-fill-other{  background: rgba(253,186,116,.55); }

/* ===== Legal pages (privacy / terms) ===== */
.legal-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

.legal-card {
  background: #fff;
  border: 1px solid #e9e9ee;
  border-radius: 16px;
  padding: 18px 18px;
  box-shadow: 0 6px 18px rgba(20, 20, 30, 0.06);
}

.legal-title {
  font-size: 22px;
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}

.legal-updated {
  margin: 0 0 18px;
  color: #666;
  font-size: 12px;
}

.legal-card h2 {
  font-size: 16px;
  margin: 18px 0 8px;
  padding-top: 10px;
  border-top: 1px solid #efeff4;
}

.legal-card p {
  margin: 10px 0;
  line-height: 1.75;
  color: #222;
}

.legal-card ul {
  margin: 10px 0 14px 1.25em;
  line-height: 1.75;
}

.legal-card li {
  margin: 6px 0;
}

.legal-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f6f7fb;
  color: #333;
  font-size: 13px;
}

.legal-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.legal-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e9e9ee;
  color: #222;
  background: #fff;
}

.legal-actions a:hover {
  background: #f6f7fb;
}

/* ===== Footer ===== */
.site-footer {
  max-width: 980px;
  margin: 14px auto 24px;
  padding: 0 16px;
}

.footer-inner {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid #e9e9ee;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(20, 20, 30, 0.05);
}

.footer-link {
  text-decoration: none;
  color: #445;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.footer-link:hover {
  background: #f6f7fb;
  border-color: #e9e9ee;
}

.footer-sep {
  color: #bbb;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}

/* ===== 家族モード（タブUI） ===== */
.family-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 10px;
}
.family-modal-title{ font-weight:900; font-size:16px; }
.family-close{
  border:none;
  background:#f3f4f6;
  border-radius:12px;
  width:36px;
  height:36px;
  font-size:18px;
  cursor:pointer;
}

.family-tabs{
  display:flex;
  gap:6px;
  background:rgba(0,0,0,.04);
  padding:6px;
  border-radius:14px;
  margin: 10px 0 12px;
}
.family-tab{
  flex:1;
  border:none;
  cursor:pointer;
  padding:10px 10px;
  border-radius:12px;
  background:transparent;
  font-weight:800;
  color:#111827;
  font-size:14px;
  line-height:1.1;
  min-height:40px;
}
.family-tab.is-active{
  background:#fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}

.family-tabpanel{ display:none; }
.family-tabpanel.is-active{ display:block; }

.family-desc{
  margin: 10px 0 10px;
  color:rgba(0,0,0,.72);
  line-height:1.55;
  font-size: 13px;
}

.family-label{
  display:block;
  font-size: 12px;
  color:rgba(0,0,0,.72);
  font-weight: 800;
  margin: 10px 0 6px;
}

.family-input{
  width:100%;
  height:44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.family-primary{
  width:100%;
  border:none;
  border-radius: 12px;
  padding: 10px 12px;
  min-height:44px;
  font-weight: 900;
  cursor:pointer;
  background:#2563eb;
  color:#fff;
  font-size:14px;
  letter-spacing:.02em;
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
}
.family-secondary{
  border: 1px solid #e5e7eb;
  background:#fff;
  border-radius: 12px;
  padding: 8px 12px;
  min-height:40px;
  font-size:13px;
  font-weight: 800;
  cursor:pointer;
}
.family-danger{
  width:100%;
  border: 1px solid #fecaca;
  background:#fff;
  color:#b91c1c;
  border-radius: 12px;
  padding: 10px 12px;
  min-height:44px;
  font-size:14px;
  font-weight: 900;
  cursor:pointer;
  margin-top:12px;
  border-width:1px;
}

.family-help{
  margin-top: 10px;
  font-size: 12px;
  color:rgba(0,0,0,.60);
}

.family-sep{
  border:none;
  border-top:1px solid #e5e7eb;
  margin: 12px 0;
  opacity:.25;
}

.family-status{
  margin-top:4px;
}

.family-status-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom: 10px;
}
.family-status-label{
  font-size:12px;
  color:rgba(0,0,0,.62);
  font-weight:800;
}
.family-status-value{
  font-size:13px;
  font-weight: 900;
  color:#111827;
}

.family-codebox{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  border: 1px dashed rgba(0,0,0,.18);
  background: rgba(255,255,255,.75);
  border-radius: 14px;
  padding: 10px 12px;
  margin: 10px 0;
}
.family-codebox-label{
  font-size: 12px;
  color:rgba(0,0,0,.60);
  font-weight: 800;
}
.family-codebox-code{
  margin-top: 2px;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: .06em;
}

/* 履歴ボタンを設定ボタンと同じサイズに */
.topbar-right .linkbtn {
  font-size: 14px;
  font-weight: 800;
  padding: 8px 14px;
}

/* ===== Stopwatch ===== */
.sw-row { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-top:10px; }
.sw-label { font-weight:800; min-width:72px; }
.sw-controls { display:flex; gap:10px; flex:1; flex-wrap:wrap; }
.sw-select, .sw-note {
  border:1px solid #e6e8ef; border-radius:12px; padding:10px 12px;
  font-size:14px; background:#fff;
}
.sw-note { flex:1; min-width:220px; }
.sw-timer {
  margin:14px 0 12px;
  font-size:44px; font-weight:900; letter-spacing:1px;
  text-align:center;
}
.sw-btns { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
.sw-btns .ghost { grid-column: 1 / -1; }
.sw-status { display:flex; flex-direction:column; gap:8px; }
.sw-status-row { display:flex; justify-content:space-between; gap:12px; }
.sw-status-label { color:#667085; font-weight:700; }
.sw-status-value { font-weight:900; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

body.timer-flash {
  animation: timerFlash 0.25s ease-in-out 0s 6 alternate;
}
@keyframes timerFlash {
  from { filter: brightness(1); }
  to   { filter: brightness(1.35); }
}

/* calendar */
#calendarGrid .cal-cell {
  transition: transform .06s ease, box-shadow .06s ease;
}
#calendarGrid .cal-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

/* =========================
   Stamp book (Achievements)
   ========================= */
.stamp-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:12px;
}

@media (min-width: 720px){
  .stamp-grid{ grid-template-columns: repeat(3, 1fr); }
}

.stamp-card{
  width:100%;
  text-align:left;
  border:1px solid rgba(0,0,0,.10);
  border-radius:16px;
  padding:12px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.90));
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  position:relative;
  overflow:hidden;
}

.stamp-card .stamp-top{
  display:flex;
  align-items:center;
  gap:10px;
}

.stamp-card .stamp-emoji{
  width:40px;
  height:40px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  border-radius:14px;
  background: rgba(0,0,0,.04);
}

.stamp-card .stamp-title{
  font-weight:900;
  font-size:14px;
  line-height:1.2;
}

.stamp-card .stamp-desc{
  margin-top:8px;
  font-size:12px;
  opacity:.8;
  line-height:1.4;
}

.stamp-card .stamp-foot{
  margin-top:10px;
  font-size:11px;
  opacity:.7;
}

.stamp-card.is-earned{
  cursor:pointer;
}

.stamp-card.is-earned::after{
  content:"";
  position:absolute;
  right:-18px;
  top:-18px;
  width:90px;
  height:90px;
  border-radius:24px;
  background: radial-gradient(circle at 30% 30%, rgba(0,0,0,.12), rgba(0,0,0,0) 60%);
  transform: rotate(-8deg);
  pointer-events:none;
}

.stamp-card.is-earned{
  transform: rotate(-0.6deg);
}

.stamp-card.is-earned:hover{
  transform: translateY(-1px) rotate(-0.6deg);
}

.stamp-card.is-locked{
  opacity:.78;
  background: linear-gradient(180deg, rgba(255,255,255,.90), rgba(245,245,245,.90));
}

.stamp-progress{
  margin-top:10px;
  display:flex;
  align-items:center;
  gap:10px;
}

.stamp-bar{
  flex:1;
  height:10px;
  background: rgba(0,0,0,.08);
  border-radius:999px;
  overflow:hidden;
}

.stamp-bar-fill{
  height:10px;
  background: rgba(0,0,0,.25);
}

.stamp-pct{
  font-size:11px;
  font-weight:800;
  opacity:.8;
  min-width:36px;
  text-align:right;
}

/* 固定フッターナビ */
.bottom-nav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96);
  border-top: 1px solid rgba(0,0,0,.08);
  backdrop-filter: blur(10px);
}

.bottom-nav-item{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 4px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  color: inherit;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
}

.bottom-nav-item.is-active{
  background: rgba(0,0,0,.06);
}

.with-bottom-nav-space{
  padding-bottom: 76px;
}

.ad-box-320x100 {
  width: 320px;
  height: 100px;
  max-width: 100%;
  border: 1px dashed rgba(0,0,0,.18);
  border-radius: 14px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #666;
  margin: 0 auto;
}

.sheet-head {
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  align-items: center;
  gap: 10px;
}

.sheet-head .sheet-meta {
  text-align: center;
}

.sheet-head .sheet-controls:first-child {
  justify-self: start;
}

.sheet-head .sheet-controls:last-child {
  justify-self: end;
}

@media (max-width: 420px){
  .family-modal{
    padding: 12px;
  }
  .family-codebox-code{
    font-size: 17px;
  }
}