/* ============================================================
   夏休み一行日記（全国共通版） - スタイルシート
   配色：ネイビー #1e3a5f / ホワイト / ゴールド #d4af37
   プレフィックス: .onld- / #cal-
   ============================================================ */

.onld-root{
  width:94%;
  max-width:1100px;
  margin:0 auto;
  padding:20px 0 40px;
  font-family:"BIZ UDGothic","M PLUS Rounded 1c",sans-serif;
  color:#222;
  position:relative;
}
.onld-root *{box-sizing:border-box;}

/* 背景画像はbodyに敷く。カード類は不透明な白なので、
   背景が見えるのはカードの隙間・余白部分のみ。 */
body.onld-bg-applied{
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
  background-repeat:no-repeat;
  transition:background-image .6s ease-in-out;
}

.hidden{ display:none !important; }

/* ===== ヘッダー ===== */
.onld-header{
  text-align:center;
  margin-bottom:16px;
  background:#fff;
  border-radius:16px;
  padding:14px 20px;
  box-shadow:0 2px 10px rgba(0,0,0,.08);
  position:relative;
}
.onld-header h1{
  color:#1e3a5f;
  font-size:22px;
  margin:0;
}
#onld-countdown{
  margin-top:4px;
  font-size:13px;
  color:#946c00;
  font-weight:bold;
}
.onld-menu-btn{
  position:absolute;
  top:10px;
  right:10px;
  width:36px;
  height:36px;
  border:none;
  border-radius:8px;
  background:#f0f3f6;
  color:#1e3a5f;
  font-size:1.2rem;
  cursor:pointer;
}

