@font-face {
  font-family: 'MihoyoZenZero';
  src: url('font/mihoyo-zenzero.ttf') format('truetype');
}

:root {
  --bg:      #f4f4f9;
  --surface: #ffffff;
  --surface2:#eeeeee;
  --accent:  #ffcc00;
  --text:    #333333;
  --muted:   #888888;
  --border:  #dddddd;
  --gold:    #aa8800;
  --font:    'MihoyoZenZero', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
}

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

.site-version {
  position: fixed;
  right: 8px;
  bottom: 6px;
  font-size: 11px;
  color: rgba(0,0,0,0.2);
  pointer-events: none;
  z-index: 1;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 40px;
}

header {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 40px 16px 16px;
  text-align: center;
}

.header-topbar {
  display: flex;
  justify-content: flex-end;
  padding: 0 4px;
}

.lang-switch {
  display: flex;
  gap: 8px;
  font-size: 0.8rem;
}
.lang-switch label { display: flex; align-items: center; gap: 3px; cursor: pointer; }

header h1 {
  margin-top: 8px;
  font-size: 1.3rem;
  font-weight: bold;
}

.header-sub {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

main {
  flex: 1;
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px;
}

.balance-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
}

.balance-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.balance-value {
  margin-top: 4px;
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--gold);
}

.balance-unit {
  font-size: 1.1rem;
  margin-left: 3px;
  color: var(--muted);
}

.balance-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: bold;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tab-btn.active {
  background: var(--accent);
  color: #4a3600;
  border-color: var(--accent);
}

.tab-panel[hidden] { display: none; }

.items-section h2 {
  font-size: 1rem;
  margin-bottom: 12px;
}

/* ミッション一覧（交換所と同じ見た目を流用。costの代わりに報酬(+N)を表示する） */
.item-reward {
  flex-shrink: 0;
  font-weight: bold;
  color: var(--gold);
  font-size: 1.1rem;
  min-width: 56px;
}
.item-reward-unit {
  margin-left: 1px;
  color: var(--muted);
}

.item-mission-status {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  white-space: pre-line;
}
/* ミッション用ボタン共通(移動する/受け取るを同じ形に揃える) */
.item-mission-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 8px 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}
.item-mission-btn-goto {
  background: #4a90e2;
  color: #ffffff;
  border-color: #3a7bc8;
}
.item-mission-btn-goto:hover { background: #3a7bc8; }

.item-mission-btn-claim {
  background: linear-gradient(180deg, #ffe066, #ff9800);
  color: #4a2c00;
  border-color: #e08600;
}
.item-mission-btn-claim:hover { filter: brightness(1.06); }

.site-group-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.site-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.site-group-header {
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
}
.site-group-header::-webkit-details-marker { display: none; }
.site-group-header::after {
  content: '▼';
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.15s;
}
.site-group[open] .site-group-header::after { transform: rotate(180deg); }

.site-group-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.item-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}

.item-cost {
  flex-shrink: 0;
  font-weight: bold;
  color: var(--gold);
  font-size: 1.1rem;
  min-width: 56px;
}

.item-cost-unit {
  margin-left: 1px;
  color: var(--muted);
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 0.9rem;
  font-weight: bold;
}

.item-desc {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

/* 実績コンプリート等、交換条件付きアイテムの条件文(達成状況込み) */
.item-condition {
  color: #a15c00;
  font-weight: bold;
}

.item-action {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.item-limit {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  white-space: pre-line;
}

.item-redeem-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #4a3600;
  cursor: pointer;
}
.item-redeem-btn:disabled {
  background: var(--surface2);
  color: var(--muted);
  cursor: default;
}
/* 交換済み(上限到達): 中立なグレーのまま「済み」だと分かる表示 */
.item-redeem-btn-done:disabled {
  background: var(--surface2);
  color: var(--muted);
}
/* ポイント不足 or 交換条件未達成: どちらも「まだ交換できない」という意味で同じ扱いにし、
   交換済み(グレー)と見分けがつくよう、はっきり違う色にする */
.item-redeem-btn-insufficient:disabled {
  background: #fdecea;
  color: #c0392b;
}

.site-footer {
  text-align: center;
  padding: 26px 16px 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.twitter-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.sad_label {
  font-size: 0.8rem;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: 90%;
  background: rgba(0,0,0,0.82);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 2000;
  text-align: center;
}
.toast.toast-error { background: rgba(180,30,30,0.9); }
