:root {
  --bg: #fff8f0;
  --surface: #ffffff;
  --text: #2b2622;
  --muted: #8a7f76;
  --border: #eee3d8;
  --accent: #f08a4b;
  --accent-text: #ffffff;
  --accent-soft: #fde6d6;
  --danger: #e0483e;
  --shadow: 0 1px 3px rgb(80 50 20 / 0.08);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a18;
    --surface: #2a2724;
    --text: #f3ede7;
    --muted: #a39990;
    --border: #3a3632;
    --accent: #f59a5f;
    --accent-text: #1c1a18;
    --accent-soft: #4a3325;
    --danger: #ff6b61;
    --shadow: none;
  }
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---- ヘッダー ---- */

/* ヘッダーは画面に貼り付ける（position: fixed）。枠はその高さぶんの場所取り。
   sticky だと、iPhone で端を越えて引っぱったとき（びよーん）に中身と一緒に動いて消えて見えるため */
.topbar-wrap {
  height: calc(var(--safe-top) + 61px);
}

.topbar-wrap > .topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  box-sizing: border-box;
  max-width: 640px;
  height: calc(var(--safe-top) + 61px);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(var(--safe-top) + 8px) 8px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
}

/* ---- 本文 ---- */

.content {
  padding: 8px 16px 32px;
}

.content.with-footer {
  padding-bottom: calc(96px + var(--safe-bottom));
}

.section-label {
  margin: 16px 4px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.empty {
  margin: 24px 0;
  text-align: center;
  color: var(--muted);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card:active {
  transform: scale(0.99);
  opacity: 0.85;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 22px;
}

.card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-sub {
  font-size: 13px;
  color: var(--muted);
}

.card .progress {
  margin-top: 4px;
}

.chevron {
  font-size: 22px;
  color: var(--muted);
}

/* リストのカード：タップでその場に中身を開く */
.card-wrap > .card {
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
}

.card-wrap .chevron {
  transition: transform 0.2s;
}

.card-wrap.open .chevron {
  transform: rotate(90deg);
}

.card-wrap.open > .card {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: none;
}

.card-preview {
  padding: 4px 14px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}

.card-preview .money-balances {
  margin: 8px 0 4px;
}

.preview-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.preview-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.preview-items > :last-child {
  border-bottom: 0;
}

.preview-item.check {
  padding: 0;
}

.preview-item .item-label {
  min-height: 44px;
  padding: 6px 0;
}

.preview-item.checked .item-text {
  color: var(--muted);
  text-decoration: line-through;
}

.preview-more,
.preview-empty {
  margin: 0;
  padding: 8px 0;
  font-size: 13px;
  color: var(--muted);
}

.card-open {
  display: block;
  margin-top: 6px;
  padding: 10px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.add-card {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: none;
  color: var(--accent);
  font-weight: 600;
}

/* ---- 進捗バー ---- */

.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 12px 4px 8px;
  font-size: 14px;
  color: var(--muted);
}

.summary-done {
  font-weight: 700;
  color: var(--accent);
}

/* ---- チェックリスト ---- */

.items {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.items:empty {
  display: none;
}

.item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.item:last-child {
  border-bottom: 0;
}

.item-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 4px 10px 14px;
  cursor: pointer;
}

.item-check {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  transition: background 0.15s, border-color 0.15s;
}

.item-check::after {
  content: '';
  width: 7px;
  height: 12px;
  margin-top: -3px;
  border: solid var(--accent-text);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s;
}

.item-check:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.item-check:checked::after {
  transform: rotate(45deg) scale(1);
}

.item-check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.item-text {
  overflow-wrap: anywhere;
}

.item.checked .item-text {
  color: var(--muted);
  text-decoration: line-through;
}

.item-delete {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 20px;
  opacity: 0.6;
}

/* ---- 追加バー（画面下に固定） ---- */

.add-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

/* ---- 入力・ボタン ---- */

.text-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  /* 16px 未満だと iPhone でフォーカス時に勝手にズームされる */
  font-size: 16px;
}

/* iPhone の日付・時刻の欄は、そのままだと自分の幅より狭くならない（2 列に並べるとはみ出す）。
   見た目を標準のものにしてから幅を 100% にし、中の文字は左寄せ */
.text-input[type='date'],
.text-input[type='time'] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  min-width: 0;
  max-width: 100%;
  line-height: 44px;
  color: var(--text);
}

.text-input[type='date']::-webkit-date-and-time-value,
.text-input[type='time']::-webkit-date-and-time-value {
  margin: 0;
  text-align: left;
}

.text-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.btn {
  height: 46px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
  white-space: nowrap;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

/* ---- ボトムシート ---- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 0);
  transition: background 0.2s;
}

.sheet-backdrop.open {
  background: rgb(0 0 0 / 0.35);
}

.sheet {
  width: 100%;
  max-width: 640px;
  padding: 8px 16px calc(16px + var(--safe-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--bg);
  transform: translateY(100%);
  /* ポップアップは少しだけ弾んで出てくる */
  transition: transform 0.34s cubic-bezier(0.2, 1.15, 0.35, 1);
}

.sheet-backdrop.open .sheet {
  transform: translateY(0);
}