/* ===== ハンバーガーメニュー ===== */
.onld-menu-panel{
  display:none;
  background:#fff;
  border-radius:16px;
  box-shadow:0 2px 10px rgba(0,0,0,.08);
  padding:8px;
  margin-bottom:16px;
}
.onld-menu-panel.open{ display:block; }
.onld-menu-panel button{
  display:block;
  width:100%;
  text-align:left;
  background:none;
  border:none;
  border-radius:10px;
  padding:12px 14px;
  font-size:14px;
  color:#1e3a5f;
  cursor:pointer;
}
.onld-menu-panel button:active{ background:#f4f4f4; }

.onld-howto-panel{
  display:none;
  background:#f7f5ee;
  border:1px solid #d4af37;
  border-radius:14px;
  box-shadow:0 2px 10px rgba(0,0,0,.05);
  padding:14px 16px;
  margin-bottom:16px;
  font-size:13px;
  line-height:1.8;
  color:#555;
}
.onld-howto-panel.open{ display:block; }
.onld-howto-panel ul{ margin:0; padding-left:1.2em; }

/* ===== オフラインバナー ===== */
.onld-offline-banner{
  background:#fde8e8;
  color:#b3261e;
  border-radius:10px;
  padding:10px 14px;
  font-size:13px;
  text-align:center;
  margin-bottom:14px;
}

/* ===== レイアウト：左=過去の記録／中央=入力・案内／右=カレンダー ===== */
.onld-layout{
  display:flex;
  gap:20px;
  align-items:flex-start;
}
.onld-main{ flex:1; min-width:0; order:2; }
.onld-sidebar{ width:260px; flex-shrink:0; }
.onld-sidebar-left{ order:1; }
.onld-sidebar-right{ order:3; }

@media (max-width:980px){
  .onld-layout{ flex-direction:column; }
  .onld-sidebar{ width:100%; }
  .onld-main{ order:1; }
  .onld-sidebar-left{ order:2; }
  .onld-sidebar-right{ order:3; }
}

/* ===== 未認証時の案内 ===== */
#onld-gate{
  background:#fff;
  border:1px solid #e0e0e0;
  border-radius:16px;
  padding:24px;
  text-align:center;
}
#onld-gate p{
  margin:0 0 12px;
  font-size:15px;
  line-height:1.7;
}
.onld-gate-sub{ color:#777; font-size:13px; }
.onld-gate-message{ color:#b3261e; font-weight:bold; }

/* ===== 入力カード ===== */
.onld-card{
  background:#fff;
  border-radius:16px;
  padding:20px;
  box-shadow:0 2px 10px rgba(0,0,0,.08);
  margin-bottom:16px;
}
.onld-card-title{
  display:flex;
  align-items:baseline;
  gap:8px;
  margin-bottom:10px;
}
.onld-card-title h2{
  color:#1e3a5f;
  font-size:18px;
  margin:0;
}
.onld-today-badge{
  background:#1e3a5f;
  color:#fff;
  font-size:11px;
  font-weight:bold;
  border-radius:999px;
  padding:2px 10px;
}

.onld-theme-hint{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  background:#f7f5ee;
  border-radius:10px;
  padding:8px 12px;
  margin-bottom:12px;
  font-size:13px;
}
.onld-theme-hint .theme-label{ color:#999; }
.onld-theme-hint .theme-text{ color:#1e3a5f; font-weight:bold; flex:1; }
.onld-theme-change-btn{
  background:none;
  border:1px solid #d4af37;
  color:#946c00;
  border-radius:999px;
  padding:3px 10px;
  font-size:12px;
  cursor:pointer;
}

#onld-textarea{
  width:100%;
  min-height:90px;
  border:1px solid #ccc;
  border-radius:10px;
  padding:12px;
  font-size:16px;
  font-family:inherit;
  resize:vertical;
}
#onld-textarea:focus{ outline:none; border-color:#d4af37; }
#onld-textarea:disabled{ background:#f4f4f4; color:#999; }

.onld-counter-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:6px 0;
}
#onld-draft-indicator{
  font-size:12px;
  color:#1e3a5f;
  opacity:0;
  transition:opacity .3s;
}
#onld-draft-indicator.show{ opacity:1; }
#onld-counter{ font-size:13px; color:#777; }
#onld-counter.onld-counter-warn{ color:#b3261e; font-weight:bold; }

.onld-counter-bar{
  height:5px;
  border-radius:999px;
  background:#eee;
  overflow:hidden;
  margin-bottom:14px;
}
#onld-counter-bar-fill{
  height:100%;
  width:0%;
  background:#1e3a5f;
  border-radius:999px;
  transition:width .15s, background .3s;
}
#onld-counter-bar-fill.warn{ background:#d4af37; }
#onld-counter-bar-fill.danger{ background:#b3261e; }

#onld-save-btn{
  display:block;
  width:100%;
  background:#1e3a5f;
  color:#fff;
  border:none;
  border-radius:999px;
  padding:14px;
  font-size:16px;
  font-weight:bold;
  cursor:pointer;
}
#onld-save-btn:disabled{ background:#aab4be; cursor:not-allowed; }

#onld-save-status{
  margin-top:10px;
  font-size:14px;
  min-height:1.2em;
  text-align:center;
}
#onld-save-status.ok{ color:#1e3a5f; }
#onld-save-status.err{ color:#b3261e; }

.onld-banner{
  display:none;
  border-radius:10px;
  padding:10px 14px;
  font-size:13px;
  text-align:center;
  margin-bottom:14px;
}
#onld-saved-banner{ background:#e8f5e9; color:#2e7d32; border:1px solid #2e7d32; }
#onld-auth-error-banner{ background:#fdecea; color:#b3261e; border:1px solid #b3261e; }

/* ===== 左：過去の記録 ===== */
.onld-history-box{
  background:#fff;
  border-radius:16px;
  padding:20px;
  box-shadow:0 2px 10px rgba(0,0,0,.08);
}
.onld-history-title-row{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  margin-bottom:8px;
}
.onld-history-title-row h3{ color:#1e3a5f; font-size:15px; margin:0; }
#onld-status-box{
  font-size:14px;
  color:#444;
  line-height:1.8;
  margin-bottom:10px;
}
#onld-status-refresh-btn{
  display:block;
  width:100%;
  background:none;
  border:1px solid #d4af37;
  color:#946c00;
  border-radius:999px;
  padding:8px;
  font-size:13px;
  font-weight:bold;
  cursor:pointer;
}

