* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #7c3aed;
  --gf: #f472b6;
  --gf-light: #fce7f3;
  --bf: #60a5fa;
  --bf-light: #dbeafe;
  --joint: #a78bfa;
  --joint-light: #ede9fe;
  --income: #10b981;
  --expense: #ef4444;
  --bg: #f8f7ff;
  --card: #ffffff;
  --text: #1e1b4b;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 14px;
}

body {
  font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 90px;
  max-width: 480px;
  margin: 0 auto;
}

/* ヘッダー */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 10px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.settings-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}
.reload-btn {
  background: none;
  border: none;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  line-height: 1;
  transition: color 0.2s, transform 0.3s;
}
.reload-btn:hover { color: var(--primary); }
.reload-btn:active { transform: rotate(180deg); }

.logout-btn {
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

/* タブ */
.tab-nav {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 57px;
  z-index: 9;
}

.tab-btn {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--joint);
  border-bottom-color: var(--joint);
}

/* タブコンテンツ */
.tab-content { display: none; padding: 16px; }
.tab-content.active { display: block; }

/* 月ナビ */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.month-nav button {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.month-input {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  text-align: center;
  min-width: 110px;
}

/* 残高セクション */
.balance-section {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.person-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-top: 4px solid transparent;
}

.person-card.girlfriend { border-top-color: var(--gf); }
.person-card.boyfriend  { border-top-color: var(--bf); }

.person-avatar { font-size: 1.6rem; margin-bottom: 4px; }
.person-name { font-size: 0.75rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.person-amount { font-size: 1.05rem; font-weight: 700; color: var(--expense); }
.person-label { font-size: 0.65rem; color: var(--muted); margin-top: 2px; }

.joint-card {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
  color: white;
}

.joint-icon { font-size: 1.6rem; margin-bottom: 4px; }
.joint-label { font-size: 0.7rem; font-weight: 700; opacity: 0.85; margin-bottom: 10px; }
.joint-sub {
  font-size: 0.72rem;
  opacity: 0.92;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.joint-sub span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.joint-sub-label { opacity: 0.8; }
.joint-sub b { font-weight: 700; font-size: 0.9rem; }

/* セクションタイトル */
.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  margin-top: 4px;
}

/* カテゴリチャート */
.category-chart {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.category-row:last-child { margin-bottom: 0; }

.cat-icon { font-size: 1rem; width: 24px; text-align: center; }
.cat-name { font-size: 0.8rem; font-weight: 600; width: 56px; flex-shrink: 0; }
.cat-bar-wrap { flex: 1; background: #f3f4f6; border-radius: 99px; height: 8px; overflow: hidden; }
.cat-bar { height: 100%; border-radius: 99px; background: var(--joint); transition: width 0.4s; }
.cat-amount { font-size: 0.78rem; font-weight: 700; color: var(--expense); width: 60px; text-align: right; flex-shrink: 0; }

.category-row {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px;
  margin: 0 -4px;
  transition: background 0.15s;
}
.category-row:hover { background: #f3f4f6; }
.category-row.cat-expanded { background: #f3f4f6; }

.cat-expand-arrow {
  font-size: 0.6rem;
  color: var(--muted);
  flex-shrink: 0;
  width: 12px;
  text-align: center;
  transition: transform 0.2s;
}

/* カテゴリ詳細パネル */
.cat-detail {
  background: #f8f7ff;
  border-radius: 8px;
  margin: 2px 0 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.cat-detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.cat-detail-item:last-child { border-bottom: none; }

.cat-di-payer {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.cat-di-payer.girlfriend { background: var(--gf-light); }
.cat-di-payer.boyfriend  { background: var(--bf-light); }
.cat-di-payer.joint      { background: var(--joint-light); }

.cat-di-info { flex: 1; min-width: 0; }
.cat-di-note { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-di-meta { font-size: 0.7rem; color: var(--muted); margin-top: 1px; }
.cat-di-amount { font-size: 0.85rem; font-weight: 700; color: var(--expense); flex-shrink: 0; }

.empty-chart {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 16px 0;
}

/* 取引リスト */
.transaction-list { display: flex; flex-direction: column; gap: 8px; }
.empty-msg { text-align: center; color: var(--muted); padding: 32px 0; font-size: 0.85rem; }

/* 日付グループ */
.tx-date-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  padding: 8px 4px 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 8px;
}
.tx-date-header:first-child { margin-top: 0; }
.tx-group { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }

/* 履歴月ナビ */
.history-month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.history-month-nav button {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text);
}
.history-month-all-btn {
  font-size: 0.78rem !important;
  font-weight: 700;
  color: var(--muted) !important;
  padding: 4px 14px !important;
  transition: all 0.2s;
  white-space: nowrap;
  width: auto !important;
  min-width: fit-content;
}
.history-month-all-btn.active {
  background: var(--joint) !important;
  color: white !important;
  border-color: var(--joint) !important;
}

.tx-item {
  background: white;
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  animation: fadeUp 0.2s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tx-payer-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tx-payer-badge.girlfriend { background: var(--gf-light); }
.tx-payer-badge.boyfriend  { background: var(--bf-light); }
.tx-payer-badge.joint      { background: var(--joint-light); }

.tx-info { flex: 1; min-width: 0; }
.tx-category { font-size: 0.88rem; font-weight: 600; }
.tx-meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tx-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.tx-type-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}
.tx-type-badge.expense  { background: #fee2e2; color: var(--expense); }
.tx-type-badge.transfer { background: #fef3c7; color: #d97706; }
.tx-type-badge.advance  { background: #d1fae5; color: #059669; }

.tx-amount { font-size: 0.95rem; font-weight: 700; }
.tx-amount.expense  { color: var(--expense); }
.tx-amount.income   { color: var(--income); }
.tx-amount.deposit  { color: var(--joint); }
.tx-amount.transfer { color: #f59e0b; }

.tx-actions { display: flex; gap: 4px; align-items: center; }

.tx-edit,
.tx-delete {
  background: none;
  border: none;
  color: #d1d5db;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

.tx-edit:hover   { color: var(--joint);   background: var(--joint-light); }
.tx-delete:hover { color: var(--expense); background: #fee2e2; }

/* フィルターバー */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-bar select {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 0.75rem;
  color: var(--text);
  outline: none;
}

.filter-bar select:focus { border-color: var(--joint); }

/* 精算タブ */
.settle-card {
  background: white;
  border-radius: 18px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
  margin-bottom: 24px;
}

.settle-icon { font-size: 2.5rem; margin-bottom: 12px; }
.settle-desc { font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.settle-amount { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-top: 8px; }

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

.breakdown-item {
  background: white;
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.bd-avatar { font-size: 1.6rem; }
.bd-info { flex: 1; }
.bd-name { font-size: 0.85rem; font-weight: 700; }
.bd-detail { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.bd-amount { font-size: 1rem; font-weight: 700; }
.bd-amount.positive { color: var(--income); }
.bd-amount.negative { color: var(--expense); }

.ratio-info-item {
  background: var(--joint-light);
  border-left: 3px solid var(--joint);
}

/* 入金目標カード */
.deposit-target-item {
  background: #f0fdf4;
  border-left: 3px solid var(--income);
}
.deposit-done { color: var(--income); }

/* 割合変更前の精算カード */
.prev-settle-item {
  background: #fef9ec;
  border-left: 3px solid #f59e0b;
}

/* 追加ボタン */
.add-btn {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: white;
  border: none;
  padding: 14px 36px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  z-index: 8;
}

.add-btn:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.55);
}

/* モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: 22px 22px 0 0;
  padding: 10px 20px 36px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(.32,1,.32,1);
  overflow-y: auto;
  max-height: 92vh;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-handle {
  width: 40px;
  height: 4px;
  background: #e5e7eb;
  border-radius: 99px;
  margin: 0 auto 16px;
}

.modal h2 {
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 18px;
}

/* 種別トグル */
.type-toggle {
  display: flex;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
  gap: 2px;
}

.type-btn {
  flex: 1;
  padding: 8px 4px;
  border: none;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: all 0.2s;
}

.type-btn.active {
  background: white;
  color: var(--joint);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* 支出元トグル */
.payer-toggle {
  display: flex;
  gap: 10px;
}

.payer-btn,
.transfer-to-btn,
.ben-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.payer-btn.active[data-payer="girlfriend"],
.transfer-to-btn.active[data-to="girlfriend"] { border-color: var(--gf);    background: var(--gf-light); }
.payer-btn.active[data-payer="boyfriend"],
.transfer-to-btn.active[data-to="boyfriend"]  { border-color: var(--bf);    background: var(--bf-light); }
.payer-btn.active[data-payer="joint"],
.transfer-to-btn.active[data-to="joint"]      { border-color: var(--joint); background: var(--joint-light); }

.ben-btn.active[data-ben="none"]       { border-color: var(--joint); background: var(--joint-light); }
.ben-btn.active[data-ben="girlfriend"] { border-color: var(--gf);    background: var(--gf-light); }
.ben-btn.active[data-ben="boyfriend"]  { border-color: var(--bf);    background: var(--bf-light); }

.advance-to-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; border: 2px solid var(--border); border-radius: 10px; background: white; cursor: pointer; transition: all 0.2s; }
.advance-to-btn.active[data-to="girlfriend"] { border-color: var(--gf); background: var(--gf-light); }
.advance-to-btn.active[data-to="boyfriend"]  { border-color: var(--bf); background: var(--bf-light); }

.payer-avatar { font-size: 1.1rem; }
.payer-name { font-size: 0.78rem; font-weight: 700; color: var(--text); }

/* フォーム */
.form-group { margin-bottom: 9px; }

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text);
  background: white;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--joint); }

/* 割合履歴 */
.ratio-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.ratio-history-item {
  display: flex;
  align-items: center;
  background: #f8f7ff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  gap: 8px;
  font-size: 0.82rem;
}

.ratio-history-item .rh-date {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.ratio-history-item .rh-ratio {
  flex: 1;
  font-weight: 700;
  color: var(--text);
}

.ratio-history-item .rh-delete {
  background: none;
  border: none;
  color: #d1d5db;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.ratio-history-item .rh-delete:hover {
  color: var(--expense);
  background: #fee2e2;
}

.ratio-add-section {
  border-top: 1px dashed var(--border);
  padding-top: 4px;
  margin-top: 4px;
}

/* 割合入力 */
.ratio-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ratio-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ratio-person {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.ratio-colon {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--muted);
  padding-top: 18px;
}

.ratio-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* 設定モーダル スクロール対応 */
.settings-modal {
  max-height: 88vh;
  overflow-y: auto;
}

.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.settings-modal-header h2 {
  margin-bottom: 0;
}

/* アコーディオン */
.collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 6px 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  user-select: none;
  gap: 8px;
}
.collapse-toggle:hover { color: var(--text); }

.collapse-arrow {
  font-size: 0.65rem;
  display: inline-block;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.collapse-toggle.open .collapse-arrow { transform: rotate(90deg); }

.collapse-body { display: none; }

/* GitHub 連動セクション */
.github-section {
  border-top: 1px dashed var(--border);
  padding-top: 4px;
  margin-top: 4px;
}

.github-section input {
  width: 100%;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text);
  background: white;
  outline: none;
  margin-top: 6px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.github-section input:focus { border-color: var(--joint); }

.gh-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

/* ヘッダー常時表示 */
.gh-sync-status-header {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
  transition: opacity 0.3s;
}
.gh-sync-status-header.gh-ok      { background: #d1fae5; color: #059669; }
.gh-sync-status-header.gh-syncing { background: #dbeafe; color: #2563eb; }
.gh-sync-status-header.gh-error   { background: #fee2e2; color: var(--expense); }

.gh-sync-status {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
}
.gh-sync-status.gh-none    { background: #f3f4f6; color: var(--muted); }
.gh-sync-status.gh-ok      { background: #d1fae5; color: #059669; }
.gh-sync-status.gh-syncing { background: #dbeafe; color: #2563eb; }
.gh-sync-status.gh-error   { background: #fee2e2; color: var(--expense); }

.btn-gh-sync-now {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--joint);
  background: var(--joint-light);
  color: var(--joint);
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-gh-sync-now:hover { opacity: 0.75; }

/* CSVダウンロードバー */
.csv-dl-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.csv-year-sel {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: white;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
}
.csv-year-sel:focus { border-color: var(--joint); }

.btn-csv-dl {
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 14px;
  border: none;
  border-radius: 10px;
  background: var(--joint-light);
  color: var(--joint);
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-csv-dl:hover { opacity: 0.75; }

/* モーダルアクション */
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-cancel, .btn-save {
  flex: 1;
  padding: 13px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-cancel { background: #f3f4f6; color: var(--muted); }
.btn-save   { background: linear-gradient(135deg, #7c3aed, #a78bfa); color: white; }
.btn-cancel:hover, .btn-save:hover { opacity: 0.85; }

/* ── トークン失効アラート ── */
.token-alert-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.token-alert-overlay.active {
  display: flex;
}
.token-alert-box {
  background: white;
  border-radius: 18px;
  padding: 28px 24px 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.token-alert-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}
.token-alert-msg {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
}
.token-alert-sub {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}
.token-alert-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.token-alert-btn:hover { opacity: 0.85; }

/* ── 電卓キーボード ── */
.calc-kb {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #e8e8ed;
  border-top: 1px solid #c8c8cc;
  padding: 8px 8px 20px;
  z-index: 3000;
  display: none;
}
.calc-kb.active { display: block; }

.calc-kb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  max-width: 420px;
  margin: 0 auto;
}

.calc-btn {
  background: #ffffff;
  border: none;
  border-radius: 10px;
  height: 54px;
  font-size: 1.2rem;
  font-weight: 500;
  color: #1c1c1e;
  cursor: pointer;
  box-shadow: 0 1px 0 #a0a0a5;
  transition: background 0.1s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
}
.calc-btn:active { background: #d1d1d6; transform: scale(0.96); }

.calc-btn.calc-op   { background: #bfcfff; color: var(--primary); }
.calc-btn.calc-op:active { background: #a0b3ff; }

.calc-btn.calc-fn   { background: #ffd6d6; color: #c0392b; }
.calc-btn.calc-fn:active { background: #ffb3b3; }

.calc-btn.calc-eq   { background: var(--primary); color: white; }
.calc-btn.calc-eq:active { background: #5b21b6; }

.calc-btn.calc-done { background: #34c759; color: white; }
.calc-btn.calc-done:active { background: #28a745; }

.calc-btn.calc-zero { grid-column: span 2; }