.sheet-title {
  padding: 12px 4px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.sheet-action {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  font-size: 17px;
  color: var(--accent);
}

.sheet-action.danger {
  color: var(--danger);
}

.sheet-action.cancel {
  margin-top: 4px;
  font-weight: 600;
  color: var(--text);
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-buttons {
  display: flex;
  gap: 8px;
}

.sheet-buttons .btn {
  flex: 1;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.emoji-btn {
  width: 44px;
  height: 44px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  font-size: 22px;
}

.emoji-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---- ログイン・参加画面 ---- */

.center-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 24px);
  text-align: center;
}

.welcome-icon {
  width: 88px;
  height: 88px;
  border-radius: 22px;
}

.welcome-title {
  margin: 4px 0 0;
  font-size: 26px;
}

.welcome-text {
  margin: 0 0 12px;
  max-width: 320px;
  color: var(--muted);
}

.welcome-note {
  margin: 8px 0 0;
  max-width: 320px;
  font-size: 13px;
  color: var(--muted);
}

.btn.wide {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 320px;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  font-size: 13px;
  color: var(--muted);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- お知らせ・メンバー ---- */

.notice {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  color: var(--muted);
}

.notice p {
  margin: 0 0 8px;
}

.uid {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
  user-select: all;
}

.member-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.member-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.member-list li:last-child {
  border-bottom: 0;
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 12px;
  color: var(--accent);
}

.badge.muted {
  background: var(--border);
  color: var(--muted);
}

/* ---- トースト ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-bottom));
  z-index: 200;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  /* 下からぴょこっと */
  transition: opacity 0.2s, transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

/* ---- オンライン表示 ---- */

.dot {
  flex-shrink: 0;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}

.dot.online {
  background: #34c759;
  box-shadow: 0 0 0 3px rgb(52 199 89 / 0.2);
}

.member-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.member-seen {
  font-size: 12px;
  color: var(--muted);
}

/* ---- 管理者ダッシュボード ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

.stat-sub {
  font-size: 11px;
  color: var(--muted);
}

/* ---- QR コード ---- */

.qr {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 12px;
  /* QR は暗い背景だと読み取れないので、ダークモードでも白地にする */
  background: #ffffff;
  color: #000000;
  box-sizing: content-box;
}

.qr-error {
  font-size: 12px;
  color: #8a7f76;
  text-align: center;
}

.qr-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 28px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.qr-card-icon {
  font-size: 28px;
  line-height: 1;
}

.qr-card .chevron {
  margin-left: auto;
}

.share-url {
  margin-top: 4px;
  user-select: all;
  -webkit-user-select: all;
}

.qr-card-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.qr-card-text strong {
  font-size: 15px;
  color: var(--text);
}

.qr-url {
  font-size: 11px;
  overflow-wrap: anywhere;
}

.qr-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.qr-sheet p {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* ---- 名前 ---- */

.greeting {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 10px 4px;
  border: 0;
  background: none;
  font-size: 17px;
  font-weight: 600;
  text-align: left;
}

.edit-hint {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.member-list li.is-me,
.member-list li.is-tappable {
  cursor: pointer;
}

/* ---- 復旧ID ---- */

.recovery-code {
  margin-bottom: 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.06em;
  user-select: all;
}

.recovery-input {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recovery-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

/* ---- イベント ---- */

.empty.small {
  margin: 8px 4px;
  font-size: 13px;
  text-align: left;
}

.event-card.past {
  opacity: 0.7;
}

.event-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.event-badge.ongoing {
  background: #34c759;
  color: #ffffff;
}

.event-badge.past {
  background: var(--border);
  color: var(--muted);
}

.past-toggle {
  margin: 10px 0 0;
  padding: 6px 4px;
  border: 0;
  background: none;
  font-size: 14px;
  color: var(--muted);
}

.event-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.event-dates {
  font-size: 17px;
  font-weight: 700;
}

.date-row {
  display: grid;
  /* minmax(0, 1fr)：中の日付の欄が縮められないと、列ごと画面からはみ出すので */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.date-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}

/* 普段の予定の「〜 終わりの日」 */
.end-date-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* ---- 取り込み ---- */

.sheet {
  max-height: 88dvh;
  overflow-y: auto;
}

.source-list {
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.source-group {
  margin: 0;
  padding: 10px 14px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: left;
}

.source-emoji {
  font-size: 20px;
}

.source-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-count {
  font-size: 13px;
  color: var(--muted);
}

.pick-items {
  margin: 0 0 12px;
}

.pick-items .badge {
  margin-left: auto;
}

/* ---- 旅程 ---- */

.sch-day {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.sch-day.candidates {
  border-style: dashed;
}

.sch-day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px 6px;
  font-size: 14px;
  font-weight: 700;
}

.sch-day-date {
  font-weight: 400;
  color: var(--muted);
}

.sch-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sch-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 4px 10px 14px;
  border-top: 1px solid var(--border);
}

.sch-time {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  width: 56px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
}

.sch-end {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.sch-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sch-title {
  overflow-wrap: anywhere;
}

.sch-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--muted);
}

.sch-place {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.sch-memo {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sch-more {
  flex-shrink: 0;
  width: 40px;
  height: 36px;
  margin-top: -6px;
  border: 0;
  background: none;
  font-size: 20px;
  color: var(--muted);
}

.sch-plan {
  flex-shrink: 0;
  align-self: center;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.sch-add {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  color: var(--accent);
}

.memo-input {
  height: auto;
  min-height: 64px;
  padding: 10px 14px;
  resize: vertical;
  line-height: 1.5;
}

select.text-input {
  appearance: auto;
}

/* ---- 旅程のドラッグ＆ドロップ ---- */

.sch-handle {
  flex-shrink: 0;
  align-self: stretch;
  display: grid;
  place-items: center;
  width: 28px;
  margin: -10px 0 -10px -10px;
  font-size: 18px;
  color: var(--muted);
  cursor: grab;
  /* つまみの上だけはスクロールせずにドラッグにする */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.sch-item.candidate .sch-handle {
  align-self: center;
  height: 36px;
}

/* 空の日にも落とせるように、少しだけ高さを持たせる */
.sch-list:empty {
  min-height: 6px;
}

.schedule.dragging .sch-list:empty {
  min-height: 44px;
}

.schedule.dragging,
.schedule.dragging * {
  user-select: none;
  -webkit-user-select: none;
  cursor: grabbing;
}

.sch-day.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.sch-placeholder {
  opacity: 0.35;
  background: var(--accent-soft);
}

.sch-ghost {
  position: fixed;
  z-index: 300;
  margin: 0;
  list-style: none;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
  pointer-events: none;
  transform: scale(1.02);
}

.sch-hint {
  margin: 8px 4px 0;
  font-size: 12px;
  color: var(--muted);
}

/* ---- 旅程：全体（日のカード）と 1 日の画面 ---- */

.sch-day-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sch-day-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sch-day-card:active {
  opacity: 0.85;
}

.sch-day-card.today {
  border-color: #34c759;
}

.sch-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sch-card-day {
  font-weight: 700;
}

.sch-card-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.schedule.overview .sch-day.candidates {
  margin-top: 10px;
}

.day-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.day-nav-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
}

.day-nav-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.day-nav-day {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
}

.day-nav-date {
  font-size: 13px;
  color: var(--muted);
}

/* 1 日の画面の予定：長さに比例した高さ。左に色の帯を付けてカレンダーらしく */
.sch-item.scaled {
  position: relative;
  align-items: stretch;
}

.sch-item.scaled::before {
  content: '';
  position: absolute;
  left: 32px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.6;
}

.sch-item.scaled .sch-time {
  padding-left: 8px;
}

.sch-empty {
  margin: 4px 14px 10px;
}

/* ---- 時間未定の予定 ---- */

.sch-time.untimed {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.sch-item.untimed .sch-title {
  font-style: normal;
}

.sch-item.untimed {
  background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--border) 45%, transparent) 8px 9px);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.check-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

/* ---- 全体の画面のドラッグ（日のカード） ---- */

.sch-day-card {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.sch-card-head {
  padding: 12px 14px;
}

.sch-day-card .sch-list .sch-item.compact {
  padding-top: 7px;
  padding-bottom: 7px;
}

.sch-day-card .sch-item.compact .sch-time {
  flex-direction: row;
  gap: 2px;
  width: auto;
  min-width: 56px;
  font-size: 14px;
}

.sch-day-card .sch-item.compact .sch-end {
  display: none;
}

.sch-day-card .sch-item.compact .sch-more {
  margin-top: -8px;
  margin-bottom: -8px;
}

.sch-day-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* ---- 行きたい候補の折りたたみ ---- */

.schedule .sch-day.candidates {
  margin: 0 0 10px;
}

.sch-collapse {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
}

.sch-caret {
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.15s;
}

.sch-day.candidates.collapsed .sch-caret {
  transform: rotate(-90deg);
}

.sch-day.candidates.collapsed .sch-list,
.sch-day.candidates.collapsed .sch-add {
  display: none;
}

.sch-day.candidates.collapsed .sch-collapse {
  padding-bottom: 10px;
}

/* ---- タブ（イベント画面の 旅程 / リスト） ---- */

.tabs {
  position: sticky;
  top: calc(var(--safe-top) + 61px);
  z-index: 5;
  display: flex;
  gap: 4px;
  margin: 12px 0;
  padding: 4px;
  border-radius: 12px;
  background: var(--border);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.tab-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 12px;
  color: var(--accent);
}

/* ---- 予定のリンク ---- */

.sch-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.sch-link {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sch-link.official {
  border-color: #8ab4f8;
}

.sch-link.booking {
  border-color: var(--accent);
}

.sch-link.video {
  border-color: #f28b82;
}

.links-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.links-label {
  font-size: 12px;
  color: var(--muted);
}

.link-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.link-rows:empty {
  display: none;
}

.link-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: center;
}

.link-type {
  padding: 0 6px;
  font-size: 14px;
}

.link-remove {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 20px;
  color: var(--muted);
}

.link-add {
  align-self: flex-start;
  padding: 6px 0;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* ---- 参加者 ---- */

.people-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.people-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.chip.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---- カレンダー ---- */

.cal-filter {
  margin-bottom: 8px;
}

.cal-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.cal-title {
  font-size: 18px;
  font-weight: 700;
}

/* 季節の色（.calendar の --season。月ごとに変わる） */
.calendar .cal-title {
  color: var(--season, var(--text));
}

.calendar .cal-grid {
  border-color: color-mix(in srgb, var(--season, var(--border)) 65%, var(--border));
}

.calendar .cal-dow {
  background: color-mix(in srgb, var(--season, transparent) 24%, var(--surface));
  border-bottom-color: color-mix(in srgb, var(--season, var(--border)) 55%, var(--border));
}

.cal-today {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.cal-grid {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

/* 月の表を左右に並べてスワイプする：今の月の表の左右に、となりの月の表（.cal-ghost）を置く */
.cal-pager {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.cal-track {
  position: relative;
}

.cal-track.snap {
  transition: transform 0.22s cubic-bezier(0.25, 0.8, 0.3, 1);
}

.cal-ghost {
  position: absolute;
  top: 0;
  width: 100%;
  box-sizing: border-box;
  pointer-events: none;
}

.cal-ghost.prev {
  right: calc(100% + 12px);
}

.cal-ghost.next {
  left: calc(100% + 12px);
}

.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  row-gap: 2px;
  min-height: 64px;
  border-bottom: 1px solid var(--border);
}

.cal-week:last-child {
  border-bottom: 0;
}

.cal-day {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 4px;
  border: 0;
  border-right: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: none;
  color: var(--text);
}

.cal-day:nth-child(7) {
  border-right: 0;
}

.cal-day.other {
  color: var(--muted);
  opacity: 0.45;
}

.cal-day.sun .cal-num,
.cal-dow .sun {
  color: #e0483e;
}

.cal-day.sat .cal-num,
.cal-dow .sat {
  color: #3b7ddd;
}

/* 土日・祝日：マス全体にうすい色（日曜・祝日は赤、土曜は青）。祝日は数字も赤 */
.cal-day.sun,
.cal-day.holiday {
  background: color-mix(in srgb, #e0483e 7%, transparent);
}

.cal-day.sat:not(.holiday) {
  background: color-mix(in srgb, #3b7ddd 7%, transparent);
}

.cal-day.holiday .cal-num {
  color: #e0483e;
}

.cal-day.today.holiday .cal-num,
.cal-day.today.sun .cal-num,
.cal-day.today.sat .cal-num {
  color: var(--accent-text);
}

/* 祝日の名前（マスの中・下の欄の見出し） */
.cal-label.holiday {
  border-left-color: #e0483e;
  background: none;
  color: #e0483e;
  font-weight: 700;
}

.holiday-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, #e0483e 12%, transparent);
  color: #e0483e;
  font-size: 12px;
  font-weight: 700;
}

.cal-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.cal-day.today .cal-num {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.cal-day {
  /* マスの高さいっぱいまでタップできるように（iPhone の Safari はボタンを伸ばさないことがある） */
  height: 100%;
}

/* 選んだ日：マス全体に色と枠（.cal-sel。予定の名前の行まで） */
.cal-sel {
  align-self: stretch;
  margin: 1px;
  border-radius: 6px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
  pointer-events: none;
}

/* 長押しの複数選択：iPhone の長押しメニューや文字の選択を出さない */
.cal-day {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 選んだ日：となりどうしがつながった丸い帯（週の端では丸く閉じる）。新しく選ばれた日はゴムのように伸びる */
.cal-day {
  position: relative;
}

.cal-day .cal-num {
  position: relative;
  z-index: 1;
}

.cal-day.picked::before {
  content: '';
  position: absolute;
  inset: 2px 3px;
  border-radius: 16px;
  /* 重なった境目が濃く見えないように、不透明な色にする */
  background: color-mix(in srgb, var(--accent) 26%, var(--surface));
  border: 2px solid var(--accent);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cal-day.pick-l::before {
  left: -1px;
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.cal-day.pick-r::before {
  right: 0;
  border-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.cal-day.grow-r::before {
  transform-origin: left center;
  animation: pick-grow 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cal-day.grow-l::before {
  transform-origin: right center;
  animation: pick-grow 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 指のある日（伸びている先）は、少しふくらむ */
.cal-day.tip::before {
  transform: scaleY(1.08);
}

@keyframes pick-grow {
  from {
    transform: scaleX(0.15);
  }
  to {
    transform: scaleX(1);
  }
}

.cal-day.picked .cal-num {
  font-weight: 700;
}

.cal-hint {
  margin: 6px 4px 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.cal-multi-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(12px + var(--safe-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: calc(100% - 24px);
  max-width: 616px;
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
}

.cal-multi-count {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 4px;
  font-size: 14px;
}

.cal-multi-count b {
  font-size: 18px;
  color: var(--accent);
}

.cal-multi-count small {
  width: 100%;
  font-size: 11px;
  color: var(--muted);
}

.multi-dates {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 14px;
}

.cal-bar {
  z-index: 1;
  margin: 0 1px;
  padding: 0 4px;
  border-radius: 0;
  background: color-mix(in srgb, var(--accent) 80%, transparent);
  font-size: 11px;
  line-height: 18px;
  color: var(--accent-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

/* 何日か続く普段の予定の帯（イベントと色を変える） */
.cal-bar.plan {
  background: color-mix(in srgb, #2f9e8f 80%, transparent);
}

.cal-bar.head {
  margin-left: 3px;
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.cal-bar.tail {
  margin-right: 3px;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.cal-labels {
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 1px 2px 3px;
  overflow: hidden;
  pointer-events: none;
}

/* その日の予定の名前（省略せずに、マスの幅で折り返して全部出す） */
.cal-label {
  padding: 1px 2px;
  border-left: 2px solid var(--accent);
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-size: 8.5px;
  line-height: 1.25;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.cal-label.sched {
  border-left-color: #3b7ddd;
  background: color-mix(in srgb, #3b7ddd 12%, transparent);
}

.cal-more {
  font-size: 9px;
  line-height: 12px;
  color: var(--accent);
  text-align: center;
}

.cal-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.cal-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-weight: 700;
}

.cal-panel .empty.small {
  margin: 0 14px 10px;
}

.cal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 6px 10px 14px;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  text-align: left;
  color: inherit;
}

.cal-row.plan {
  cursor: pointer;
}

.cal-row.event {
  background: color-mix(in srgb, var(--accent-soft) 50%, transparent);
}

.cal-row-time {
  flex-shrink: 0;
  width: 70px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cal-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-row-title {
  overflow-wrap: anywhere;
}

.cal-row-sub {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cal-row .sch-more {
  display: grid;
  place-items: center;
  margin: 0;
}

/* スマホ幅でも見出しが 1 行に収まるように */
.cal-head .day-nav-btn {
  width: 36px;
  height: 36px;
  font-size: 24px;
}

.cal-title {
  font-size: 17px;
  white-space: nowrap;
}

.cal-today {
  padding: 4px 7px;
  white-space: nowrap;
}

/* 先月 / 見出し（＋今日） / 来月 の並び。‹ › は両端に固定、見出しと「今日」は真ん中 */
.cal-head .cal-title-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.cal-head .cal-today {
  margin-left: 0;
}

/* 今日を見ているときは見えなくするが、場所は空けたまま（ほかが動かないように） */
.cal-today.off {
  visibility: hidden;
}

/* タブが 3 つでもスマホ幅に収まるように */
.tab {
  min-width: 0;
  padding: 0 4px;
  font-size: 14px;
  white-space: nowrap;
}

/* ---- 欲しいものリスト ---- */

.wish-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.wish-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 10px 12px;
  border-bottom: 1px solid var(--border);
}

.wish-row:last-child {
  border-bottom: 0;
}

.wish-row.closed {
  opacity: 0.65;
}

.wish-thumb-btn {
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  overflow: hidden;
}

.wish-thumb {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--border);
  object-fit: cover;
}

.wish-thumb.missing {
  opacity: 0.3;
}

.wish-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.wish-text {
  overflow-wrap: anywhere;
}

.wish-row.closed .wish-text {
  text-decoration: line-through;
}

.wish-result {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.wish-close {
  flex-shrink: 0;
  padding: 5px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.wish-photo-btn {
  flex-shrink: 0;
  padding: 0 12px;
  font-size: 20px;
}

.wish-photo-edit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wish-how {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 12px;
}

.wish-stars {
  color: #f5a623;
  letter-spacing: 1px;
}

.star-input {
  display: flex;
  gap: 4px;
}

.star-input .star {
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
}

.star-input .star.on {
  color: #f5a623;
}

.link-preview-status {
  margin: -4px 4px 0;
  font-size: 12px;
  color: var(--muted);
}

.link-preview-status:empty {
  display: none;
}

.wish-photo {
  display: block;
  width: 100%;
  max-height: 60dvh;
  margin-bottom: 12px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface);
}

/* ---- 貸し借りリスト ---- */

.money-board {
  margin-top: 12px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.money-diagram {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.money-node {
  cursor: grab;
  touch-action: none;
}

.money-node circle {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 2;
  transition: r 0.1s;
}

.money-node.me circle {
  fill: var(--accent);
}

.money-node.me .money-initial {
  fill: var(--accent-text);
}

.money-node.dragging circle,
.money-node.target circle {
  stroke-width: 4;
}

.money-node.target circle {
  fill: #34c759;
  stroke: #34c759;
}

.money-initial {
  font-size: 18px;
  font-weight: 700;
  fill: var(--accent);
  pointer-events: none;
}

.money-name {
  font-size: 11px;
  font-weight: 600;
  fill: var(--text);
  pointer-events: none;
}

.money-edge path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
}

.money-edge text {
  font-size: 11px;
  font-weight: 700;
  fill: var(--text);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.money-head {
  fill: var(--accent);
}

.money-head.drag {
  fill: #34c759;
}

.money-drag {
  stroke: #34c759;
  stroke-width: 3;
  stroke-dasharray: 6 5;
  pointer-events: none;
}

.money-hint {
  text-align: center;
}

.money-balances {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.money-balance {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
}

.money-balance b {
  font-size: 13px;
}

.money-balance.plus b {
  color: #2e9d4f;
}

.money-balance.minus b {
  color: var(--danger);
}

.money-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.money-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 8px 12px;
  border-bottom: 1px solid var(--border);
}

.money-row:last-child {
  border-bottom: 0;
}

.money-row.settled {
  opacity: 0.6;
}

.money-check {
  display: grid;
  place-items: center;
}

.money-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.money-line {
  overflow-wrap: anywhere;
}

.money-sub {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.money-value {
  flex-shrink: 0;
  max-width: 40%;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

.money-row.settled .money-value {
  text-decoration: line-through;
}

.money-who {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.money-arrow {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---- カレンダー：＋ ボタンと日付未定の予定 ---- */

.cal-fab {
  position: fixed;
  right: max(16px, calc((100vw - 640px) / 2 + 16px));
  bottom: calc(20px + var(--safe-bottom));
  z-index: 20;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.22);
  font-size: 30px;
  line-height: 1;
  color: var(--accent-text);
}

.cal-fab:active {
  transform: scale(0.95);
}

/* ＋ ボタンで下の方が隠れないように */
.calendar {
  padding-bottom: 72px;
  /* スワイプ中に表がはみ出しても、ページが横にスクロールしないように */
  overflow-x: clip;
}

.cal-panel.undated {
  border-style: dashed;
}

.cal-undated-hint {
  margin: 0;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

/* ---- 通知の設定 ---- */

.push-status {
  margin: 0 4px 12px;
  font-size: 14px;
  line-height: 1.6;
}

.push-prefs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface);
}

/* ---- お知らせ ---- */

.news-card {
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface);
}

.news-title {
  margin: 0 0 4px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.news-meta {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.news-body {
  margin: 0;
  max-height: 45dvh;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.news-input {
  min-height: 120px;
}

.news-add {
  margin: 12px 0;
}

.news-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.news-list:empty {
  display: none;
}

.news-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.news-row:last-child {
  border-bottom: 0;
}

.news-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
}

.news-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-wrap: anywhere;
}

.news-row.unread .news-row-title {
  font-weight: 700;
}

.news-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.news-row-meta {
  font-size: 12px;
  color: var(--muted);
}

.news-delete {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  font-size: 16px;
  opacity: 0.6;
}

/* ---- ヘッダー：左右の幅をそろえてタイトルを真ん中に ---- */

.topbar {
  display: grid;
  /* 左右のボタンは縮めず、長いタイトルのほうを「…」で省略する */
  grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr);
}

.topbar-side > * {
  flex-shrink: 0;
}

.topbar-side {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.topbar-side.right {
  justify-content: flex-end;
}

.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}

.pill-online {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

/* ---- ログインボーナス・スタンプ帳 ---- */

.bonus-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0 12px;
  text-align: center;
}

@keyframes bonus-pop {
  0% {
    transform: scale(2.2) rotate(-25deg);
    opacity: 0;
  }
  60% {
    transform: scale(0.9) rotate(6deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(-8deg);
  }
}

.bonus-tag {
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
}

.bonus-tag.rare {
  background: #f5a623;
}

.bonus-extra {
  margin: 0;
  font-weight: 700;
  color: var(--accent);
}

.bonus-streak {
  margin: 0;
  font-size: 15px;
}

.bonus-count {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.member-bonus:not(:empty) {
  margin-left: 6px;
}

.stamp-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 4px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.stamp-summary span {
  display: flex;
  flex-direction: column;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stamp-summary b {
  font-size: 18px;
  color: var(--text);
}

.stamp-months {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stamp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.stamp-month {
  width: 36px;
  font-size: 12px;
  font-weight: 700;
  color: var(--season, var(--muted));
}

.stamp-cell {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid color-mix(in srgb, var(--season, var(--accent)) 60%, var(--border));
  border-radius: 50%;
  background: var(--surface);
  font-size: 26px;
}

.stamp-cell.missing {
  border-style: dashed;
  border-color: var(--border);
  background: none;
  font-size: 18px;
  color: var(--muted);
}

.stamp-count {
  position: absolute;
  right: -6px;
  bottom: -4px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 700;
}

.stamp-milestone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
}

/* ---- チケット ---- */

.ticket {
  --ticket: #c27a43;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 2px dashed color-mix(in srgb, var(--ticket) 70%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--ticket) 14%, var(--surface));
  font-size: 13px;
}

.ticket-silver {
  --ticket: #8a96a3;
}

.ticket-gold {
  --ticket: #d9a400;
}

.ticket-icon {
  font-size: 20px;
}

.ticket b {
  margin-left: auto;
  font-size: 16px;
}

.ticket.big {
  padding: 12px 18px;
  font-size: 15px;
  animation: bonus-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

.ticket.big .ticket-icon {
  font-size: 34px;
}

.ticket.big b {
  font-size: 22px;
}

.bonus-tickets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 6px 0;
}

.bonus-tickets.best-gold .ticket-gold {
  box-shadow: 0 0 22px rgb(217 164 0 / 0.55);
}

.bonus-day-label {
  margin: 0;
  font-weight: 700;
  color: var(--accent);
}

.bonus-next {
  margin: 4px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.bonus-omake {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.bonus-stamp-mini {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px dashed var(--accent);
  border-radius: 50%;
  font-size: 20px;
}

.bonus-stamp-mini.rare {
  border-color: #f5a623;
  background: #fff1c2;
}

.ticket-wallet {
  display: grid;
  gap: 8px;
}

.ticket-wallet .ticket {
  padding: 12px 14px;
  font-size: 15px;
}

.bonus-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.bonus-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  color: inherit;
}

.bonus-day small {
  font-size: 10px;
  color: var(--muted);
}

.bonus-day-reward {
  font-size: 12px;
  white-space: nowrap;
}

.bonus-day.silver {
  border-color: #8a96a3;
  background: color-mix(in srgb, #8a96a3 14%, var(--surface));
}

.bonus-day.gold {
  border-color: #d9a400;
  background: color-mix(in srgb, #d9a400 16%, var(--surface));
}

.bonus-day.got {
  opacity: 0.55;
}

.bonus-day.next {
  box-shadow: 0 0 0 2px var(--accent);
}

.bonus-day-check {
  position: absolute;
  top: 2px;
  right: 4px;
  font-style: normal;
  font-weight: 700;
  color: var(--accent);
}

.reward-list,
.reward-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reward-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.reward-emoji-big {
  font-size: 28px;
}

.reward-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.reward-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.reward-cost {
  font-size: 12px;
  color: var(--muted);
}

.reward-btn {
  flex-shrink: 0;
  padding: 6px 14px;
}

.reward-btn:disabled {
  opacity: 0.45;
}

.reward-log li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
}

.reward-log li.done {
  opacity: 0.6;
}

.reward-log-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.reward-log-main small {
  font-size: 11px;
  color: var(--muted);
}

.reward-title-row {
  display: flex;
  gap: 8px;
}

.reward-emoji {
  width: 56px;
  flex-shrink: 0;
  text-align: center;
  font-size: 20px;
}

/* ---- 欲しい度（❤️） ---- */

.heart-box {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 52px;
}

.heart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, #e5484d 45%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, #e5484d 8%, var(--surface));
  font: inherit;
  font-size: 13px;
  color: inherit;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.heart-btn b {
  min-width: 1.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.heart-btn.hot {
  border-color: #e5484d;
  background: color-mix(in srgb, #e5484d 18%, var(--surface));
}

.heart-btn.pop .heart-icon {
  display: inline-block;
  animation: heart-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes heart-pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.45);
  }
  100% {
    transform: scale(1);
  }
}

/* 押したときにふわっと上がるハート */
.heart-float {
  position: absolute;
  left: 50%;
  top: -4px;
  font-size: 14px;
  pointer-events: none;
  animation: heart-float 0.7s ease-out forwards;
}

@keyframes heart-float {
  from {
    transform: translate(-50%, 0) scale(0.8);
    opacity: 1;
  }
  to {
    transform: translate(calc(-50% + var(--dx, 0px)), -34px) scale(1.2);
    opacity: 0;
  }
}

.heart-note {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}

.wish-row.old {
  opacity: 0.6;
}

/* ---- 長押しで並べ替え ---- */
.card-wrap,
.items .item {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.sorting {
  position: relative;
  z-index: 30;
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.22);
  scale: 1.02;
  transition: scale 0.15s;
}

.items .item.sorting {
  background: var(--surface);
}

.is-sorting .card-wrap:not(.sorting),
.is-sorting .item:not(.sorting) {
  transition: transform 0.15s;
}

.items.is-sorting {
  overflow: visible;
}

/* ---- チケットの両替・換金 ---- */
.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ticket-actions .btn {
  flex: 1;
}

.ticket-actions .btn:disabled {
  opacity: 0.45;
}

.ticket-rates {
  width: 100%;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.rate-row {
  display: grid;
  grid-template-columns: 1fr 90px auto;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.cash-total {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.badge.admin {
  background: #f5a623;
}

/* 「Apple でサインイン」（iPhone アプリ版だけ）。Apple の決まりに合わせて黒地に白 */
.apple-signin {
  margin-top: 10px;
  border-color: #000;
  background: #000;
  color: #fff;
}

/* ログイン方法の連携 */
.link-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  color: #4285f4;
}

.link-icon.apple {
  border-color: #000;
  background: #000;
  color: #fff;
}

/* ホームのグループのカード：左にフリックすると右側のボタンが出てくる（iPhone のメールと同じ） */
.swipe-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}

.swipe-wrap > .card {
  position: relative;
  z-index: 1;
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.swipe-wrap > .card.snap {
  transition: transform 0.28s cubic-bezier(0.25, 0.9, 0.3, 1.05);
}

.swipe-actions {
  --reveal: 0;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
}

.swipe-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 78px;
  border: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  opacity: calc(0.4 + var(--reveal) * 0.6);
}

.swipe-action span {
  font-size: 20px;
}

.swipe-action.invite {
  background: #8a96a3;
}

.swipe-action.settings {
  background: var(--accent);
}

/* 画面の真ん中に浮かぶウィンドウ（openSheet の asWindow） */
.sheet-backdrop.as-window {
  align-items: center;
  padding: 16px;
}

.sheet-backdrop.as-window .sheet {
  width: min(360px, 100%);
  max-height: 80dvh;
  padding: 8px 14px 14px;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.28);
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.15s;
}

.sheet-backdrop.as-window.open .sheet {
  transform: none;
  opacity: 1;
}

/* シート・ウィンドウの上の「つまみ」（下にスワイプして閉じられる目印） */
.sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 5px;
  margin: 2px auto 0;
  border-radius: 3px;
  background: color-mix(in srgb, var(--muted) 45%, transparent);
}

/* ---- プロフィール ---- */
.avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--av) 28%, var(--surface));
  box-shadow: inset 0 0 0 2px var(--av);
  line-height: 1;
  font-weight: 700;
  color: var(--text);
  vertical-align: middle;
}

.chip .avatar {
  margin-right: 4px;
}

.avatar-wrap {
  position: relative;
  display: inline-flex;
}

.avatar-wrap .dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
}

.profile-title {
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.greeting .avatar {
  margin-right: 8px;
}

.profile-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4px 0 8px;
  font-size: 18px;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-section.disabled > :not(.profile-head) {
  opacity: 0.45;
}

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.check-row.small {
  font-size: 12px;
  color: var(--muted);
}

.icon-chips {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.icon-chip {
  min-width: 0;
  padding: 0;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 20px;
}

.icon-chip {
  font-size: 18px;
}

.icon-chip.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.icon-input {
  width: 100px;
}

.profile-colors {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.color-label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 600;
}

.color-label small {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.swatch {
  width: 28px;
  height: 28px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
}

.swatch.on {
  box-shadow: 0 0 0 2px var(--text);
}

.swatch.none {
  width: auto;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 11px;
  color: var(--muted);
}

.color-picker {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 0;
  background: none;
}

/* カレンダーの予定の線：参加者が 1 人なら、その人の識別カラー */
.cal-label.plan[style] {
  border-left-color: var(--who);
  background: color-mix(in srgb, var(--who) 14%, transparent);
}

/* アイコンの写真・色のセット・カラーパレット */
.avatar.photo {
  object-fit: cover;
  background: var(--surface);
}

.profile-photo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.palette-btn {
  display: grid;
  place-items: center;
  background: var(--surface);
  font-size: 14px;
}

.palette {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3px;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.palette-cell {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
}

.palette-cell.on {
  box-shadow: 0 0 0 2px var(--text);
}

/* 写真の切り抜き：四角い枠の中の丸い点線がアイコンになる範囲。丸の外は少し暗く */
.crop-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}

.crop-box {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.crop-img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  pointer-events: none;
}

.crop-ring {
  position: absolute;
  inset: 0;
  border: 2px dashed rgb(255 255 255 / 0.95);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 0.45);
  pointer-events: none;
}

.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
}

.crop-zoom {
  flex: 1;
  accent-color: var(--accent);
}

.crop-hint {
  text-align: center;
}

/* 管理者ダッシュボードのタブ（4 つ。狭い画面では 2 段） */
.admin-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-tabs .tab {
  min-width: 0;
  padding-left: 2px;
  padding-right: 2px;
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 400px) {
  .admin-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
}

/* グループの管理者お知らせ */
.badge.official {
  margin-right: 6px;
  background: #f5a623;
  color: #fff;
}

.news-row.official {
  border-left: 4px solid #f5a623;
  background: color-mix(in srgb, #f5a623 8%, var(--surface));
}

.news-card.official {
  border: 2px solid #f5a623;
}

.add-card.official {
  border-color: #f5a623;
  color: #c27d00;
}

/* テキスト予定表 */
.text-plans {
  min-height: 260px;
  margin: 8px 0;
  padding: 12px 14px;
  line-height: 1.7;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Hiragino Sans', monospace;
  font-size: 16px;
  white-space: pre;
  overflow-x: auto;
}

.text-plans-help summary {
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.text-plans-help pre {
  margin: 6px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.text-plans-result {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.text-plans-result li {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
}

.text-plans-result li.bad {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

.text-plans-result small {
  display: block;
  margin-left: 1.5em;
  color: var(--muted);
}

a.sch-add {
  display: block;
  text-align: left;
}

/* テキスト予定表の画面の下のメニュー（入力の補助と、元に戻す・保存） */
.text-toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.text-tools {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}

.text-tools::-webkit-scrollbar {
  display: none;
}

.text-tool {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  color: inherit;
  white-space: nowrap;
}

.text-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 8px;
}

.text-actions .btn {
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
}

/* 日付・時刻を選ぶための、見えない入力欄 */
.text-plans-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.content.with-text-toolbar {
  padding-bottom: 150px;
}

/* アプリのバージョン（ホームのタイトルの横） */
.app-version {
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  vertical-align: middle;
}

.app-version.outdated {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.version-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.version-card > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
}

.version-card span {
  font-size: 12px;
  color: var(--muted);
}

.version-card b {
  font-size: 22px;
}

.version-card small {
  font-size: 11px;
  color: var(--muted);
}

.version-note {
  margin: 0 4px 8px;
  font-size: 13px;
}

/* 右下の ＋ を長押しして出るメニュー（＋ の上に伸びる） */
.fab-wrap .fab-menu {
  position: fixed;
  right: max(16px, calc((100vw - 640px) / 2 + 16px));
  bottom: calc(86px + var(--safe-bottom));
  z-index: 21;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.fab-menu-item {
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.22);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(24px) scale(0.6);
  transform-origin: right bottom;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s;
  transition-delay: calc(var(--i) * 40ms);
}

.fab-wrap.open .fab-menu {
  pointer-events: auto;
}

.fab-wrap.open .fab-menu-item {
  opacity: 1;
  transform: none;
}

.fab-wrap .cal-fab {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.2s;
}

.fab-wrap.open .cal-fab {
  transform: rotate(45deg);
}

/* 長押ししたまま指を乗せている項目 */
.fab-menu-item.hover {
  background: var(--accent);
  color: var(--accent-text);
  transform: scale(1.06);
  transition-delay: 0s;
}

/* 長押ししたまま指をずらせるように、＋ の上ではブラウザのスクロールに使わせない */
.fab-wrap .cal-fab {
  touch-action: none;
}

/* 登録画面の URL の欄と「📋 貼り付け」 */
.url-row {
  display: flex;
  gap: 8px;
}

.paste-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* アプリ全体の ＋ ボタン：下に入力欄がある画面では、その上に出す。テキスト予定表・日付の複数選択中・シートの表示中は隠す */
body:has(.add-bar) .fab-wrap.global .cal-fab {
  bottom: calc(84px + var(--safe-bottom));
}

body:has(.add-bar) .fab-wrap.global .fab-menu {
  bottom: calc(150px + var(--safe-bottom));
}

body:has(.text-toolbar) .fab-wrap.global,
body:has(.cal-multi-bar) .fab-wrap.global {
  display: none;
}

/* 一覧のいちばん下が ＋ に隠れないように（下に入力欄がある画面は、入力欄＋＋のぶん） */
.content:not(.with-footer):not(.with-text-toolbar) {
  padding-bottom: calc(96px + var(--safe-bottom));
}

.content.with-footer {
  padding-bottom: calc(160px + var(--safe-bottom));
}

/* ホーム画面に追加の案内 */
.install-card {
  display: flex;
  align-items: stretch;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.install-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px 12px 14px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.install-card-main > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.install-card-main small {
  font-size: 12px;
  color: var(--muted);
}

.install-card-icon {
  font-size: 26px;
}

.install-card-close {
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

.install-lead {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.install-head {
  margin: 16px 0 8px;
  font-size: 15px;
}

.install-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.install-step {
  display: flex;
  gap: 10px;
}

.install-step > div {
  min-width: 0;
  flex: 1;
}

.install-step p {
  margin: 2px 0 0;
  font-size: 14px;
}

.install-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.install-img {
  display: block;
  width: 100%;
  max-width: 320px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* ---- 日記 ---- */
/* タブが 4 つになったので少し詰める */
.tabs.four {
  gap: 2px;
}

.tabs.four .tab {
  flex-direction: column;
  gap: 0;
  min-height: 48px;
  padding: 4px 2px;
  font-size: 12px;
  line-height: 1.2;
}

.tabs.four .tab-emoji {
  font-size: 18px;
}

.tabs.four .tab-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tabs.four .tab-count {
  min-width: 16px;
  padding: 0 4px;
  font-size: 10px;
}

.diary-filter {
  margin-bottom: 12px;
}

.diary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diary-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.diary-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.diary-at {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.diary-writer,
.diary-person {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.diary-title {
  font-size: 16px;
  font-weight: 700;
}

.diary-body {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.diary-body.full {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.diary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.diary-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.diary-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.diary-by {
  font-size: 12px;
  color: var(--muted);
}

.diary-when {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diary-when-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.7fr);
  gap: 6px;
}

.diary-when-inputs .text-input {
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}

.diary-tag-new {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
}

.diary-input {
  min-height: 140px;
}

.chip.add {
  border-style: dashed;
  color: var(--accent);
}

/* 通常のリストのアイテム：名前の下にリンク（いくつでも）、右に編集 */
.item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-main .sch-links {
  margin: 0;
}

.item-edit {
  flex-shrink: 0;
  width: 36px;
  height: 44px;
  border: 0;
  background: none;
  font-size: 15px;
  opacity: 0.55;
}

/* ---- 記念日カレンダー ---- */
.cal-label.anniv {
  border-left-color: #d9608a;
  background: color-mix(in srgb, #d9608a 14%, transparent);
}

.cal-label.anniv.milestone {
  border-left-color: #d4a800;
  background: color-mix(in srgb, #d4a800 16%, transparent);
}

.anniv-calendar .cal-panel + .cal-panel {
  margin-top: 12px;
}

.anniv-delete {
  color: #d0453c;
}

/* タブの長押し（記念日カレンダーへの切り替え）で、文字の選択やメニューを出さない */
.tab {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 何日か続く普段の予定の帯：その人の色・全員の予定の色（--who があるとき） */
.cal-bar.plan[style*='--who'] {
  background: color-mix(in srgb, var(--who) 80%, transparent);
}

/* 「全員の予定の色」の見本（全員の予定と、メンバーそれぞれの色を並べる） */
.allcolor-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.allcolor-preview .cal-label {
  font-size: 13px;
  padding: 3px 8px;
}

/* カレンダーの絞り込み：人の色（全員は全員の予定の色）で色分け。選んでいるものは塗りつぶして ✓ */
.cal-filter .chip.who {
  --who: var(--accent);
  --who-text: var(--accent-text);
  border: 1.5px solid color-mix(in srgb, var(--who) 70%, var(--border));
  background: color-mix(in srgb, var(--who) 12%, var(--surface));
  color: var(--text);
}

.cal-filter .chip.who.on {
  border-color: var(--who);
  background: var(--who);
  color: var(--who-text);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--who) 40%, transparent);
}

/* ---- プロフィールの画面・メンバーの確認画面 ---- */
.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-left: 6px solid var(--who, var(--accent));
  border-radius: var(--radius);
  background: linear-gradient(120deg, color-mix(in srgb, var(--who, var(--accent)) 14%, var(--surface)), var(--surface) 70%);
}

.profile-card-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.profile-card-name {
  font-size: 22px;
  overflow-wrap: anywhere;
}

.profile-card .profile-title {
  margin-left: 0;
  font-size: 13px;
}

.member-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pv-table {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.pv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
}

.pv-row:first-child {
  border-top: 0;
}

.pv-label {
  flex-shrink: 0;
  width: 92px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.pv-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pv-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.pv-colors {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pv-color {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.pv-color i {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 50%;
}

.pv-color i.none {
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 3px, var(--border) 3px, var(--border) 5px) !important;
}

.profile-explain p {
  margin: 4px 0;
  font-size: 13px;
}

.profile-group-card {
  width: 100%;
  border: 1px solid var(--border);
  text-align: left;
  font: inherit;
  color: inherit;
}

.profile-status {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.profile-status.custom {
  font-weight: 700;
  color: var(--accent);
}

/* グループでのプロフィール：全体の設定とこのグループの値を並べる */
.pv-compare {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.pv-compare-head,
.pv-compare-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}

.pv-compare-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: color-mix(in srgb, var(--border) 40%, transparent);
}

.pv-compare-row {
  border-top: 1px solid var(--border);
}

.pv-compare-row.custom {
  background: color-mix(in srgb, var(--accent-soft) 50%, transparent);
}

.pv-compare-row > span:last-child {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.pv-dim {
  opacity: 0.45;
}

.pv-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pv-switch .chip {
  padding: 3px 8px;
  font-size: 11px;
}

a.btn.wide {
  display: flex;
  justify-content: center;
  margin-top: 8px;
  text-decoration: none;
}

.content > .btn.wide {
  max-width: none;
  margin-top: 8px;
}

/* 管理者ダッシュボード：停止中の印・一覧 */
.badge.danger {
  margin-left: 6px;
  background: #d0453c;
  color: #fff;
}

.admin-list .member-seen {
  overflow-wrap: anywhere;
}

.admin-tabs .tab {
  font-size: 13px;
}

/* ---- 予定の報酬 ---- */
.plan-reward {
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, #d4a800 18%, transparent);
  font-size: 12px;
  font-weight: 700;
}

.reward-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.reward-presets {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reward-preset {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: left;
}

.reward-preset.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.reward-stepper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 40px 44px;
  align-items: center;
  gap: 6px;
}

.reward-count {
  text-align: center;
  font-size: 18px;
}

.reward-claims {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px;
}

.reward-claim {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.reward-claim-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reward-claim-main small {
  color: var(--muted);
}

.reward-claim-tickets {
  font-weight: 700;
}

.reward-claim-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reward-claim-buttons .btn {
  padding: 6px 12px;
  white-space: nowrap;
}

.sheet-action.primary-action {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

/* 報酬が付いた予定：カレンダーの名前・帯の右上に、いちばん価値の高いメダルの色の小さな三角（文字の幅は使わない） */
.cal-label[class*='reward-'],
.cal-bar[class*='reward-'] {
  position: relative;
}

.cal-label[class*='reward-']::after,
.cal-bar[class*='reward-']::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  border-top: 7px solid var(--medal);
  border-left: 7px solid transparent;
  border-top-right-radius: 2px;
  pointer-events: none;
}

.reward-gold {
  --medal: #e0b100;
}

.reward-silver {
  --medal: #9aa6b2;
}

.reward-bronze {
  --medal: #b8733a;
}

/* ---- アイテムボックス ---- */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.item-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 2px solid color-mix(in srgb, var(--rarity) 70%, var(--border));
  border-radius: 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--rarity) 16%, var(--surface)), var(--surface) 70%);
  color: inherit;
  font: inherit;
}

.item-cell.missing {
  border-color: var(--border);
  background: var(--surface);
  opacity: 0.4;
  filter: grayscale(1);
}

.item-emoji {
  line-height: 1.1;
}

.item-img {
  object-fit: contain;
}

.item-name {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}

.item-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--rarity);
  font-variant-numeric: tabular-nums;
}

.item-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 16px;
  text-align: center;
}

.item-detail-img {
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  border: 3px solid var(--rarity);
  border-radius: 24px;
  background: radial-gradient(circle, color-mix(in srgb, var(--rarity) 22%, var(--surface)), var(--surface) 75%);
}

.item-detail-name {
  font-size: 20px;
}

.item-rarity {
  font-size: 14px;
  font-weight: 700;
  color: var(--rarity);
}

.item-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.item-detail-count {
  font-size: 14px;
  font-weight: 700;
}

.section-link {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

/* メンバー一覧：左にフリックすると「🎒 アイテム」（ホームのカードと同じ動き） */
.member-list li.member-swipe {
  display: block;
  padding: 0;
  border-radius: 0;
}

.member-swipe > .member-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface);
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.member-swipe > .member-row.snap {
  transition: transform 0.28s cubic-bezier(0.25, 0.9, 0.3, 1.05);
}

.swipe-action.items {
  background: #d4a800;
}

/* ---- 演出（js/fx.js） ---- */
.fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.fx-spark {
  position: fixed;
  z-index: 9999;
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
}

/* チェック：ぽよんと弾む */
.item-check:checked {
  animation: fx-check 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes fx-check {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.item.checked .item-text {
  transition: color 0.3s;
}

/* アイテム：レア以上は枠がゆっくり光る。レジェンドはきらめきが流れる */
.item-cell.r3:not(.missing),
.item-cell.r4:not(.missing),
.item-cell.r5:not(.missing) {
  animation: fx-glow 2.4s ease-in-out infinite;
}

@keyframes fx-glow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rarity) 0%, transparent); }
  50% { box-shadow: 0 0 14px 2px color-mix(in srgb, var(--rarity) 55%, transparent); }
}

.item-cell.r5:not(.missing),
.item-detail-img.r5 {
  background-image: linear-gradient(110deg, transparent 35%, rgb(255 255 255 / 0.55) 50%, transparent 65%), linear-gradient(160deg, color-mix(in srgb, var(--rarity) 16%, var(--surface)), var(--surface) 70%);
  background-size: 250% 100%, 100% 100%;
  animation: fx-glow 2.4s ease-in-out infinite, fx-shimmer 2.8s linear infinite;
}

@keyframes fx-shimmer {
  from { background-position: 150% 0, 0 0; }
  to { background-position: -50% 0, 0 0; }
}

.item-detail-img.r4,
.item-detail-img.r5 {
  animation: fx-glow 2.4s ease-in-out infinite;
}

/* 動きを減らす設定の人には、繰り返しの動きを止める */
@media (prefers-reduced-motion: reduce) {
  .item-check:checked,
  .item-cell,
  .item-detail-img {
    animation: none !important;
  }
}

/* 画面の切り替え：進むときは右から、戻るときは左から、同じ深さはふわっと（app.js の animateNav） */
#app.nav-forward > main {
  animation: fx-in-right 0.45s cubic-bezier(0.25, 0.7, 0.25, 1);
}

#app.nav-back > main {
  animation: fx-in-left 0.45s cubic-bezier(0.25, 0.7, 0.25, 1);
}

#app.nav-fade > main {
  animation: fx-fade 0.35s ease;
}

@keyframes fx-in-right {
  from { transform: translateX(36px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes fx-in-left {
  from { transform: translateX(-36px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes fx-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ふだんの手ざわり：押すと少し沈む */
.btn,
.sheet-action,
.chip,
.add-card,
.item-cell,
.reward-preset,
.tab,
.icon-chip,
.swatch,
.topbar-btn,
.day-nav-btn,
.cal-today {
  transition: transform 0.12s ease;
}

.btn:active:not(:disabled),
.sheet-action:active,
.chip:active,
.add-card:active,
.item-cell:active,
.reward-preset:active,
.tab:active,
.icon-chip:active,
.swatch:active,
.topbar-btn:active,
.day-nav-btn:active,
.cal-today:active {
  transform: scale(0.95);
}

@media (prefers-reduced-motion: reduce) {
  #app > main {
    animation: none !important;
  }

  .sheet,
  .toast {
    transition-duration: 0.01s !important;
  }
}

/* ---- 壁紙（js/wallpaper.js。自分の画面だけ） ---- */
html {
  background: var(--bg);
}

html.has-wallpaper body {
  background: transparent;
}

/* 壁紙：#wallpaper（画面に固定）に 奥・まん中・手前 の層と、その上の膜（見やすさ）。
   層は画面より横に長くしておき、タブを移ると左にずれる（奥はゆっくり、手前は大きく。wallpaper.js の shiftLayers） */
#wallpaper {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.wp-layer {
  position: absolute;
  top: 0;
  left: 0;
  /* 横の長さと動く速さは、動きの大きさ・速さの設定（wallpaper.js の setMotion）で決まる */
  width: calc(100% + var(--wp-extra, 21vw));
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform var(--wp-speed, 0.8s) cubic-bezier(0.25, 0.7, 0.25, 1);
  will-change: transform;
}

.wp-cover {
  background-size: cover;
  object-fit: cover;
}

.wp-contain {
  background-size: contain;
  background-position: center bottom;
  object-fit: contain;
  object-position: center bottom;
}

.wp-pattern {
  background-size: 160px 160px;
  background-repeat: repeat;
}

.wp-veil {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  .wp-layer {
    transition: none;
  }
}

.wallpaper-row {
  margin-top: 12px;
}

/* 壁紙の層（奥・まん中・手前）を選ぶところ */
.wp-slot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.wp-slot-state {
  font-size: 12px;
  color: var(--muted);
}

.wp-slot-buttons {
  display: flex;
  gap: 4px;
}

.wp-slot-buttons .btn {
  padding: 6px 10px;
}

.wp-fit {
  grid-column: 1 / -1;
}

.wp-fit .chip {
  padding: 3px 8px;
  font-size: 11px;
}

/* 壁紙のおすそわけの一覧 */
.wp-shared-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.wp-shared {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.wp-shared-thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: 60px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--border);
  font-size: 28px;
}

.wp-shared-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wp-shared-main small {
  color: var(--muted);
}

.wp-shared-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.wp-shared-buttons .btn {
  padding: 5px 10px;
  font-size: 12px;
}

/* グループの画面：左右のスワイプでタブを切り替えるので、画面全体でブラウザには縦のスクロールだけを任せる。
   中身が短くても画面の下まで払えるように、中身の部分を画面の高さいっぱいにする */
html.swipe-tabs body {
  touch-action: pan-y;
}

.group-body {
  min-height: calc(100dvh - 130px);
}

/* ごほうびの交換の承認 */
.reward-approver {
  font-size: 11px;
  color: var(--muted);
}

.reward-log-main small + small {
  display: block;
}

.badge.danger {
  background: color-mix(in srgb, #d0453c 15%, transparent);
  color: #d0453c;
}

.redeem-result-title {
  margin: 4px 0;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.pv-uid {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

/* 着せ替えの壁紙の地面（まん中の層）：下に寄せて横にくり返す。ceiling は上から垂れる形 */
.wp-ground {
  background-size: 400px 34%;
  background-repeat: repeat-x;
  background-position: left bottom;
}

.wp-ceiling {
  background-size: 400px 18%;
  background-repeat: repeat-x;
  background-position: left top;
}

/* 着せ替えを選ぶシート：見本のカードを 2 列に並べる */
.skin-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chip.wide-chip {
  width: 100%;
  text-align: left;
}

.skin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.skin-card {
  --sk-bg: var(--bg);
  --sk-surface: var(--surface);
  --sk-text: var(--text);
  --sk-accent: var(--accent);
  --sk-accent-text: var(--accent-text);
  --sk-border: var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 6px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.skin-card.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.skin-sample {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: 10px;
  background: var(--sk-bg);
  color: var(--sk-text);
  font-size: 12px;
}

.skin-sample-icons {
  font-size: 15px;
  letter-spacing: 2px;
}

.skin-sample-card {
  padding: 5px 7px;
  border: 1px solid var(--sk-border);
  border-radius: 7px;
  background: var(--sk-surface);
}

.skin-sample-btn {
  align-self: flex-end;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--sk-accent);
  color: var(--sk-accent-text);
  font-weight: 700;
}

.skin-name {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  font-size: 14px;
}

.skin-crown {
  margin-left: auto;
  font-size: 13px;
}

.skin-desc {
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.skin-tiers p {
  margin: 2px 0;
}

/* グループの公式と違う着せ替えのときの案内 */
.skin-differs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skin-differs p {
  margin: 0;
}

/* 設定の画面の目次（押すとそのセクションへ） */
.settings-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}

.content [id^='set-'] {
  scroll-margin-top: calc(var(--safe-top) + 72px);
}

/* もう 1 つメニューが開く項目：右に ›（線で描く）。戻るボタンは左に ‹ */
.sheet-action.has-sub,
.sheet-action.is-back {
  position: relative;
  padding-left: 40px;
  padding-right: 40px;
}

.sheet-action.has-sub::after,
.sheet-action.is-back::before {
  content: '';
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border-top: 2.5px solid currentColor;
  border-right: 2.5px solid currentColor;
  border-radius: 1px;
  opacity: 0.55;
}

.sheet-action.has-sub::after {
  right: 18px;
  transform: translateY(-50%) rotate(45deg);
}

.sheet-action.is-back::before {
  left: 20px;
  transform: translateY(-50%) rotate(-135deg);
}

/* 着せ替え・壁紙のシートのタブ */
.look-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--accent-soft);
}

.look-tab {
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 700;
  color: var(--muted);
}

.look-tab.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* アカウントの削除 */
.btn.danger-btn {
  margin-top: 16px;
  color: var(--danger);
}

.delete-account-list {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.legal-footer {
  margin: 8px 0 0;
  font-size: 13px;
  text-align: center;
}

.legal-footer a {
  color: var(--muted);
  text-decoration: underline;
}

.share-targets {
  justify-content: center;
  margin-bottom: 8px;
}