/* ===== 右：カレンダー ===== */
.onld-cal-widget{
  background:#fff;
  border-radius:16px;
  padding:16px;
  box-shadow:0 2px 10px rgba(0,0,0,.08);
}
.onld-cal-widget-title{
  color:#1e3a5f;
  font-size:14px;
  margin:0 0 8px;
  text-align:center;
}
#cal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:6px;
}
#cal-header button{
  background:none;
  border:none;
  color:#1e3a5f;
  font-size:18px;
  cursor:pointer;
  padding:0 8px;
  line-height:1;
}
#cal-title{ font-size:13px; font-weight:bold; color:#1e3a5f; }
#cal-weekdays{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  text-align:center;
  font-size:10px;
  color:#999;
  margin-bottom:2px;
}
#cal-grid{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:2px;
}
.cal-cell{
  aspect-ratio:1;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  border-radius:6px;
  color:#ccc;
}
.cal-cell.blank{ visibility:hidden; }
.cal-cell.in-range{ background:#fff7e0; color:#946c00; }
.cal-cell.past{ color:#ddd; }
.cal-cell.is-today{ background:#1e3a5f; color:#fff; font-weight:bold; }
.cal-cell.is-end{ background:#d4af37; color:#fff; font-weight:bold; }

#cal-legend{
  display:flex;
  gap:12px;
  justify-content:center;
  margin-top:8px;
  font-size:10px;
  color:#777;
}
#cal-legend .dot{
  display:inline-block;
  width:8px;
  height:8px;
  border-radius:50%;
  margin-right:3px;
  vertical-align:middle;
}
.dot.today{ background:#1e3a5f; }
.dot.end{ background:#d4af37; }

/* ===== 保存成功の演出（紙吹雪） ===== */
.onld-confetti{
  position:fixed;
  inset:0;
  pointer-events:none;
  overflow:hidden;
  z-index:9999;
}
.onld-confetti-piece{
  position:absolute;
  top:-10px;
  width:8px;
  height:14px;
  opacity:.9;
  animation:onld-confetti-fall linear forwards;
}
@keyframes onld-confetti-fall{
  to{ transform:translateY(110vh) rotate(540deg); opacity:.2; }
}

/* ===== 別アカウントで使う（リセット） ===== */
#onld-menu-reset.onld-reset-inline{
  display:block;
  width:100%;
  background:#fff;
  border:1px solid #ccc;
  color:#777;
  border-radius:999px;
  padding:10px;
  font-size:13px;
  cursor:pointer;
  box-shadow:0 2px 10px rgba(0,0,0,.08);
  margin-top:16px;
}

/* ===== 印刷用 ===== */
@media print{
  body.onld-bg-applied{ background-image:none !important; }
  .onld-header, .onld-card, .onld-gate, .onld-offline-banner,
  .onld-theme-hint, .onld-main, .onld-sidebar-right, .onld-menu-btn,
  .onld-menu-panel{
    display:none !important;
  }
  .onld-layout{ display:block !important; }
  .onld-sidebar-left{ width:100% !important; }
  .onld-history-box{ box-shadow:none; border:1px solid #ccc; }
}

/* ===== 横向きタブレット：縦の余白を詰める ===== */
@media (orientation:landscape) and (max-height:500px){
  .onld-header{ margin-bottom:8px; }
  .onld-card, .onld-history-box{ padding:14px; margin-bottom:10px; }
  #onld-textarea{ min-height:60px; }
}

@media (max-width:480px){
  .onld-header h1{ font-size:1.15rem; }
}
