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

body {
  background: #F5F7FB;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans JP", sans-serif;
  color: #222;
  font-size: 14px;
  min-height: 100vh;
}

#app {
  width: 100%;
}

#mainCard {
  max-width: 360px;
  margin: 0 auto;
  padding-top: 24px;
  padding-bottom: 24px;
  padding-left: 16px;
  padding-right: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 0 0 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}

.app-header {
  padding: 14px 16px;
}

.app-header h1 {
  font-size: 15px;
  font-weight: bold;
  color: #222;
  margin: 0;
}

/* メインコンテンツ */
#mainContent {
  padding: 0 16px;
}

/* 初回セットアップ画面 */
#setupScreen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  gap: 0;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.setup-title {
  font-size: 22px;
  font-weight: 400;
  color: #333;
  margin-bottom: 48px;
  text-align: center;
  letter-spacing: 0.08em;
}

.setup-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

#setupFidInput {
  width: 140px;
  flex-shrink: 0;
  padding: 8px 0;
  height: 44px;
  border: none;
  border-bottom: 1px solid #D1D5DB;
  border-radius: 0;
  font-size: 18px;
  font-family: inherit;
  color: #111;
  background: transparent;
  outline: none;
  box-shadow: none;
  text-align: center;
  letter-spacing: 0.1em;
  transition: border-color 0.15s;
}

#setupFidInput:focus {
  border-bottom-color: #2A74BC;
}

.setup-btn {
  flex-shrink: 0;
  height: 44px;
  padding: 0 20px;
  background: #2A74BC;
  color: #fff;
  border: none;
  border-radius: 0;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.setup-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.setup-error {
  font-size: 13px;
  color: #EF4444;
  margin-top: 12px;
  min-height: 18px;
  text-align: center;
}


/* タブ */
.tabs {
  display: flex;
  border-bottom: 1px solid #e8e8e8;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 7px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  color: #999;
  cursor: pointer;
  margin-bottom: -1px;
}

.tab.active {
  color: #222;
  font-weight: bold;
  border-bottom-color: #222;
}

/* プレイヤー情報カード */
.player-section {
  margin-bottom: 14px;
}

.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.player-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.player-name {
  font-size: 20px;
  font-weight: bold;
  color: #222;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-id-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.player-id-label {
  font-size: 12px;
  color: #aaa;
}

.player-fid {
  font-size: 12px;
  color: #888;
}

.player-avatar-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #e8e8e8;
  overflow: hidden;
  flex-shrink: 0;
}

.player-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 活動状況 */
.activity-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.activity-header {
  font-size: 14px;
  color: #666;
}

.activity-count {
  font-size: 14px;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.1s;
}

.activity-count:active {
  background: #f0f0f0;
}


/* 区切り線 */
.divider {
  height: 1px;
  background: #ebebeb;
  margin-bottom: 12px;
}

/* セレクト */
.controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

select {
  width: auto;
  max-width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  font-size: 13px;
  color: #333;
  appearance: auto;
}

/* 進捗 */
.progress-area {
  font-size: 13px;
  font-weight: bold;
  color: #444;
  margin-bottom: 10px;
}

/* ピースグリッド */
.piece-grid {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  justify-content: center;
  gap: 6px;
}

.piece-tile {
  position: relative;
  width: 68px;
  height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  background: #fff;
  color: #bbb;
  transition: background 0.1s;
}

.tile-num {
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

.tile-state {
  font-size: 11px;
  font-weight: normal;
  line-height: 1;
  opacity: 0.85;
}

.piece-tile.state-want {
  background: #fff0f0;
  border-color: #f5b8b8;
  color: #d33;
}

.piece-tile.state-offer {
  background: #f0f4ff;
  border-color: #b8c8f5;
  color: #336;
}

.piece-tile.state-have {
  background: #f0f0f0;
  border-color: #ccc;
  color: #888;
}

.piece-tile.state-have5 {
  background: #f0f0f0;
  border-color: #ccc;
  color: #888;
}

.star-badge {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 9px;
  color: #f5a623;
}

/* マッチング */
#matchingResult {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-empty {
  font-size: 13px;
  color: #aaa;
  text-align: center;
  padding: 24px 0;
}

.match-card {
  border: 1px solid #e0e0e0;
  border-left: 3px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  transition: background 0.15s;
  background: #fff;
}

.match-card--mine {
  border-left-color: #2A74BC;
  background: #f7faff;
}

.match-meta {
  font-size: 12px;
  color: #666;
}


.match-card--dim {
  opacity: 0.6;
}

.match-card:active {
  background: #f0f0f0;
}

.match-card.copied {
  background: #e8f5e9;
}

.match-card.copied::after {
  content: "コピーしました";
  display: block;
  font-size: 11px;
  color: #4caf50;
  margin-top: 2px;
}

.match-header {
  font-size: 13px;
  font-weight: bold;
  color: #222;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.match-arrow {
  color: #2A74BC;
  font-size: 14px;
}

.match-label {
  font-size: 10px;
  font-weight: normal;
  color: #888;
  background: #f0f0f0;
  border-radius: 3px;
  padding: 1px 5px;
}

.match-player {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.match-player--done {
  color: #bbb;
}
