/* === CSS Custom Properties === */
:root {
  --bg: #F5F3F0;
  --bg-card: #FFFFFF;
  --text: #2C2C2C;
  --text-muted: #666666;
  --text-light: #999999;
  --border: #E0DDD8;
  --accent: #4A90D9;
  --accent-light: #E8F0FE;
  --danger: #E74C3C;
  --toast-bg: #2C2C2C;
  --toast-text: #FFFFFF;
  --nav-height: 64px;
  --header-height: 52px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --touch-min: 48px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-top: var(--header-height);
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* === Header === */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

#app-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 28px;
}

.lang-toggle:active {
  background: var(--accent-light);
  color: var(--accent);
}

.header-coins {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 12px;
  border-radius: 20px;
}

/* === Screen System === */
.screen {
  display: none;
  padding: 12px 16px 16px;
  animation: fadeIn 0.15s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Section === */
.section {
  margin-bottom: 20px;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === Search Bar === */
.search-bar {
  margin-bottom: 16px;
}

.search-bar input {
  width: 100%;
  height: var(--touch-min);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus {
  border-color: var(--accent);
}

/* === Search Results === */
.search-results {
  margin-bottom: 16px;
}

.search-results .search-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0 4px;
}

.search-results .activity-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

/* === Category Grid === */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 10px 4px;
  min-height: var(--touch-min);
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

.category-card:active {
  transform: scale(0.95);
  box-shadow: none;
}

.category-card .cat-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.category-card .cat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  color: var(--text);
  word-break: keep-all;
}

.category-card .cat-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* === Screen Header (category detail) === */
.screen-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-back {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--accent);
  cursor: pointer;
  padding: 8px 4px;
  min-height: var(--touch-min);
  display: flex;
  align-items: center;
}

.screen-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.screen-title-fixed {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

/* === Activity List === */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  min-height: var(--touch-min);
  cursor: pointer;
  transition: background 0.1s;
  -webkit-user-select: none;
  user-select: none;
}

.activity-item:active {
  background: var(--accent-light);
}

.activity-item .act-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.activity-item .act-label {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.3;
}

.activity-item .act-count {
  font-size: 0.75rem;
  color: var(--text-light);
  flex-shrink: 0;
}

/* === Recent List === */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  min-height: var(--touch-min);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.recent-item:active {
  background: var(--accent-light);
}

.recent-item .ri-icon {
  font-size: 1.2rem;
}

.recent-item .ri-label {
  flex: 1;
  font-size: 0.9rem;
}

.recent-item .ri-time {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* === Favorites List === */
.favorites-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.favorites-list::-webkit-scrollbar {
  display: none;
}

.favorite-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  flex-shrink: 0;
  min-height: var(--touch-min);
  cursor: pointer;
  scroll-snap-align: start;
  -webkit-user-select: none;
  user-select: none;
}

.favorite-chip:active {
  background: var(--accent-light);
}

.favorite-chip .fav-icon {
  font-size: 1.1rem;
}

.favorite-chip .fav-label {
  font-size: 0.85rem;
  font-weight: 500;
}

/* === Free Input === */
.free-input-row {
  display: flex;
  gap: 8px;
}

.free-input-row input {
  flex: 1;
  height: var(--touch-min);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
}

.free-input-row input:focus {
  border-color: var(--accent);
}

.btn-primary {
  height: var(--touch-min);
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary:active:not(:disabled) {
  opacity: 0.8;
}

/* === History === */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-date-group {
  margin-bottom: 16px;
}

.history-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-left: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  min-height: var(--touch-min);
}

.history-item .hi-icon {
  font-size: 1.2rem;
}

.history-item .hi-label {
  flex: 1;
  font-size: 0.9rem;
}

.history-item .hi-time {
  font-size: 0.75rem;
  color: var(--text-light);
}

.history-item .hi-delete {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-item .hi-delete:active {
  color: var(--danger);
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* === Settings === */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.btn-secondary {
  height: var(--touch-min);
  padding: 0 20px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
}

.btn-danger {
  height: var(--touch-min);
  padding: 0 20px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 16px);
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 1rem;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* === Bottom Nav === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  min-height: var(--touch-min);
  transition: color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.nav-btn.active {
  color: var(--accent);
}

.nav-icon {
  font-size: 1.3rem;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
}

/* === Mining Overlay === */
.mining-overlay[hidden] {
  display: none;
}

.mining-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: fadeIn 0.2s ease;
}

.mining-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
  max-width: 300px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.mining-icon {
  font-size: 3rem;
  animation: miningBounce 0.6s ease infinite alternate;
}

@keyframes miningBounce {
  from { transform: translateY(0) rotate(-10deg); }
  to { transform: translateY(-8px) rotate(10deg); }
}

.mining-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 12px;
  color: var(--text);
}

.mining-nonce {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.mining-hash {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 6px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  word-break: break-all;
  line-height: 1.4;
}

.mining-progress {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden;
  position: relative;
}

.mining-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  animation: miningBar 1.2s ease-in-out infinite;
}

