/* ===== レイアウト ===== */
.tool-main {
  max-width: 900px;
}

.add-card {
  margin-bottom: 1.25rem;
}

.add-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.city-select {
  flex: 1;
  min-width: 0;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin: 0.5rem 0 0;
}

/* ===== 都市グリッド ===== */
.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

/* ===== 都市カード ===== */
.city-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  position: relative;
  transition: border-color 0.2s;
}

.city-card.is-japan {
  border-color: #3b82f6;
  border-width: 2px;
}

.city-card-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.city-flag {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.city-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.2rem;
  border-radius: 3px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.city-remove:hover {
  color: #ef4444;
  background: #fef2f2;
}

[data-theme="dark"] .city-remove:hover {
  background: #2d1414;
}

.city-time {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.city-date {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 0.15rem;
  margin-bottom: 0.5rem;
}

.city-diff {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  background: #f1f5f9;
  color: var(--text-sub);
}

[data-theme="dark"] .city-diff {
  background: #1e293b;
}

.city-diff.diff-behind {
  background: #fef3c7;
  color: #92400e;
}

.city-diff.diff-ahead {
  background: #dcfce7;
  color: #166534;
}

[data-theme="dark"] .city-diff.diff-behind {
  background: #2d1f00;
  color: #fbbf24;
}

[data-theme="dark"] .city-diff.diff-ahead {
  background: #052e16;
  color: #4ade80;
}

.city-diff.diff-same {
  background: #eff6ff;
  color: #1d4ed8;
}

[data-theme="dark"] .city-diff.diff-same {
  background: #172554;
  color: #93c5fd;
}

.city-tz-label {
  font-size: 0.7rem;
  color: var(--text-sub);
  margin-top: 0.3rem;
  opacity: 0.7;
}

/* ===== 時刻変換セクション ===== */
.time-input-card {
  margin-top: 0;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.9rem;
}

.time-convert-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.time-city-group {
  flex: 1;
  min-width: 150px;
}

.city-select-sm {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.convert-arrow {
  font-size: 1.4rem;
  color: var(--text-sub);
  padding-bottom: 0.4rem;
  flex-shrink: 0;
}

.convert-result {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
}

.convert-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
}

.convert-city-name {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.convert-time {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.convert-date {
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-top: 0.1rem;
}

.convert-diff-badge {
  font-size: 0.72rem;
  color: var(--text-sub);
  margin-top: 0.25rem;
}

@media (max-width: 540px) {
  .city-grid {
    grid-template-columns: 1fr 1fr;
  }

  .time-convert-row {
    flex-direction: column;
    align-items: stretch;
  }

  .convert-arrow {
    display: none;
  }
}

@media (max-width: 380px) {
  .city-grid {
    grid-template-columns: 1fr;
  }
}
