/* ============================================
   TidyQuest 見た目の定義
   デザイン方針：ライト・ミニマル
   色は「白・グレー（ベース）・ミント（アクセント）・赤茶（要掃除）」の4色だけに絞る
   ============================================ */

:root {
  --bg: #FFFFFF;        /* 画面の地の色 */
  --surface: #F4F4F1;   /* カードの色 */
  --text: #232323;      /* 主な文字 */
  --sub: #8A8A85;       /* 補助の文字 */
  --line: #E4E4E1;      /* 区切り線 */
  --accent: #3EAE8C;    /* きれい・完了・主ボタン（ミント） */
  --warn: #C0553F;      /* 要掃除 */
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit; font-size: inherit; color: inherit;
  appearance: none; -webkit-appearance: none; background: none;
}

/* ---- 画面の枠組み ---- */
.screen { max-width: 480px; margin: 0 auto; }
.screen[hidden] { display: none; }

.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 18px;
  background: var(--bg);
  border-bottom: 0.5px solid var(--line);
}
.app-title { font-size: 15px; font-weight: 500; letter-spacing: 0.02em; }

.screen-body {
  padding: 18px 18px 96px;   /* 下は tabbar のぶん空ける */
}

/* ---- アイコン ---- */
.icon {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-btn {
  border: 0; background: transparent; padding: 6px; cursor: pointer;
  color: var(--sub); display: flex;
}

/* ---- 下部メニュー ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: 480px; margin: 0 auto;
  display: flex; background: var(--bg);
  border-top: 0.5px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; color: #D6D6D2;
}
.tab span { font-size: 10px; }
.tab.is-active { color: var(--accent); }

/* ---- カード ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 18px;
}
.card-center { text-align: center; }

.section-label {
  font-size: 11px; color: var(--sub);
  margin: 0 0 10px;
}

/* ---- 2人の経験値・レベル ---- */
.xp-row { display: flex; gap: 8px; margin: 0 0 16px; }
.xp-chip { flex: 1; min-width: 0; background: var(--surface); border-radius: 12px; padding: 10px 12px; }
.xp-chip-name { font-size: 12px; color: var(--text); font-weight: 500; margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-chip-level { font-size: 11px; color: var(--sub); margin: 0 0 6px; }
.xp-bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.xp-bar-fill { height: 100%; background: var(--accent); }

.zone-name { font-size: 20px; font-weight: 500; margin: 0; }
.zone-note { font-size: 12px; color: var(--sub); margin: 4px 0 0; }

/* ---- ボタン ---- */
.btn-primary {
  display: block; width: 100%; border: 0; cursor: pointer;
  background: var(--accent); color: #FFFFFF;
  border-radius: 12px; padding: 14px;
  font-size: 15px; font-weight: 500;
  margin-top: 16px;
}
.btn-primary:active { transform: scale(0.99); }
.btn-primary[disabled] { background: #C9CFC9; }

.btn-quiet {
  display: block; width: 100%; border: 0; cursor: pointer;
  background: transparent; color: var(--sub);
  padding: 12px; font-size: 13px; margin-top: 2px;
}

.btn-outline {
  border: 0.5px solid var(--line); background: transparent; cursor: pointer;
  border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--text);
}
.btn-danger-text {
  display: block; width: 100%; border: 0; cursor: pointer;
  color: var(--warn); font-size: 13px; padding: 12px 0; text-align: center;
}

/* ---- 時間の選択（3分 / 10分 / 30分）---- */
.pill-row { display: flex; gap: 8px; margin-bottom: 18px; }
.pill {
  flex: 1; border: 0.5px solid var(--line); background: transparent; cursor: pointer;
  border-radius: 10px; padding: 9px 0; font-size: 13px; color: var(--sub);
}
.pill.is-active {
  border: 1px solid var(--accent); color: var(--accent); font-weight: 500;
}

/* ---- 区画の一覧 ---- */
.zone-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px; border-bottom: 0.5px solid var(--line);
}
.zone-row-main { flex: 1; min-width: 0; cursor: pointer; }
.zone-row-name { font-size: 14px; margin: 0; }
.zone-row-sub { font-size: 11px; color: var(--sub); margin: 2px 0 0; }
.zone-row-hp { font-size: 12px; font-variant-numeric: tabular-nums; }
.zone-row.is-off .zone-row-name { color: var(--sub); text-decoration: line-through; }

.tick-btn {
  border: 0.5px solid var(--line); background: transparent; cursor: pointer;
  border-radius: 999px; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center; color: var(--sub);
  flex-shrink: 0;
}

/* ---- タイマー ---- */
.timer {
  font-size: 40px; font-weight: 500; margin: 16px 0 0;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.timer.is-over { color: var(--warn); }

/* ---- 記録 ---- */
.log-day { margin-bottom: 20px; }
.log-date { font-size: 11px; color: var(--sub); margin: 0 0 6px; }
.log-item {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0; border-bottom: 0.5px solid var(--line); font-size: 14px;
}
.log-src { font-size: 11px; color: var(--sub); }

/* ---- 設定 ---- */
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; height: 44px; padding: 0 12px;
  border: 0.5px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 15px; font-family: inherit;
}
.field .hint { font-size: 11px; color: var(--sub); margin: 6px 0 0; }

/* ---- 空っぽのとき ---- */
.empty { text-align: center; color: var(--sub); font-size: 13px; padding: 40px 0; }

/* ---- 下から出るパネル ---- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,0.28);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  max-width: 480px; margin: 0 auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 8px 18px calc(24px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto;
}
.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--line); margin: 0 auto 16px;
}
.sheet h2 { font-size: 16px; font-weight: 500; margin: 0 0 16px; }

/* ---- お知らせ ---- */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  z-index: 40; background: var(--text); color: #FFFFFF;
  font-size: 13px; padding: 10px 18px; border-radius: 999px;
  white-space: nowrap;
}

/* ---- 起動直後の読み込み中 ---- */
.loading-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.loading-gif { width: 96px; height: 96px; object-fit: contain; }

/* ---- レベルアップの演出 ---- */
.levelup {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 50; background: var(--bg); border-radius: 20px;
  padding: 28px 32px; text-align: center;
  border: 0.5px solid var(--line);
}
.levelup-gif { width: 88px; height: 88px; object-fit: contain; }
.levelup-text { font-size: 16px; font-weight: 500; color: var(--text); margin: 12px 0 0; }