@keyframes miningBar {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* === History Tabs === */
.history-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  background: var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.history-tab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.history-tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* === Verify Button === */
.btn-verify {
  width: 100%;
  height: var(--touch-min);
  padding: 0 20px;
  background: var(--bg-card);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background 0.15s;
}

.btn-verify:active {
  background: var(--accent-light);
}

/* === Verify Result === */
.verify-result {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.verify-result.valid {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
}

.verify-result.invalid {
  background: #FFEBEE;
  color: #C62828;
  border: 1px solid #EF9A9A;
}

/* === Chain List (Blockchain Viewer) === */
.chain-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chain-block {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  position: relative;
}

.chain-link {
  display: flex;
  justify-content: center;
  padding: 4px 0;
  color: var(--text-light);
  font-size: 1rem;
}

.chain-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.chain-block-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 10px;
}

.chain-block-time {
  font-size: 0.7rem;
  color: var(--text-light);
}

.chain-block-activity {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.chain-block-activity .cb-icon {
  font-size: 1.2rem;
}

.chain-block-activity .cb-label {
  font-size: 0.85rem;
  font-weight: 500;
}

.chain-block-meta {
  font-size: 0.65rem;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  color: var(--text-light);
  line-height: 1.6;
  word-break: break-all;
}

.chain-block-meta span {
  color: var(--text-muted);
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.chain-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* === Exchange Screen === */
.exchange-balance {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--accent), #6BB5FF);
  border-radius: var(--radius);
  margin-bottom: 16px;
  color: #fff;
}

.balance-amount {
  font-size: 2.5rem;
  font-weight: 800;
}

.balance-label {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 2px;
}

/* === Badge List === */
.badge-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  text-align: center;
  box-shadow: var(--shadow);
}

.badge-card.locked {
  opacity: 0.35;
  filter: grayscale(1);
}

.badge-card .badge-icon {
  font-size: 2rem;
}

.badge-card .badge-label {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-card .badge-coins {
  font-size: 0.6rem;
  color: var(--text-light);
}

/* === Reward List === */
.reward-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.reward-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  min-height: var(--touch-min);
}

.reward-item .rw-label {
  flex: 1;
  font-size: 0.9rem;
}

.reward-item .rw-cost {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.reward-item .rw-use {
  height: 32px;
  padding: 0 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.reward-item .rw-use:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.reward-item .rw-del {
  background: none;
  border: none;
  font-size: 0.9rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
}

.reward-add-row {
  display: flex;
  gap: 6px;
}

.reward-add-row input {
  height: var(--touch-min);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
}

.reward-add-row input:first-child {
  flex: 1;
}

.reward-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* === Witness === */
.witness-modal {
  max-width: 320px;
}

.witness-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.witness-code {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 12px;
  color: var(--accent);
  margin: 12px 0 4px;
  font-variant-numeric: tabular-nums;
}

.witness-instruction {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 12px;
}

.witness-input {
  width: 160px;
  height: var(--touch-min);
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  margin: 0 auto;
  display: block;
}

.witness-input:focus {
  border-color: var(--accent);
}

.witness-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.witness-error {
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 8px;
}

/* === History Item Witness === */
.hi-witness {
  background: none;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 8px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.hi-witness:active {
  background: var(--accent-light);
}

.hi-witnessed {
  font-size: 0.6rem;
  color: #2E7D32;
  background: #E8F5E9;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

/* === Auth Screen === */
.auth-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #4A90D9 0%, #6BB5FF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.auth-screen[hidden] {
  display: none;
}

.auth-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px 28px 32px;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.auth-logo {
  font-size: 4rem;
  margin-bottom: 8px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

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

.auth-form[hidden] {
  display: none;
}

.auth-form input {
  height: var(--touch-min);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 1rem;
  color: var(--text);
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent);
}

.auth-btn {
  margin-top: 4px;
}

.auth-switch {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: #FFEBEE;
  color: #C62828;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
}

.auth-error[hidden] {
  display: none;
}

/* === Profile === */
.profile-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.profile-avatar {
  font-size: 3rem;
}

.profile-name {
  font-size: 1.3rem;
  font-weight: 700;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.profile-stat {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
}

.profile-stat .ps-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.profile-stat .ps-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-select {
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.85rem;
  color: var(--text);
}

/* === Friend Code Display === */
.friend-code-display {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.friend-code-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* === Friend Request === */
.friend-request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.friend-request-item .fr-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.friend-request-item .fr-actions {
  display: flex;
  gap: 6px;
}

.friend-request-item .btn-accept {
  height: 32px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.friend-request-item .btn-reject {
  height: 32px;
  padding: 0 14px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

/* === Friend List === */
.friend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  min-height: var(--touch-min);
}

.friend-item .fi-name {
  font-size: 0.95rem;
  font-weight: 500;
}

.friend-item .fi-remove {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
}

/* === Feed === */
.feed-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 6px;
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.feed-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.feed-time {
  font-size: 0.7rem;
  color: var(--text-light);
}

.feed-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.feed-activity {
  font-size: 0.9rem;
}

.feed-witness-btn {
  height: 30px;
  padding: 0 12px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 15px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.feed-witness-btn:active {
  background: var(--accent);
  color: #fff;
}

.feed-witnessed {
  font-size: 0.65rem;
  color: #2E7D32;
  background: #E8F5E9;
  padding: 4px 8px;
  border-radius: 10px;
  font-weight: 600;
}

/* === Recovery Code === */
.recovery-code-display {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 12px 0 8px;
  font-variant-numeric: tabular-nums;
  user-select: all;
}

.recovery-message {
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 600;
  line-height: 1.5;
  white-space: pre-line;
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  .screen {
    animation: none;
  }
  .toast {
    transition: none;
  }
  .category-card,
  .activity-item,
  .btn-primary {
    transition: none;
  }
}
